logic: implemented disabling of source groups
* added source group status (enabled/disabled) * fixed bug where the removal of an indexed directory has not affected the files to clear * added lots of const and override keywords in SourceGroupSettings
This commit is contained in:
@@ -9,6 +9,7 @@ SourceGroupSettings::SourceGroupSettings(const std::string& id, SourceGroupType
|
||||
, m_id(id)
|
||||
, m_name(sourceGroupTypeToString(type))
|
||||
, m_type(type)
|
||||
, m_status(SOURCE_GROUP_STATUS_ENABLED)
|
||||
, m_standard("")
|
||||
, m_sourcePaths(std::vector<FilePath>())
|
||||
, m_excludePaths(std::vector<FilePath>())
|
||||
@@ -29,7 +30,8 @@ void SourceGroupSettings::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
setName(name);
|
||||
}
|
||||
|
||||
|
||||
setStatus(stringToSourceGroupStatusType(getValue(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED), config)));
|
||||
setStandard(getValue<std::string>(key + "/standard", "", config));
|
||||
setSourcePaths(getPathValues(key + "/source_paths/source_path", config));
|
||||
setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path", config));
|
||||
@@ -40,6 +42,7 @@ void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
setValue(key + "/status", sourceGroupStatusTypeToString(getStatus()), config);
|
||||
setValue(key + "/name", getName(), config);
|
||||
setValue(key + "/standard", getStandard(), config);
|
||||
setPathValues(key + "/source_paths/source_path", getSourcePaths(), config);
|
||||
@@ -53,6 +56,7 @@ bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) con
|
||||
m_id == other->m_id &&
|
||||
m_name == other->m_name &&
|
||||
m_type == other->m_type &&
|
||||
m_status == other->m_status &&
|
||||
m_standard == other->m_standard &&
|
||||
utility::isPermutation(m_sourcePaths, other->m_sourcePaths) &&
|
||||
utility::isPermutation(m_excludePaths, other->m_excludePaths) &&
|
||||
@@ -100,6 +104,16 @@ SourceGroupType SourceGroupSettings::getType() const
|
||||
return m_type;
|
||||
}
|
||||
|
||||
SourceGroupStatusType SourceGroupSettings::getStatus() const
|
||||
{
|
||||
return m_status;
|
||||
}
|
||||
|
||||
void SourceGroupSettings::setStatus(SourceGroupStatusType status)
|
||||
{
|
||||
m_status = status;
|
||||
}
|
||||
|
||||
std::string SourceGroupSettings::getStandard() const
|
||||
{
|
||||
if (m_standard.empty())
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "settings/SourceGroupStatusType.h"
|
||||
#include "settings/SourceGroupType.h"
|
||||
|
||||
class ProjectSettings;
|
||||
@@ -35,6 +36,9 @@ public:
|
||||
virtual std::vector<std::string> getAvailableLanguageStandards() const = 0;
|
||||
virtual SourceGroupType getType() const;
|
||||
|
||||
SourceGroupStatusType getStatus() const;
|
||||
void setStatus(SourceGroupStatusType status);
|
||||
|
||||
std::string getStandard() const;
|
||||
void setStandard(const std::string& standard);
|
||||
|
||||
@@ -75,6 +79,7 @@ private:
|
||||
std::string m_id;
|
||||
std::string m_name;
|
||||
const SourceGroupType m_type;
|
||||
SourceGroupStatusType m_status;
|
||||
|
||||
std::string m_standard;
|
||||
std::vector<FilePath> m_sourcePaths;
|
||||
|
||||
@@ -10,12 +10,12 @@ public:
|
||||
SourceGroupSettingsCxx(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
|
||||
virtual ~SourceGroupSettingsCxx();
|
||||
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config);
|
||||
virtual void save(std::shared_ptr<ConfigManager> config);
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
virtual void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
virtual std::vector<std::string> getAvailableLanguageStandards() const;
|
||||
virtual std::vector<std::string> getAvailableLanguageStandards() const override;
|
||||
|
||||
std::vector<FilePath> getHeaderSearchPaths() const;
|
||||
std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const;
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
void setCompilerFlags(const std::vector<std::string>& compilerFlags);
|
||||
|
||||
private:
|
||||
virtual std::vector<std::string> getDefaultSourceExtensions() const;
|
||||
virtual std::string getDefaultStandard() const;
|
||||
virtual std::vector<std::string> getDefaultSourceExtensions() const override;
|
||||
virtual std::string getDefaultStandard() const override;
|
||||
|
||||
std::vector<FilePath> m_headerSearchPaths;
|
||||
std::vector<FilePath> m_frameworkSearchPaths;
|
||||
|
||||
@@ -10,10 +10,10 @@ public:
|
||||
SourceGroupSettingsCxxCdb(const std::string& id, const ProjectSettings* projectSettings);
|
||||
virtual ~SourceGroupSettingsCxxCdb();
|
||||
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config);
|
||||
virtual void save(std::shared_ptr<ConfigManager> config);
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
virtual void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
FilePath getCompilationDatabasePath() const;
|
||||
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
|
||||
|
||||
@@ -15,10 +15,10 @@ public:
|
||||
SourceGroupSettingsCxxEmpty(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
|
||||
virtual ~SourceGroupSettingsCxxEmpty();
|
||||
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config);
|
||||
virtual void save(std::shared_ptr<ConfigManager> config);
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
virtual void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
bool getTargetOptionsEnabled() const;
|
||||
void setTargetOptionsEnabled(bool targetOptionsEnabled);
|
||||
|
||||
@@ -13,12 +13,12 @@ public:
|
||||
SourceGroupSettingsJava(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
|
||||
virtual ~SourceGroupSettingsJava();
|
||||
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config);
|
||||
virtual void save(std::shared_ptr<ConfigManager> config);
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
virtual void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
virtual std::vector<std::string> getAvailableLanguageStandards() const;
|
||||
virtual std::vector<std::string> getAvailableLanguageStandards() const override;
|
||||
|
||||
bool getUseJreSystemLibrary() const;
|
||||
void setUseJreSystemLibrary(bool useJreSystemLibrary);
|
||||
@@ -28,8 +28,8 @@ public:
|
||||
void setClasspath(const std::vector<FilePath>& classpath);
|
||||
|
||||
private:
|
||||
virtual std::vector<std::string> getDefaultSourceExtensions() const;
|
||||
virtual std::string getDefaultStandard() const;
|
||||
virtual std::vector<std::string> getDefaultSourceExtensions() const override;
|
||||
virtual std::string getDefaultStandard() const override;
|
||||
|
||||
bool m_useJreSystemLibrary;
|
||||
std::vector<FilePath> m_classpath;
|
||||
|
||||
@@ -10,10 +10,10 @@ public:
|
||||
SourceGroupSettingsJavaGradle(const std::string& id, const ProjectSettings* projectSettings);
|
||||
virtual ~SourceGroupSettingsJavaGradle();
|
||||
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config);
|
||||
virtual void save(std::shared_ptr<ConfigManager> config);
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
virtual void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
FilePath getGradleProjectFilePath() const;
|
||||
FilePath getGradleProjectFilePathExpandedAndAbsolute() const;
|
||||
|
||||
@@ -10,10 +10,10 @@ public:
|
||||
SourceGroupSettingsJavaMaven(const std::string& id, const ProjectSettings* projectSettings);
|
||||
virtual ~SourceGroupSettingsJavaMaven();
|
||||
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config);
|
||||
virtual void save(std::shared_ptr<ConfigManager> config);
|
||||
virtual void load(std::shared_ptr<const ConfigManager> config) override;
|
||||
virtual void save(std::shared_ptr<ConfigManager> config) override;
|
||||
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
|
||||
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
FilePath getMavenProjectFilePath() const;
|
||||
FilePath getMavenProjectFilePathExpandedAndAbsolute() const;
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include "settings/SourceGroupStatusType.h"
|
||||
|
||||
std::string sourceGroupStatusTypeToString(SourceGroupStatusType v)
|
||||
{
|
||||
switch (v)
|
||||
{
|
||||
case SOURCE_GROUP_STATUS_ENABLED:
|
||||
return "enabled";
|
||||
case SOURCE_GROUP_STATUS_DISABLED:
|
||||
return "disabled";
|
||||
case SOURCE_GROUP_STATUS_UNKNOWN:
|
||||
break;
|
||||
}
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
SourceGroupStatusType stringToSourceGroupStatusType(std::string v)
|
||||
{
|
||||
if (v == sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED))
|
||||
{
|
||||
return SOURCE_GROUP_STATUS_ENABLED;
|
||||
}
|
||||
else if (v == sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_DISABLED))
|
||||
{
|
||||
return SOURCE_GROUP_STATUS_DISABLED;
|
||||
}
|
||||
|
||||
return SOURCE_GROUP_STATUS_UNKNOWN;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
#ifndef SOURCE_GROUP_STATUS_TYPE_H
|
||||
#define SOURCE_GROUP_STATUS_TYPE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
enum SourceGroupStatusType
|
||||
{
|
||||
SOURCE_GROUP_STATUS_ENABLED,
|
||||
SOURCE_GROUP_STATUS_DISABLED,
|
||||
SOURCE_GROUP_STATUS_UNKNOWN
|
||||
};
|
||||
|
||||
std::string sourceGroupStatusTypeToString(SourceGroupStatusType v);
|
||||
SourceGroupStatusType stringToSourceGroupStatusType(std::string v);
|
||||
|
||||
#endif // SOURCE_GROUP_STATUS_TYPE_H
|
||||
Reference in New Issue
Block a user