src: Refactored SourceGroupSettings into components as bases architecture

This commit is contained in:
Eberhard Graether
2019-10-18 13:05:27 +02:00
parent 941e5dbcaa
commit bd09cc4feb
105 changed files with 1610 additions and 1827 deletions
+59 -50
View File
@@ -341,59 +341,68 @@ add_files(
settings/migration/SettingsMigrationMoveKey.h settings/migration/SettingsMigrationMoveKey.h
settings/migration/SettingsMigrator.h settings/migration/SettingsMigrator.h
settings/source_group/component/java/SourceGroupSettingsWithClasspath.cpp
settings/source_group/component/java/SourceGroupSettingsWithClasspath.h
settings/source_group/component/java/SourceGroupSettingsWithJavaGradle.cpp
settings/source_group/component/java/SourceGroupSettingsWithJavaGradle.h
settings/source_group/component/java/SourceGroupSettingsWithJavaMaven.cpp
settings/source_group/component/java/SourceGroupSettingsWithJavaMaven.h
settings/source_group/component/java/SourceGroupSettingsWithJavaStandard.cpp
settings/source_group/component/java/SourceGroupSettingsWithJavaStandard.h
settings/source_group/component/java/SourceGroupSettingsWithSourceExtensionsJava.h
settings/source_group/component/cxx/SourceGroupSettingsWithCppStandard.cpp
settings/source_group/component/cxx/SourceGroupSettingsWithCppStandard.h
settings/source_group/component/cxx/SourceGroupSettingsWithCStandard.cpp
settings/source_group/component/cxx/SourceGroupSettingsWithCStandard.h
settings/source_group/component/cxx/SourceGroupSettingsWithCxxCdbPath.cpp
settings/source_group/component/cxx/SourceGroupSettingsWithCxxCdbPath.h
settings/source_group/component/cxx/SourceGroupSettingsWithCxxCodeblocksPath.cpp
settings/source_group/component/cxx/SourceGroupSettingsWithCxxCodeblocksPath.h
settings/source_group/component/cxx/SourceGroupSettingsWithCxxCrossCompilationOptions.cpp
settings/source_group/component/cxx/SourceGroupSettingsWithCxxCrossCompilationOptions.h
settings/source_group/component/cxx/SourceGroupSettingsWithCxxPathsAndFlags.cpp
settings/source_group/component/cxx/SourceGroupSettingsWithCxxPathsAndFlags.h
settings/source_group/component/cxx/SourceGroupSettingsWithCxxPchOptions.cpp
settings/source_group/component/cxx/SourceGroupSettingsWithCxxPchOptions.h
settings/source_group/component/cxx/SourceGroupSettingsWithIndexedHeaderPaths.cpp
settings/source_group/component/cxx/SourceGroupSettingsWithIndexedHeaderPaths.h
settings/source_group/component/cxx/SourceGroupSettingsWithSourceExtensionsC.h
settings/source_group/component/cxx/SourceGroupSettingsWithSourceExtensionsCpp.h
settings/source_group/component/python/SourceGroupSettingsWithPythonEnvironmentPath.cpp
settings/source_group/component/python/SourceGroupSettingsWithPythonEnvironmentPath.h
settings/source_group/component/python/SourceGroupSettingsWithSourceExtensionsPython.h
settings/source_group/component/SourceGroupSettingsWithCustomCommand.cpp
settings/source_group/component/SourceGroupSettingsWithCustomCommand.h
settings/source_group/component/SourceGroupSettingsWithExcludeFilters.cpp
settings/source_group/component/SourceGroupSettingsWithExcludeFilters.h
settings/source_group/component/SourceGroupSettingsWithSonargraphProjectPath.cpp
settings/source_group/component/SourceGroupSettingsWithSonargraphProjectPath.h
settings/source_group/component/SourceGroupSettingsWithSourceExtensions.cpp
settings/source_group/component/SourceGroupSettingsWithSourceExtensions.h
settings/source_group/component/SourceGroupSettingsWithSourceExtensionsEmpty.h
settings/source_group/component/SourceGroupSettingsWithSourcePaths.cpp
settings/source_group/component/SourceGroupSettingsWithSourcePaths.h
settings/source_group/type/SourceGroupSettingsCEmpty.h
settings/source_group/type/SourceGroupSettingsCppEmpty.h
settings/source_group/type/SourceGroupSettingsCustomCommand.h
settings/source_group/type/SourceGroupSettingsCxxCdb.h
settings/source_group/type/SourceGroupSettingsCxxCdbVs.h
settings/source_group/type/SourceGroupSettingsCxxCodeblocks.h
settings/source_group/type/SourceGroupSettingsCxxSonargraph.h
settings/source_group/type/SourceGroupSettingsJavaEmpty.h
settings/source_group/type/SourceGroupSettingsJavaGradle.h
settings/source_group/type/SourceGroupSettingsJavaMaven.h
settings/source_group/type/SourceGroupSettingsJavaSonargraph.h
settings/source_group/type/SourceGroupSettingsPythonEmpty.h
settings/source_group/SourceGroupSettings.cpp settings/source_group/SourceGroupSettings.cpp
settings/source_group/SourceGroupSettings.h settings/source_group/SourceGroupSettings.h
settings/source_group/SourceGroupSettingsBase.h settings/source_group/SourceGroupSettingsBase.h
settings/source_group/SourceGroupSettingsCxx.cpp settings/source_group/SourceGroupSettingsWithComponents.h
settings/source_group/SourceGroupSettingsCxx.h
settings/source_group/SourceGroupSettingsCEmpty.cpp
settings/source_group/SourceGroupSettingsCEmpty.h
settings/source_group/SourceGroupSettingsCppEmpty.cpp
settings/source_group/SourceGroupSettingsCppEmpty.h
settings/source_group/SourceGroupSettingsCustomCommand.cpp
settings/source_group/SourceGroupSettingsCustomCommand.h
settings/source_group/SourceGroupSettingsCxxCdb.cpp
settings/source_group/SourceGroupSettingsCxxCdb.h
settings/source_group/SourceGroupSettingsCxxCdbVs.cpp
settings/source_group/SourceGroupSettingsCxxCdbVs.h
settings/source_group/SourceGroupSettingsCxxCodeblocks.cpp
settings/source_group/SourceGroupSettingsCxxCodeblocks.h
settings/source_group/SourceGroupSettingsCxxSonargraph.cpp
settings/source_group/SourceGroupSettingsCxxSonargraph.h
settings/source_group/SourceGroupSettingsJava.cpp
settings/source_group/SourceGroupSettingsJava.h
settings/source_group/SourceGroupSettingsJavaEmpty.cpp
settings/source_group/SourceGroupSettingsJavaEmpty.h
settings/source_group/SourceGroupSettingsJavaGradle.cpp
settings/source_group/SourceGroupSettingsJavaGradle.h
settings/source_group/SourceGroupSettingsJavaMaven.cpp
settings/source_group/SourceGroupSettingsJavaMaven.h
settings/source_group/SourceGroupSettingsJavaSonargraph.cpp
settings/source_group/SourceGroupSettingsJavaSonargraph.h
settings/source_group/SourceGroupSettingsPythonEmpty.cpp
settings/source_group/SourceGroupSettingsPythonEmpty.h
settings/source_group/SourceGroupSettingsWithClasspath.cpp
settings/source_group/SourceGroupSettingsWithClasspath.h
settings/source_group/SourceGroupSettingsWithCppStandard.cpp
settings/source_group/SourceGroupSettingsWithCppStandard.h
settings/source_group/SourceGroupSettingsWithCStandard.cpp
settings/source_group/SourceGroupSettingsWithCStandard.h
settings/source_group/SourceGroupSettingsWithCxxCrossCompilationOptions.cpp
settings/source_group/SourceGroupSettingsWithCxxCrossCompilationOptions.h
settings/source_group/SourceGroupSettingsWithExcludeFilters.cpp
settings/source_group/SourceGroupSettingsWithExcludeFilters.h
settings/source_group/SourceGroupSettingsWithIndexedHeaderPaths.cpp
settings/source_group/SourceGroupSettingsWithIndexedHeaderPaths.h
settings/source_group/SourceGroupSettingsWithJavaStandard.cpp
settings/source_group/SourceGroupSettingsWithJavaStandard.h
settings/source_group/SourceGroupSettingsWithCxxPchOptions.cpp
settings/source_group/SourceGroupSettingsWithCxxPchOptions.h
settings/source_group/SourceGroupSettingsWithSonargraphProjectPath.cpp
settings/source_group/SourceGroupSettingsWithSonargraphProjectPath.h
settings/source_group/SourceGroupSettingsWithSourceExtensions.cpp
settings/source_group/SourceGroupSettingsWithSourceExtensions.h
settings/source_group/SourceGroupSettingsWithSourcePaths.cpp
settings/source_group/SourceGroupSettingsWithSourcePaths.h
settings/source_group/SourceGroupStatusType.cpp settings/source_group/SourceGroupStatusType.cpp
settings/source_group/SourceGroupStatusType.h settings/source_group/SourceGroupStatusType.h
settings/source_group/SourceGroupType.cpp settings/source_group/SourceGroupType.cpp
+3 -3
View File
@@ -78,7 +78,7 @@ bool ProjectSettings::equalsExceptNameAndLocation(const ProjectSettings& other)
bool matched = false; bool matched = false;
for (const std::shared_ptr<SourceGroupSettings>& otherSourceGroup : allOtherSettings) for (const std::shared_ptr<SourceGroupSettings>& otherSourceGroup : allOtherSettings)
{ {
if (mySourceGroup->equals(otherSourceGroup)) if (mySourceGroup->equalsSettings(otherSourceGroup.get()))
{ {
matched = true; matched = true;
break; break;
@@ -215,7 +215,7 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
if (settings) if (settings)
{ {
settings->load(m_config); settings->loadSettings(m_config.get());
allSettings.push_back(settings); allSettings.push_back(settings);
} }
else else
@@ -240,7 +240,7 @@ void ProjectSettings::setAllSourceGroupSettings(const std::vector<std::shared_pt
const SourceGroupType type = settings->getType(); const SourceGroupType type = settings->getType();
setValue(key + "/type", sourceGroupTypeToString(type)); setValue(key + "/type", sourceGroupTypeToString(type));
settings->save(m_config); settings->saveSettings(m_config.get());
} }
} }
@@ -8,47 +8,46 @@ const size_t SourceGroupSettings::s_version = 1;
const std::string SourceGroupSettings::s_keyPrefix = "source_groups/source_group_"; const std::string SourceGroupSettings::s_keyPrefix = "source_groups/source_group_";
SourceGroupSettings::SourceGroupSettings( SourceGroupSettings::SourceGroupSettings(
const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings SourceGroupType type, const std::string& id, const ProjectSettings* projectSettings
) )
: m_projectSettings(projectSettings) : m_projectSettings(projectSettings)
, m_type(type)
, m_id(id) , m_id(id)
, m_name(sourceGroupTypeToString(type)) , m_name(sourceGroupTypeToString(type))
, m_type(type)
, m_status(SOURCE_GROUP_STATUS_ENABLED) , m_status(SOURCE_GROUP_STATUS_ENABLED)
{ {
} }
void SourceGroupSettings::load(std::shared_ptr<const ConfigManager> config) bool SourceGroupSettings::equals(const SourceGroupSettingsBase* other) const
{ {
const std::string key = s_keyPrefix + getId(); const SourceGroupSettings* otherPtr = dynamic_cast<const SourceGroupSettings*>(other);
return (
m_id == otherPtr->m_id &&
// m_name == otherPtr->m_name && // Ignore name, since not significant regarding index state
m_type == otherPtr->m_type &&
m_status == otherPtr->m_status
);
}
void SourceGroupSettings::load(const ConfigManager* config, const std::string& key)
{
const std::string name = config->getValueOrDefault<std::string>(key + "/name", ""); const std::string name = config->getValueOrDefault<std::string>(key + "/name", "");
if (!name.empty()) if (!name.empty())
{ {
setName(name); setName(name);
} }
setStatus(stringToSourceGroupStatusType(config->getValueOrDefault(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED)))); setStatus(stringToSourceGroupStatusType(
config->getValueOrDefault(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED))));
} }
void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config) void SourceGroupSettings::save(ConfigManager* config, const std::string& key)
{ {
const std::string key = s_keyPrefix + getId();
config->setValue(key + "/status", sourceGroupStatusTypeToString(getStatus())); config->setValue(key + "/status", sourceGroupStatusTypeToString(getStatus()));
config->setValue(key + "/name", getName()); config->setValue(key + "/name", getName());
} }
bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) const
{
return (
m_id == other->m_id &&
// m_name == other->m_name && // Ignore name, since not significant regarding index state
m_type == other->m_type &&
m_status == other->m_status
);
}
std::string SourceGroupSettings::getId() const std::string SourceGroupSettings::getId() const
{ {
return m_id; return m_id;
@@ -19,15 +19,18 @@ public:
static const size_t s_version; static const size_t s_version;
static const std::string s_keyPrefix; static const std::string s_keyPrefix;
SourceGroupSettings(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings); SourceGroupSettings(SourceGroupType type, const std::string& id, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettings() = default; virtual ~SourceGroupSettings() = default;
virtual std::shared_ptr<SourceGroupSettings> createCopy() const = 0; virtual std::shared_ptr<SourceGroupSettings> createCopy() const = 0;
virtual void load(std::shared_ptr<const ConfigManager> config); virtual void loadSettings(const ConfigManager* config) = 0;
virtual void save(std::shared_ptr<ConfigManager> config); virtual void saveSettings(ConfigManager* config) = 0;
virtual bool equalsSettings(const SourceGroupSettingsBase* other) = 0;
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const; bool equals(const SourceGroupSettingsBase* other) const;
void load(const ConfigManager* config, const std::string& key);
void save(ConfigManager* config, const std::string& key);
std::string getId() const; std::string getId() const;
void setId(const std::string& id); void setId(const std::string& id);
@@ -51,9 +54,9 @@ protected:
const ProjectSettings* m_projectSettings; const ProjectSettings* m_projectSettings;
private: private:
const SourceGroupType m_type;
std::string m_id; std::string m_id;
std::string m_name; std::string m_name;
const SourceGroupType m_type;
SourceGroupStatusType m_status; SourceGroupStatusType m_status;
}; };
@@ -1,60 +0,0 @@
#include "SourceGroupSettingsCEmpty.h"
SourceGroupSettingsCEmpty::SourceGroupSettingsCEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxx(id, SOURCE_GROUP_C_EMPTY, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsCEmpty::createCopy() const
{
return std::make_shared<SourceGroupSettingsCEmpty>(*this);
}
void SourceGroupSettingsCEmpty::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCStandard::load(config, key);
SourceGroupSettingsWithCxxCrossCompilationOptions::load(config, key);
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithCxxPchOptions::load(config, key);
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
}
void SourceGroupSettingsCEmpty::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCStandard::save(config, key);
SourceGroupSettingsWithCxxCrossCompilationOptions::save(config, key);
SourceGroupSettingsWithSourceExtensions::save(config, key);
SourceGroupSettingsWithCxxPchOptions::save(config, key);
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
}
bool SourceGroupSettingsCEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCEmpty> otherCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCEmpty>(other);
return (
otherCxxEmpty &&
SourceGroupSettingsCxx::equals(other) &&
SourceGroupSettingsWithCStandard::equals(otherCxxEmpty) &&
SourceGroupSettingsWithCxxCrossCompilationOptions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourceExtensions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithCxxPchOptions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourcePaths::equals(otherCxxEmpty) &&
SourceGroupSettingsWithExcludeFilters::equals(otherCxxEmpty)
);
}
std::vector<std::wstring> SourceGroupSettingsCEmpty::getDefaultSourceExtensions() const
{
return { L".c" };
}
@@ -1,35 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_C_EMPTY_H
#define SOURCE_GROUP_SETTINGS_C_EMPTY_H
#include "SourceGroupSettingsCxx.h"
#include "SourceGroupSettingsWithCStandard.h"
#include "SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithCxxPchOptions.h"
#include "SourceGroupSettingsWithSourceExtensions.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsCEmpty
: public SourceGroupSettingsCxx
, public SourceGroupSettingsWithCStandard
, public SourceGroupSettingsWithCxxCrossCompilationOptions
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithCxxPchOptions
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithSourcePaths
{
public:
SourceGroupSettingsCEmpty(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override;
};
#endif // SOURCE_GROUP_SETTINGS_C_EMPTY_H
@@ -1,64 +0,0 @@
#include "SourceGroupSettingsCppEmpty.h"
SourceGroupSettingsCppEmpty::SourceGroupSettingsCppEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxx(id, SOURCE_GROUP_CPP_EMPTY, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsCppEmpty::createCopy() const
{
return std::make_shared<SourceGroupSettingsCppEmpty>(*this);
}
void SourceGroupSettingsCppEmpty::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCppStandard::load(config, key);
SourceGroupSettingsWithCxxCrossCompilationOptions::load(config, key);
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithCxxPchOptions::load(config, key);
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
}
void SourceGroupSettingsCppEmpty::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCppStandard::save(config, key);
SourceGroupSettingsWithCxxCrossCompilationOptions::save(config, key);
SourceGroupSettingsWithSourceExtensions::save(config, key);
SourceGroupSettingsWithCxxPchOptions::save(config, key);
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
}
bool SourceGroupSettingsCppEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCppEmpty> otherCxxEmpty = std::dynamic_pointer_cast<SourceGroupSettingsCppEmpty>(other);
return (
otherCxxEmpty &&
SourceGroupSettingsCxx::equals(other) &&
SourceGroupSettingsWithCppStandard::equals(otherCxxEmpty) &&
SourceGroupSettingsWithCxxCrossCompilationOptions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourceExtensions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithCxxPchOptions::equals(otherCxxEmpty) &&
SourceGroupSettingsWithSourcePaths::equals(otherCxxEmpty) &&
SourceGroupSettingsWithExcludeFilters::equals(otherCxxEmpty)
);
}
std::vector<std::wstring> SourceGroupSettingsCppEmpty::getDefaultSourceExtensions() const
{
return {
L".cpp",
L".cxx",
L".cc"
};
}
@@ -1,35 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
#define SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
#include "SourceGroupSettingsCxx.h"
#include "SourceGroupSettingsWithCppStandard.h"
#include "SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithCxxPchOptions.h"
#include "SourceGroupSettingsWithSourceExtensions.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsCppEmpty
: public SourceGroupSettingsCxx
, public SourceGroupSettingsWithCppStandard
, public SourceGroupSettingsWithCxxCrossCompilationOptions
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithCxxPchOptions
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithSourcePaths
{
public:
SourceGroupSettingsCppEmpty(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override;
};
#endif // SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
@@ -1,85 +0,0 @@
#include "SourceGroupSettingsCustomCommand.h"
#include "ConfigManager.h"
#include "FilePath.h"
SourceGroupSettingsCustomCommand::SourceGroupSettingsCustomCommand(
const std::string& id, const ProjectSettings* projectSettings
)
: SourceGroupSettings(id, SOURCE_GROUP_CUSTOM_COMMAND, projectSettings)
, m_runInParallel(false)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsCustomCommand::createCopy() const
{
return std::make_shared<SourceGroupSettingsCustomCommand>(*this);
}
void SourceGroupSettingsCustomCommand::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
setCustomCommand(config->getValueOrDefault(key + "/custom_command", std::wstring()));
setRunInParallel(config->getValueOrDefault(key + "/run_in_parallel", false));
}
void SourceGroupSettingsCustomCommand::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettings::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourceExtensions::save(config, key);
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
config->setValue(key + "/custom_command", getCustomCommand());
config->setValue(key + "/run_in_parallel", getRunInParallel());
}
bool SourceGroupSettingsCustomCommand::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCustomCommand> otherCustom =
std::dynamic_pointer_cast<SourceGroupSettingsCustomCommand>(other);
return (
otherCustom &&
SourceGroupSettings::equals(other) &&
SourceGroupSettingsWithSourceExtensions::equals(otherCustom) &&
SourceGroupSettingsWithSourcePaths::equals(otherCustom) &&
SourceGroupSettingsWithExcludeFilters::equals(otherCustom) &&
m_customCommand == otherCustom->m_customCommand
);
}
const std::wstring& SourceGroupSettingsCustomCommand::getCustomCommand() const
{
return m_customCommand;
}
void SourceGroupSettingsCustomCommand::setCustomCommand(const std::wstring& customCommand)
{
m_customCommand = customCommand;
}
bool SourceGroupSettingsCustomCommand::getRunInParallel() const
{
return m_runInParallel;
}
void SourceGroupSettingsCustomCommand::setRunInParallel(bool runInParallel)
{
m_runInParallel = runInParallel;
}
std::vector<std::wstring> SourceGroupSettingsCustomCommand::getDefaultSourceExtensions() const
{
return {};
}
@@ -1,38 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
#define SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
#include "SourceGroupSettings.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithSourceExtensions.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsCustomCommand
: public SourceGroupSettings
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithSourcePaths
{
public:
SourceGroupSettingsCustomCommand(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
const std::wstring& getCustomCommand() const;
void setCustomCommand(const std::wstring& customCommand);
bool getRunInParallel() const;
void setRunInParallel(bool runInParallel);
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override;
std::wstring m_customCommand;
bool m_runInParallel;
};
#endif // SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
@@ -1,88 +0,0 @@
#include "SourceGroupSettingsCxx.h"
#include "ProjectSettings.h"
#include "ConfigManager.h"
#include "utility.h"
SourceGroupSettingsCxx::SourceGroupSettingsCxx(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings)
: SourceGroupSettings(id, type, projectSettings)
, m_headerSearchPaths(std::vector<FilePath>())
, m_frameworkSearchPaths(std::vector<FilePath>())
, m_compilerFlags(std::vector<std::wstring>())
{
}
void SourceGroupSettingsCxx::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
setHeaderSearchPaths(config->getValuesOrDefaults(key + "/header_search_paths/header_search_path", std::vector<FilePath>()));
setFrameworkSearchPaths(config->getValuesOrDefaults(key + "/framework_search_paths/framework_search_path", std::vector<FilePath>()));
setCompilerFlags(config->getValuesOrDefaults(key + "/compiler_flags/compiler_flag", std::vector<std::wstring>()));
}
void SourceGroupSettingsCxx::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettings::save(config);
const std::string key = s_keyPrefix + getId();
config->setValues(key + "/header_search_paths/header_search_path", getHeaderSearchPaths());
config->setValues(key + "/framework_search_paths/framework_search_path", getFrameworkSearchPaths());
config->setValues(key + "/compiler_flags/compiler_flag", getCompilerFlags());
}
bool SourceGroupSettingsCxx::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCxx> otherCxx = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(other);
return (
otherCxx &&
SourceGroupSettings::equals(other) &&
utility::isPermutation(m_headerSearchPaths, otherCxx->m_headerSearchPaths) &&
utility::isPermutation(m_frameworkSearchPaths, otherCxx->m_frameworkSearchPaths) &&
utility::isPermutation(m_compilerFlags, otherCxx->m_compilerFlags)
);
}
std::vector<FilePath> SourceGroupSettingsCxx::getHeaderSearchPaths() const
{
return m_headerSearchPaths;
}
std::vector<FilePath> SourceGroupSettingsCxx::getHeaderSearchPathsExpandedAndAbsolute() const
{
return m_projectSettings->makePathsExpandedAndAbsolute(getHeaderSearchPaths());
}
void SourceGroupSettingsCxx::setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths)
{
m_headerSearchPaths = headerSearchPaths;
}
std::vector<FilePath> SourceGroupSettingsCxx::getFrameworkSearchPaths() const
{
return m_frameworkSearchPaths;
}
std::vector<FilePath> SourceGroupSettingsCxx::getFrameworkSearchPathsExpandedAndAbsolute() const
{
return m_projectSettings->makePathsExpandedAndAbsolute(getFrameworkSearchPaths());
}
void SourceGroupSettingsCxx::setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths)
{
m_frameworkSearchPaths = frameworkSearchPaths;
}
std::vector<std::wstring> SourceGroupSettingsCxx::getCompilerFlags() const
{
return m_compilerFlags;
}
void SourceGroupSettingsCxx::setCompilerFlags(const std::vector<std::wstring>& compilerFlags)
{
m_compilerFlags = compilerFlags;
}
@@ -1,71 +0,0 @@
#include "SourceGroupSettingsCxxCdb.h"
#include "ConfigManager.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
SourceGroupSettingsCxxCdb::SourceGroupSettingsCxxCdb(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxx(id, SOURCE_GROUP_CXX_CDB, projectSettings)
, m_compilationDatabasePath(FilePath())
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsCxxCdb::createCopy() const
{
return std::make_shared<SourceGroupSettingsCxxCdb>(*this);
}
void SourceGroupSettingsCxxCdb::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCxxPchOptions::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
SourceGroupSettingsWithIndexedHeaderPaths::load(config, key);
setCompilationDatabasePath(config->getValueOrDefault(key + "/build_file_path/compilation_db_path", FilePath(L"")));
}
void SourceGroupSettingsCxxCdb::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCxxPchOptions::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
SourceGroupSettingsWithIndexedHeaderPaths::save(config, key);
config->setValue(key + "/build_file_path/compilation_db_path", getCompilationDatabasePath().wstr());
}
bool SourceGroupSettingsCxxCdb::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCxxCdb> otherCxxCdb = std::dynamic_pointer_cast<SourceGroupSettingsCxxCdb>(other);
return (
otherCxxCdb &&
SourceGroupSettingsCxx::equals(other) &&
SourceGroupSettingsWithCxxPchOptions::equals(otherCxxCdb) &&
SourceGroupSettingsWithExcludeFilters::equals(otherCxxCdb) &&
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxCdb) &&
m_compilationDatabasePath == otherCxxCdb->m_compilationDatabasePath
);
}
FilePath SourceGroupSettingsCxxCdb::getCompilationDatabasePath() const
{
return m_compilationDatabasePath;
}
FilePath SourceGroupSettingsCxxCdb::getCompilationDatabasePathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getCompilationDatabasePath(), m_projectSettings->getProjectDirectoryPath());
}
void SourceGroupSettingsCxxCdb::setCompilationDatabasePath(const FilePath& compilationDatabasePath)
{
m_compilationDatabasePath = compilationDatabasePath;
}
@@ -1,34 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_CDB_H
#define SOURCE_GROUP_SETTINGS_CXX_CDB_H
#include "SourceGroupSettingsCxx.h"
#include "SourceGroupSettingsWithCxxPchOptions.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "FilePath.h"
class SourceGroupSettingsCxxCdb
: public SourceGroupSettingsCxx
, public SourceGroupSettingsWithCxxPchOptions
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithIndexedHeaderPaths
{
public:
SourceGroupSettingsCxxCdb(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
FilePath getCompilationDatabasePath() const;
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
private:
FilePath m_compilationDatabasePath;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_CDB_H
@@ -1,11 +0,0 @@
#include "SourceGroupSettingsCxxCdbVs.h"
SourceGroupSettingsCxxCdbVs::SourceGroupSettingsCxxCdbVs(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxxCdb(id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsCxxCdbVs::createCopy() const
{
return std::make_shared<SourceGroupSettingsCxxCdbVs>(*this);
}
@@ -1,86 +0,0 @@
#include "SourceGroupSettingsCxxCodeblocks.h"
#include "ConfigManager.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
SourceGroupSettingsCxxCodeblocks::SourceGroupSettingsCxxCodeblocks(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxx(id, SOURCE_GROUP_CXX_CODEBLOCKS, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsCxxCodeblocks::createCopy() const
{
return std::make_shared<SourceGroupSettingsCxxCodeblocks>(*this);
}
void SourceGroupSettingsCxxCodeblocks::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCppStandard::load(config, key);
SourceGroupSettingsWithCStandard::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
SourceGroupSettingsWithIndexedHeaderPaths::load(config, key);
SourceGroupSettingsWithSourceExtensions::load(config, key);
setCodeblocksProjectPath(config->getValueOrDefault(key + "/codeblocks_project_path", FilePath(L"")));
}
void SourceGroupSettingsCxxCodeblocks::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCppStandard::save(config, key);
SourceGroupSettingsWithCStandard::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
SourceGroupSettingsWithIndexedHeaderPaths::save(config, key);
SourceGroupSettingsWithSourceExtensions::save(config, key);
config->setValue(key + "/codeblocks_project_path", getCodeblocksProjectPath().wstr());
}
bool SourceGroupSettingsCxxCodeblocks::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCxxCodeblocks> otherCxxCodeblocks = std::dynamic_pointer_cast<SourceGroupSettingsCxxCodeblocks>(other);
return (
otherCxxCodeblocks &&
SourceGroupSettingsCxx::equals(other) &&
SourceGroupSettingsWithCppStandard::equals(otherCxxCodeblocks) &&
SourceGroupSettingsWithCStandard::equals(otherCxxCodeblocks) &&
SourceGroupSettingsWithExcludeFilters::equals(otherCxxCodeblocks) &&
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxCodeblocks) &&
SourceGroupSettingsWithSourceExtensions::equals(otherCxxCodeblocks) &&
m_codeblocksProjectPath == otherCxxCodeblocks->m_codeblocksProjectPath
);
}
FilePath SourceGroupSettingsCxxCodeblocks::getCodeblocksProjectPath() const
{
return m_codeblocksProjectPath;
}
FilePath SourceGroupSettingsCxxCodeblocks::getCodeblocksProjectPathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getCodeblocksProjectPath(), m_projectSettings->getProjectDirectoryPath());
}
void SourceGroupSettingsCxxCodeblocks::setCodeblocksProjectPath(const FilePath& compilationDatabasePath)
{
m_codeblocksProjectPath = compilationDatabasePath;
}
std::vector<std::wstring> SourceGroupSettingsCxxCodeblocks::getDefaultSourceExtensions() const
{
return {
L".c",
L".cpp",
L".cxx",
L".cc"
};
}
@@ -1,39 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
#define SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
#include "SourceGroupSettingsCxx.h"
#include "SourceGroupSettingsWithCppStandard.h"
#include "SourceGroupSettingsWithCStandard.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "SourceGroupSettingsWithSourceExtensions.h"
class SourceGroupSettingsCxxCodeblocks
: public SourceGroupSettingsCxx
, public SourceGroupSettingsWithCppStandard
, public SourceGroupSettingsWithCStandard
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithIndexedHeaderPaths
, public SourceGroupSettingsWithSourceExtensions
{
public:
SourceGroupSettingsCxxCodeblocks(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
FilePath getCodeblocksProjectPath() const;
FilePath getCodeblocksProjectPathExpandedAndAbsolute() const;
void setCodeblocksProjectPath(const FilePath& compilationDatabasePath);
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override;
FilePath m_codeblocksProjectPath;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
@@ -1,46 +0,0 @@
#include "SourceGroupSettingsCxxSonargraph.h"
SourceGroupSettingsCxxSonargraph::SourceGroupSettingsCxxSonargraph(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsCxx(id, SOURCE_GROUP_CXX_SONARGRAPH, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsCxxSonargraph::createCopy() const
{
return std::make_shared<SourceGroupSettingsCxxSonargraph>(*this);
}
void SourceGroupSettingsCxxSonargraph::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsCxx::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCppStandard::load(config, key);
SourceGroupSettingsWithIndexedHeaderPaths::load(config, key);
SourceGroupSettingsWithSonargraphProjectPath::load(config, key);
}
void SourceGroupSettingsCxxSonargraph::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsCxx::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithCppStandard::save(config, key);
SourceGroupSettingsWithIndexedHeaderPaths::save(config, key);
SourceGroupSettingsWithSonargraphProjectPath::save(config, key);
}
bool SourceGroupSettingsCxxSonargraph::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsCxxSonargraph> otherCxxSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsCxxSonargraph>(other);
return (
otherCxxSonargraph &&
SourceGroupSettingsCxx::equals(other) &&
SourceGroupSettingsWithCppStandard::equals(otherCxxSonargraph) &&
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxSonargraph) &&
SourceGroupSettingsWithSonargraphProjectPath::equals(otherCxxSonargraph)
);
}
@@ -1,26 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
#define SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
#include "SourceGroupSettingsCxx.h"
#include "SourceGroupSettingsWithCppStandard.h"
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "SourceGroupSettingsWithSonargraphProjectPath.h"
class SourceGroupSettingsCxxSonargraph
: public SourceGroupSettingsCxx
, public SourceGroupSettingsWithCppStandard
, public SourceGroupSettingsWithIndexedHeaderPaths
, public SourceGroupSettingsWithSonargraphProjectPath
{
public:
SourceGroupSettingsCxxSonargraph(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
@@ -1,46 +0,0 @@
#include "SourceGroupSettingsJava.h"
SourceGroupSettingsJava::SourceGroupSettingsJava(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings)
: SourceGroupSettings(id, type, projectSettings)
{
}
void SourceGroupSettingsJava::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourceExtensions::load(config, key);
SourceGroupSettingsWithExcludeFilters::load(config, key);
SourceGroupSettingsWithJavaStandard::load(config, key);
}
void SourceGroupSettingsJava::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettings::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourceExtensions::save(config, key);
SourceGroupSettingsWithExcludeFilters::save(config, key);
SourceGroupSettingsWithJavaStandard::save(config, key);
}
bool SourceGroupSettingsJava::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJava> otherJava = std::dynamic_pointer_cast<SourceGroupSettingsJava>(other);
return (
otherJava &&
SourceGroupSettings::equals(other) &&
SourceGroupSettingsWithSourceExtensions::equals(otherJava) &&
SourceGroupSettingsWithExcludeFilters::equals(otherJava) &&
SourceGroupSettingsWithJavaStandard::equals(otherJava)
);
}
std::vector<std::wstring> SourceGroupSettingsJava::getDefaultSourceExtensions() const
{
return { L".java" };
}
@@ -1,30 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_H
#define SOURCE_GROUP_SETTINGS_JAVA_H
#include <memory>
#include <vector>
#include "SourceGroupSettings.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithJavaStandard.h"
#include "SourceGroupSettingsWithSourceExtensions.h"
class SourceGroupSettingsJava
: public SourceGroupSettings
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithJavaStandard
{
public:
SourceGroupSettingsJava(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override;
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_H
@@ -1,43 +0,0 @@
#include "SourceGroupSettingsJavaEmpty.h"
SourceGroupSettingsJavaEmpty::SourceGroupSettingsJavaEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsJava(id, SOURCE_GROUP_JAVA_EMPTY, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsJavaEmpty::createCopy() const
{
return std::make_shared<SourceGroupSettingsJavaEmpty>(*this);
}
void SourceGroupSettingsJavaEmpty::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsJava::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithClasspath::load(config, key);
}
void SourceGroupSettingsJavaEmpty::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsJava::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithClasspath::save(config, key);
}
bool SourceGroupSettingsJavaEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJavaEmpty> otherJava = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(other);
return (
otherJava &&
SourceGroupSettingsJava::equals(other) &&
SourceGroupSettingsWithSourcePaths::equals(otherJava) &&
SourceGroupSettingsWithClasspath::equals(otherJava)
);
}
@@ -1,24 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
#define SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
#include "SourceGroupSettingsJava.h"
#include "SourceGroupSettingsWithClasspath.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsJavaEmpty
: public SourceGroupSettingsJava
, public SourceGroupSettingsWithSourcePaths
, public SourceGroupSettingsWithClasspath
{
public:
SourceGroupSettingsJavaEmpty(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
@@ -1,79 +0,0 @@
#include "SourceGroupSettingsJavaGradle.h"
#include "ConfigManager.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
SourceGroupSettingsJavaGradle::SourceGroupSettingsJavaGradle(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsJava(id, SOURCE_GROUP_JAVA_GRADLE, projectSettings)
, m_gradleProjectFilePath(FilePath())
, m_shouldIndexGradleTests(false)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsJavaGradle::createCopy() const
{
return std::make_shared<SourceGroupSettingsJavaGradle>(*this);
}
void SourceGroupSettingsJavaGradle::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsJava::load(config);
const std::string key = s_keyPrefix + getId();
setGradleProjectFilePath(config->getValueOrDefault(key + "/gradle/project_file_path", FilePath(L"")));
setShouldIndexGradleTests(config->getValueOrDefault(key + "/gradle/should_index_tests", false));
}
void SourceGroupSettingsJavaGradle::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsJava::save(config);
const std::string key = s_keyPrefix + getId();
config->setValue(key + "/gradle/project_file_path", getGradleProjectFilePath().wstr());
config->setValue(key + "/gradle/should_index_tests", getShouldIndexGradleTests());
}
bool SourceGroupSettingsJavaGradle::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJavaGradle> otherJavaGradle = std::dynamic_pointer_cast<SourceGroupSettingsJavaGradle>(other);
return (
otherJavaGradle &&
SourceGroupSettingsJava::equals(other) &&
m_gradleProjectFilePath == otherJavaGradle->m_gradleProjectFilePath &&
m_shouldIndexGradleTests == otherJavaGradle->m_shouldIndexGradleTests
);
}
FilePath SourceGroupSettingsJavaGradle::getGradleDependenciesDirectoryPath() const
{
return getSourceGroupDependenciesDirectoryPath().concatenate(L"gradle");
}
FilePath SourceGroupSettingsJavaGradle::getGradleProjectFilePath() const
{
return m_gradleProjectFilePath;
}
FilePath SourceGroupSettingsJavaGradle::getGradleProjectFilePathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getGradleProjectFilePath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsJavaGradle::setGradleProjectFilePath(const FilePath& path)
{
m_gradleProjectFilePath = path;
}
bool SourceGroupSettingsJavaGradle::getShouldIndexGradleTests() const
{
return m_shouldIndexGradleTests;
}
void SourceGroupSettingsJavaGradle::setShouldIndexGradleTests(bool value)
{
m_shouldIndexGradleTests = value;
}
@@ -1,34 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
#define SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
#include "SourceGroupSettingsJava.h"
#include "FilePath.h"
class SourceGroupSettingsJavaGradle
: public SourceGroupSettingsJava
{
public:
SourceGroupSettingsJavaGradle(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
FilePath getGradleDependenciesDirectoryPath() const;
FilePath getGradleProjectFilePath() const;
FilePath getGradleProjectFilePathExpandedAndAbsolute() const;
void setGradleProjectFilePath(const FilePath& path);
bool getShouldIndexGradleTests() const;
void setShouldIndexGradleTests(bool value);
private:
FilePath m_gradleProjectFilePath;
bool m_shouldIndexGradleTests;
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
@@ -1,79 +0,0 @@
#include "SourceGroupSettingsJavaMaven.h"
#include "ConfigManager.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
SourceGroupSettingsJavaMaven::SourceGroupSettingsJavaMaven(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsJava(id, SOURCE_GROUP_JAVA_MAVEN, projectSettings)
, m_mavenProjectFilePath(FilePath())
, m_shouldIndexMavenTests(false)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsJavaMaven::createCopy() const
{
return std::make_shared<SourceGroupSettingsJavaMaven>(*this);
}
void SourceGroupSettingsJavaMaven::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettingsJava::load(config);
const std::string key = s_keyPrefix + getId();
setMavenProjectFilePath(config->getValueOrDefault(key + "/maven/project_file_path", FilePath(L"")));
setShouldIndexMavenTests(config->getValueOrDefault(key + "/maven/should_index_tests", false));
}
void SourceGroupSettingsJavaMaven::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettingsJava::save(config);
const std::string key = s_keyPrefix + getId();
config->setValue(key + "/maven/project_file_path", getMavenProjectFilePath().wstr());
config->setValue(key + "/maven/should_index_tests", getShouldIndexMavenTests());
}
bool SourceGroupSettingsJavaMaven::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJavaMaven> otherJavaMaven = std::dynamic_pointer_cast<SourceGroupSettingsJavaMaven>(other);
return (
otherJavaMaven &&
SourceGroupSettingsJava::equals(other) &&
m_mavenProjectFilePath == otherJavaMaven->m_mavenProjectFilePath &&
m_shouldIndexMavenTests == otherJavaMaven->m_shouldIndexMavenTests
);
}
FilePath SourceGroupSettingsJavaMaven::getMavenDependenciesDirectoryPath() const
{
return getSourceGroupDependenciesDirectoryPath().concatenate(L"maven");
}
FilePath SourceGroupSettingsJavaMaven::getMavenProjectFilePath() const
{
return m_mavenProjectFilePath;
}
FilePath SourceGroupSettingsJavaMaven::getMavenProjectFilePathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getMavenProjectFilePath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsJavaMaven::setMavenProjectFilePath(const FilePath& path)
{
m_mavenProjectFilePath = path;
}
bool SourceGroupSettingsJavaMaven::getShouldIndexMavenTests() const
{
return m_shouldIndexMavenTests;
}
void SourceGroupSettingsJavaMaven::setShouldIndexMavenTests(bool value)
{
m_shouldIndexMavenTests = value;
}
@@ -1,34 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
#define SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
#include "SourceGroupSettingsJava.h"
#include "FilePath.h"
class SourceGroupSettingsJavaMaven
: public SourceGroupSettingsJava
{
public:
SourceGroupSettingsJavaMaven(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
FilePath getMavenDependenciesDirectoryPath() const;
FilePath getMavenProjectFilePath() const;
FilePath getMavenProjectFilePathExpandedAndAbsolute() const;
void setMavenProjectFilePath(const FilePath& path);
bool getShouldIndexMavenTests() const;
void setShouldIndexMavenTests(bool value);
private:
FilePath m_mavenProjectFilePath;
bool m_shouldIndexMavenTests;
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
@@ -1,46 +0,0 @@
#include "SourceGroupSettingsJavaSonargraph.h"
SourceGroupSettingsJavaSonargraph::SourceGroupSettingsJavaSonargraph(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettings(id, SOURCE_GROUP_JAVA_SONARGRAPH, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsJavaSonargraph::createCopy() const
{
return std::make_shared<SourceGroupSettingsJavaSonargraph>(*this);
}
void SourceGroupSettingsJavaSonargraph::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithClasspath::load(config, key);
SourceGroupSettingsWithJavaStandard::load(config, key);
SourceGroupSettingsWithSonargraphProjectPath::load(config, key);
}
void SourceGroupSettingsJavaSonargraph::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettings::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithClasspath::save(config, key);
SourceGroupSettingsWithJavaStandard::save(config, key);
SourceGroupSettingsWithSonargraphProjectPath::save(config, key);
}
bool SourceGroupSettingsJavaSonargraph::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsJavaSonargraph> otherJavaSonargraph = std::dynamic_pointer_cast<SourceGroupSettingsJavaSonargraph>(other);
return (
otherJavaSonargraph &&
SourceGroupSettings::equals(other) &&
SourceGroupSettingsWithClasspath::equals(otherJavaSonargraph) &&
SourceGroupSettingsWithJavaStandard::equals(otherJavaSonargraph) &&
SourceGroupSettingsWithSonargraphProjectPath::equals(otherJavaSonargraph)
);
}
@@ -1,77 +0,0 @@
#include "SourceGroupSettingsPythonEmpty.h"
#include "FilePath.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
SourceGroupSettingsPythonEmpty::SourceGroupSettingsPythonEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettings(id, SOURCE_GROUP_PYTHON_EMPTY, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> SourceGroupSettingsPythonEmpty::createCopy() const
{
return std::make_shared<SourceGroupSettingsPythonEmpty>(*this);
}
void SourceGroupSettingsPythonEmpty::load(std::shared_ptr<const ConfigManager> config)
{
SourceGroupSettings::load(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithExcludeFilters::load(config, key);
SourceGroupSettingsWithSourcePaths::load(config, key);
SourceGroupSettingsWithSourceExtensions::load(config, key);
setEnvironmentPath(config->getValueOrDefault(key + "/python_environment_path", FilePath(L"")));
}
void SourceGroupSettingsPythonEmpty::save(std::shared_ptr<ConfigManager> config)
{
SourceGroupSettings::save(config);
const std::string key = s_keyPrefix + getId();
SourceGroupSettingsWithExcludeFilters::save(config, key);
SourceGroupSettingsWithSourcePaths::save(config, key);
SourceGroupSettingsWithSourceExtensions::save(config, key);
config->setValue(key + "/python_environment_path", getEnvironmentPath().wstr());
}
bool SourceGroupSettingsPythonEmpty::equals(std::shared_ptr<SourceGroupSettings> other) const
{
std::shared_ptr<SourceGroupSettingsPythonEmpty> otherPython = std::dynamic_pointer_cast<SourceGroupSettingsPythonEmpty>(other);
return (
otherPython &&
SourceGroupSettings::equals(other) &&
SourceGroupSettingsWithExcludeFilters::equals(otherPython) &&
SourceGroupSettingsWithSourcePaths::equals(otherPython) &&
SourceGroupSettingsWithSourceExtensions::equals(otherPython) &&
m_environmentPath == otherPython->m_environmentPath
);
}
FilePath SourceGroupSettingsPythonEmpty::getEnvironmentPath() const
{
return m_environmentPath;
}
FilePath SourceGroupSettingsPythonEmpty::getEnvironmentPathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getEnvironmentPath(), m_projectSettings->getProjectDirectoryPath());
}
void SourceGroupSettingsPythonEmpty::setEnvironmentPath(const FilePath& environmentPath)
{
m_environmentPath = environmentPath;
}
std::vector<std::wstring> SourceGroupSettingsPythonEmpty::getDefaultSourceExtensions() const
{
return {
L".py"
};
}
@@ -1,36 +0,0 @@
#ifndef SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
#define SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
#include "FilePath.h"
#include "SourceGroupSettings.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithSourceExtensions.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsPythonEmpty
: public SourceGroupSettings
, public SourceGroupSettingsWithExcludeFilters
, public SourceGroupSettingsWithSourceExtensions
, public SourceGroupSettingsWithSourcePaths
{
public:
SourceGroupSettingsPythonEmpty(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
FilePath getEnvironmentPath() const;
FilePath getEnvironmentPathExpandedAndAbsolute() const;
void setEnvironmentPath(const FilePath& environmentPath);
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override;
FilePath m_environmentPath;
};
#endif // SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
@@ -0,0 +1,72 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_COMPONENTS_H
#define SOURCE_GROUP_SETTINGS_WITH_COMPONENTS_H
#include "SourceGroupSettings.h"
template<typename... ComponentTypes>
class SourceGroupSettingsWithComponents
: public SourceGroupSettings
, public ComponentTypes...
{
public:
SourceGroupSettingsWithComponents(SourceGroupType type, const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettings(type, id, projectSettings)
{
}
virtual ~SourceGroupSettingsWithComponents() = default;
void loadSettings(const ConfigManager* config) override
{
const std::string key = s_keyPrefix + getId();
SourceGroupSettings::load(config, key);
using expand_type = int[];
expand_type a{ 0, ((ComponentTypes::load(config, key)), void(), 0)... };
}
void saveSettings(ConfigManager* config) override
{
const std::string key = s_keyPrefix + getId();
SourceGroupSettings::save(config, key);
using expand_type = int[];
expand_type a{ 0, ((ComponentTypes::save(config, key)), void(), 0)... };
}
bool equalsSettings(const SourceGroupSettingsBase* other) override
{
if (!SourceGroupSettings::equals(other))
{
return false;
}
const SourceGroupSettingsWithComponents<ComponentTypes...>* otherPtr =
dynamic_cast<const SourceGroupSettingsWithComponents<ComponentTypes...>*>(other);
if (getComponentCount() != otherPtr->getComponentCount())
{
return false;
}
using expand_type = int[];
expand_type a{ false, ComponentTypes::equals(other)... };
bool r = true;
for (size_t i = 1; i <= getComponentCount(); ++i)
{
r &= a[i];
}
return r;
}
private:
size_t getComponentCount() const
{
return sizeof...(ComponentTypes);
}
};
#endif // SOURCE_GROUP_SETTINGS_WITH_COMPONENTS_H
@@ -0,0 +1,23 @@
#ifndef SOURCE_GROUP_SETTINGS_COMPONENT_H
#define SOURCE_GROUP_SETTINGS_COMPONENT_H
#include <string>
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class SourceGroupSettingsComponent
: virtual public SourceGroupSettingsBase
{
public:
virtual ~SourceGroupSettingsComponent() = default;
protected:
virtual void load(const ConfigManager* config, const std::string& key) = 0;
virtual void save(ConfigManager* config, const std::string& key) = 0;
virtual bool equals(const SourceGroupSettingsBase* other) const = 0;
};
#endif // SOURCE_GROUP_SETTINGS_COMPONENT_H
@@ -0,0 +1,46 @@
#include "SourceGroupSettingsWithCustomCommand.h"
#include "ConfigManager.h"
const std::wstring& SourceGroupSettingsWithCustomCommand::getCustomCommand() const
{
return m_customCommand;
}
void SourceGroupSettingsWithCustomCommand::setCustomCommand(const std::wstring& customCommand)
{
m_customCommand = customCommand;
}
bool SourceGroupSettingsWithCustomCommand::getRunInParallel() const
{
return m_runInParallel;
}
void SourceGroupSettingsWithCustomCommand::setRunInParallel(bool runInParallel)
{
m_runInParallel = runInParallel;
}
bool SourceGroupSettingsWithCustomCommand::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithCustomCommand* otherPtr =
dynamic_cast<const SourceGroupSettingsWithCustomCommand*>(other);
return (
otherPtr &&
m_customCommand == otherPtr->m_customCommand
);
}
void SourceGroupSettingsWithCustomCommand::load(const ConfigManager* config, const std::string& key)
{
setCustomCommand(config->getValueOrDefault(key + "/custom_command", std::wstring()));
setRunInParallel(config->getValueOrDefault(key + "/run_in_parallel", false));
}
void SourceGroupSettingsWithCustomCommand::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/custom_command", getCustomCommand());
config->setValue(key + "/run_in_parallel", getRunInParallel());
}
@@ -0,0 +1,29 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CUSTOM_COMMAND_H
#define SOURCE_GROUP_SETTINGS_WITH_CUSTOM_COMMAND_H
#include "SourceGroupSettingsComponent.h"
class SourceGroupSettingsWithCustomCommand
: public SourceGroupSettingsComponent
{
public:
virtual ~SourceGroupSettingsWithCustomCommand() = default;
const std::wstring& getCustomCommand() const;
void setCustomCommand(const std::wstring& customCommand);
bool getRunInParallel() const;
void setRunInParallel(bool runInParallel);
protected:
bool equals(const SourceGroupSettingsBase* other) const override;
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private:
std::wstring m_customCommand;
bool m_runInParallel = false;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_CUSTOM_COMMAND_H
@@ -6,29 +6,6 @@
#include "utility.h" #include "utility.h"
#include "utilityFile.h" #include "utilityFile.h"
SourceGroupSettingsWithExcludeFilters::SourceGroupSettingsWithExcludeFilters()
: m_excludeFilters(std::vector<std::wstring>())
{
}
bool SourceGroupSettingsWithExcludeFilters::equals(std::shared_ptr<SourceGroupSettingsWithExcludeFilters> other) const
{
return (
utility::isPermutation(m_excludeFilters, other->m_excludeFilters)
);
}
void SourceGroupSettingsWithExcludeFilters::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setExcludeFilterStrings(config->getValuesOrDefaults(key + "/exclude_filters/exclude_filter", std::vector<std::wstring>()));
}
void SourceGroupSettingsWithExcludeFilters::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValues(key + "/exclude_filters/exclude_filter", getExcludeFilterStrings());
}
std::vector<std::wstring> SourceGroupSettingsWithExcludeFilters::getExcludeFilterStrings() const std::vector<std::wstring> SourceGroupSettingsWithExcludeFilters::getExcludeFilterStrings() const
{ {
return m_excludeFilters; return m_excludeFilters;
@@ -44,7 +21,29 @@ void SourceGroupSettingsWithExcludeFilters::setExcludeFilterStrings(const std::v
m_excludeFilters = excludeFilters; m_excludeFilters = excludeFilters;
} }
std::vector<FilePathFilter> SourceGroupSettingsWithExcludeFilters::getFiltersExpandedAndAbsolute(const std::vector<std::wstring>& filterStrings) const bool SourceGroupSettingsWithExcludeFilters::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithExcludeFilters* otherPtr =
dynamic_cast<const SourceGroupSettingsWithExcludeFilters*>(other);
return (
otherPtr &&
utility::isPermutation(m_excludeFilters, otherPtr->m_excludeFilters)
);
}
void SourceGroupSettingsWithExcludeFilters::load(const ConfigManager* config, const std::string& key)
{
setExcludeFilterStrings(config->getValuesOrDefaults(key + "/exclude_filters/exclude_filter", std::vector<std::wstring>()));
}
void SourceGroupSettingsWithExcludeFilters::save(ConfigManager* config, const std::string& key)
{
config->setValues(key + "/exclude_filters/exclude_filter", getExcludeFilterStrings());
}
std::vector<FilePathFilter> SourceGroupSettingsWithExcludeFilters::getFiltersExpandedAndAbsolute(
const std::vector<std::wstring>& filterStrings) const
{ {
const FilePath projectDirectoryPath = getProjectSettings()->getProjectDirectoryPath(); const FilePath projectDirectoryPath = getProjectSettings()->getProjectDirectoryPath();
@@ -1,31 +1,27 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_EXCLUDE_FILTERS_H #ifndef SOURCE_GROUP_SETTINGS_WITH_EXCLUDE_FILTERS_H
#define SOURCE_GROUP_SETTINGS_WITH_EXCLUDE_FILTERS_H #define SOURCE_GROUP_SETTINGS_WITH_EXCLUDE_FILTERS_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class FilePathFilter; class FilePathFilter;
class SourceGroupSettingsWithExcludeFilters class SourceGroupSettingsWithExcludeFilters
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
SourceGroupSettingsWithExcludeFilters();
virtual ~SourceGroupSettingsWithExcludeFilters() = default; virtual ~SourceGroupSettingsWithExcludeFilters() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithExcludeFilters> other) const;
std::vector<std::wstring> getExcludeFilterStrings() const; std::vector<std::wstring> getExcludeFilterStrings() const;
std::vector<FilePathFilter> getExcludeFiltersExpandedAndAbsolute() const; std::vector<FilePathFilter> getExcludeFiltersExpandedAndAbsolute() const;
void setExcludeFilterStrings(const std::vector<std::wstring>& excludeFilters); void setExcludeFilterStrings(const std::vector<std::wstring>& excludeFilters);
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
std::vector<FilePathFilter> getFiltersExpandedAndAbsolute(const std::vector<std::wstring>& filterStrings) const; std::vector<FilePathFilter> getFiltersExpandedAndAbsolute(const std::vector<std::wstring>& filterStrings) const;
@@ -3,28 +3,6 @@
#include "ProjectSettings.h" #include "ProjectSettings.h"
#include "utilityFile.h" #include "utilityFile.h"
SourceGroupSettingsWithSonargraphProjectPath::SourceGroupSettingsWithSonargraphProjectPath()
{
}
bool SourceGroupSettingsWithSonargraphProjectPath::equals(std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> other) const
{
return (
other &&
m_sonargraphProjectPath == other->m_sonargraphProjectPath
);
}
void SourceGroupSettingsWithSonargraphProjectPath::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setSonargraphProjectPath(config->getValueOrDefault(key + "/sonargraph_project_path", FilePath(L"")));
}
void SourceGroupSettingsWithSonargraphProjectPath::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValue(key + "/sonargraph_project_path", getSonargraphProjectPath().wstr());
}
FilePath SourceGroupSettingsWithSonargraphProjectPath::getSonargraphProjectPath() const FilePath SourceGroupSettingsWithSonargraphProjectPath::getSonargraphProjectPath() const
{ {
return m_sonargraphProjectPath; return m_sonargraphProjectPath;
@@ -39,3 +17,24 @@ void SourceGroupSettingsWithSonargraphProjectPath::setSonargraphProjectPath(cons
{ {
m_sonargraphProjectPath = sonargraphProjectPath; m_sonargraphProjectPath = sonargraphProjectPath;
} }
bool SourceGroupSettingsWithSonargraphProjectPath::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithSonargraphProjectPath* otherPtr =
dynamic_cast<const SourceGroupSettingsWithSonargraphProjectPath*>(other);
return (
otherPtr &&
m_sonargraphProjectPath == otherPtr->m_sonargraphProjectPath
);
}
void SourceGroupSettingsWithSonargraphProjectPath::load(const ConfigManager* config, const std::string& key)
{
setSonargraphProjectPath(config->getValueOrDefault(key + "/sonargraph_project_path", FilePath(L"")));
}
void SourceGroupSettingsWithSonargraphProjectPath::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/sonargraph_project_path", getSonargraphProjectPath().wstr());
}
@@ -1,30 +1,24 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SONARGRAPH_PROJECT_PATH_H #ifndef SOURCE_GROUP_SETTINGS_WITH_SONARGRAPH_PROJECT_PATH_H
#define SOURCE_GROUP_SETTINGS_WITH_SONARGRAPH_PROJECT_PATH_H #define SOURCE_GROUP_SETTINGS_WITH_SONARGRAPH_PROJECT_PATH_H
#include <memory>
#include <string>
#include "SourceGroupSettingsBase.h"
#include "FilePath.h" #include "FilePath.h"
#include "SourceGroupSettingsComponent.h"
class ConfigManager;
class SourceGroupSettingsWithSonargraphProjectPath class SourceGroupSettingsWithSonargraphProjectPath
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
SourceGroupSettingsWithSonargraphProjectPath();
virtual ~SourceGroupSettingsWithSonargraphProjectPath() = default; virtual ~SourceGroupSettingsWithSonargraphProjectPath() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> other) const;
FilePath getSonargraphProjectPath() const; FilePath getSonargraphProjectPath() const;
FilePath getSonargraphProjectPathExpandedAndAbsolute() const; FilePath getSonargraphProjectPathExpandedAndAbsolute() const;
void setSonargraphProjectPath(const FilePath& sonargraphProjectPath); void setSonargraphProjectPath(const FilePath& sonargraphProjectPath);
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
FilePath m_sonargraphProjectPath; FilePath m_sonargraphProjectPath;
@@ -3,26 +3,6 @@
#include "ProjectSettings.h" #include "ProjectSettings.h"
#include "utility.h" #include "utility.h"
SourceGroupSettingsWithSourceExtensions::SourceGroupSettingsWithSourceExtensions()
: m_sourceExtensions(std::vector<std::wstring>())
{
}
bool SourceGroupSettingsWithSourceExtensions::equals(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> other) const
{
return utility::isPermutation(m_sourceExtensions, other->m_sourceExtensions);
}
void SourceGroupSettingsWithSourceExtensions::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setSourceExtensions(config->getValuesOrDefaults(key + "/source_extensions/source_extension", std::vector<std::wstring>()));
}
void SourceGroupSettingsWithSourceExtensions::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValues(key + "/source_extensions/source_extension", getSourceExtensions());
}
std::vector<std::wstring> SourceGroupSettingsWithSourceExtensions::getSourceExtensions() const std::vector<std::wstring> SourceGroupSettingsWithSourceExtensions::getSourceExtensions() const
{ {
if (m_sourceExtensions.empty()) if (m_sourceExtensions.empty())
@@ -36,3 +16,24 @@ void SourceGroupSettingsWithSourceExtensions::setSourceExtensions(const std::vec
{ {
m_sourceExtensions = sourceExtensions; m_sourceExtensions = sourceExtensions;
} }
bool SourceGroupSettingsWithSourceExtensions::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithSourceExtensions* otherPtr =
dynamic_cast<const SourceGroupSettingsWithSourceExtensions*>(other);
return (
otherPtr &&
utility::isPermutation(m_sourceExtensions, otherPtr->m_sourceExtensions)
);
}
void SourceGroupSettingsWithSourceExtensions::load(const ConfigManager* config, const std::string& key)
{
setSourceExtensions(config->getValuesOrDefaults(key + "/source_extensions/source_extension", std::vector<std::wstring>()));
}
void SourceGroupSettingsWithSourceExtensions::save(ConfigManager* config, const std::string& key)
{
config->setValues(key + "/source_extensions/source_extension", getSourceExtensions());
}
@@ -1,30 +1,24 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H #ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H #define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class FilePath;
class SourceGroupSettingsWithSourceExtensions class SourceGroupSettingsWithSourceExtensions
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
SourceGroupSettingsWithSourceExtensions();
virtual ~SourceGroupSettingsWithSourceExtensions() = default; virtual ~SourceGroupSettingsWithSourceExtensions() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> other) const;
std::vector<std::wstring> getSourceExtensions() const; std::vector<std::wstring> getSourceExtensions() const;
void setSourceExtensions(const std::vector<std::wstring>& sourceExtensions); void setSourceExtensions(const std::vector<std::wstring>& sourceExtensions);
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0; virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0;
@@ -0,0 +1,16 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_EMPTY_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_EMPTY_H
#include "SourceGroupSettingsWithSourceExtensions.h"
class SourceGroupSettingsWithSourceExtensionsEmpty
: public SourceGroupSettingsWithSourceExtensions
{
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override
{
return {};
}
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_EMPTY_H
@@ -3,26 +3,6 @@
#include "ProjectSettings.h" #include "ProjectSettings.h"
#include "utility.h" #include "utility.h"
SourceGroupSettingsWithSourcePaths::SourceGroupSettingsWithSourcePaths()
: m_sourcePaths(std::vector<FilePath>())
{
}
bool SourceGroupSettingsWithSourcePaths::equals(std::shared_ptr<SourceGroupSettingsWithSourcePaths> other) const
{
return utility::isPermutation(m_sourcePaths, other->m_sourcePaths);
}
void SourceGroupSettingsWithSourcePaths::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setSourcePaths(config->getValuesOrDefaults(key + "/source_paths/source_path", std::vector<FilePath>()));
}
void SourceGroupSettingsWithSourcePaths::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValues(key + "/source_paths/source_path", getSourcePaths());
}
std::vector<FilePath> SourceGroupSettingsWithSourcePaths::getSourcePaths() const std::vector<FilePath> SourceGroupSettingsWithSourcePaths::getSourcePaths() const
{ {
return m_sourcePaths; return m_sourcePaths;
@@ -37,3 +17,23 @@ void SourceGroupSettingsWithSourcePaths::setSourcePaths(const std::vector<FilePa
{ {
m_sourcePaths = sourcePaths; m_sourcePaths = sourcePaths;
} }
bool SourceGroupSettingsWithSourcePaths::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithSourcePaths* otherPtr = dynamic_cast<const SourceGroupSettingsWithSourcePaths*>(other);
return (
otherPtr &&
utility::isPermutation(m_sourcePaths, otherPtr->m_sourcePaths)
);
}
void SourceGroupSettingsWithSourcePaths::load(const ConfigManager* config, const std::string& key)
{
setSourcePaths(config->getValuesOrDefaults(key + "/source_paths/source_path", std::vector<FilePath>()));
}
void SourceGroupSettingsWithSourcePaths::save(ConfigManager* config, const std::string& key)
{
config->setValues(key + "/source_paths/source_path", getSourcePaths());
}
@@ -1,31 +1,26 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H #ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H #define SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "SourceGroupSettingsBase.h" #include "FilePath.h"
#include "SourceGroupSettingsComponent.h"
class ConfigManager;
class FilePath;
class SourceGroupSettingsWithSourcePaths class SourceGroupSettingsWithSourcePaths
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
SourceGroupSettingsWithSourcePaths();
virtual ~SourceGroupSettingsWithSourcePaths() = default; virtual ~SourceGroupSettingsWithSourcePaths() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithSourcePaths> other) const;
std::vector<FilePath> getSourcePaths() const; std::vector<FilePath> getSourcePaths() const;
std::vector<FilePath> getSourcePathsExpandedAndAbsolute() const; std::vector<FilePath> getSourcePathsExpandedAndAbsolute() const;
void setSourcePaths(const std::vector<FilePath>& sourcePaths); void setSourcePaths(const std::vector<FilePath>& sourcePaths);
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
std::vector<FilePath> m_sourcePaths; std::vector<FilePath> m_sourcePaths;
@@ -7,24 +7,6 @@ std::wstring SourceGroupSettingsWithCStandard::getDefaultCStandardStatic()
return L"c11"; return L"c11";
} }
bool SourceGroupSettingsWithCStandard::equals(std::shared_ptr<SourceGroupSettingsWithCStandard> other) const
{
return (
other &&
m_cStandard == other->m_cStandard
);
}
void SourceGroupSettingsWithCStandard::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setCStandard(config->getValueOrDefault<std::wstring>(key + "/c_standard", L""));
}
void SourceGroupSettingsWithCStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValue(key + "/c_standard", getCStandard());
}
std::wstring SourceGroupSettingsWithCStandard::getCStandard() const std::wstring SourceGroupSettingsWithCStandard::getCStandard() const
{ {
if (m_cStandard.empty()) if (m_cStandard.empty())
@@ -57,6 +39,26 @@ std::vector<std::wstring> SourceGroupSettingsWithCStandard::getAvailableCStandar
}; };
} }
bool SourceGroupSettingsWithCStandard::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithCStandard* otherPtr = dynamic_cast<const SourceGroupSettingsWithCStandard*>(other);
return (
otherPtr &&
m_cStandard == otherPtr->m_cStandard
);
}
void SourceGroupSettingsWithCStandard::load(const ConfigManager* config, const std::string& key)
{
setCStandard(config->getValueOrDefault<std::wstring>(key + "/c_standard", L""));
}
void SourceGroupSettingsWithCStandard::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/c_standard", getCStandard());
}
std::wstring SourceGroupSettingsWithCStandard::getDefaultCStandard() const std::wstring SourceGroupSettingsWithCStandard::getDefaultCStandard() const
{ {
return getDefaultCStandardStatic(); return getDefaultCStandardStatic();
@@ -1,33 +1,28 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H #ifndef SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
#define SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H #define SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class SourceGroupSettingsWithCStandard class SourceGroupSettingsWithCStandard
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
static std::wstring getDefaultCStandardStatic(); static std::wstring getDefaultCStandardStatic();
SourceGroupSettingsWithCStandard() = default;
virtual ~SourceGroupSettingsWithCStandard() = default; virtual ~SourceGroupSettingsWithCStandard() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithCStandard> other) const;
std::wstring getCStandard() const; std::wstring getCStandard() const;
void setCStandard(const std::wstring& standard); void setCStandard(const std::wstring& standard);
std::vector<std::wstring> getAvailableCStandards() const; std::vector<std::wstring> getAvailableCStandards() const;
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
std::wstring getDefaultCStandard() const; std::wstring getDefaultCStandard() const;
@@ -7,24 +7,6 @@ std::wstring SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic()
return L"c++17"; return L"c++17";
} }
bool SourceGroupSettingsWithCppStandard::equals(std::shared_ptr<SourceGroupSettingsWithCppStandard> other) const
{
return (
other &&
m_cppStandard == other->m_cppStandard
);
}
void SourceGroupSettingsWithCppStandard::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setCppStandard(config->getValueOrDefault<std::wstring>(key + "/cpp_standard", L""));
}
void SourceGroupSettingsWithCppStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValue(key + "/cpp_standard", getCppStandard());
}
std::wstring SourceGroupSettingsWithCppStandard::getCppStandard() const std::wstring SourceGroupSettingsWithCppStandard::getCppStandard() const
{ {
if (m_cppStandard.empty()) if (m_cppStandard.empty())
@@ -57,6 +39,26 @@ std::vector<std::wstring> SourceGroupSettingsWithCppStandard::getAvailableCppSta
}; };
} }
bool SourceGroupSettingsWithCppStandard::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithCppStandard* otherPtr = dynamic_cast<const SourceGroupSettingsWithCppStandard*>(other);
return (
otherPtr &&
m_cppStandard == otherPtr->m_cppStandard
);
}
void SourceGroupSettingsWithCppStandard::load(const ConfigManager* config, const std::string& key)
{
setCppStandard(config->getValueOrDefault<std::wstring>(key + "/cpp_standard", L""));
}
void SourceGroupSettingsWithCppStandard::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/cpp_standard", getCppStandard());
}
std::wstring SourceGroupSettingsWithCppStandard::getDefaultCppStandard() const std::wstring SourceGroupSettingsWithCppStandard::getDefaultCppStandard() const
{ {
return getDefaultCppStandardStatic(); return getDefaultCppStandardStatic();
@@ -1,33 +1,28 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H #ifndef SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
#define SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H #define SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class SourceGroupSettingsWithCppStandard class SourceGroupSettingsWithCppStandard
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
static std::wstring getDefaultCppStandardStatic(); static std::wstring getDefaultCppStandardStatic();
SourceGroupSettingsWithCppStandard() = default;
virtual ~SourceGroupSettingsWithCppStandard() = default; virtual ~SourceGroupSettingsWithCppStandard() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithCppStandard> other) const;
std::wstring getCppStandard() const; std::wstring getCppStandard() const;
void setCppStandard(const std::wstring& standard); void setCppStandard(const std::wstring& standard);
std::vector<std::wstring> getAvailableCppStandards() const; std::vector<std::wstring> getAvailableCppStandards() const;
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
std::wstring getDefaultCppStandard() const; std::wstring getDefaultCppStandard() const;
@@ -0,0 +1,41 @@
#include "SourceGroupSettingsWithCxxCdbPath.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
FilePath SourceGroupSettingsWithCxxCdbPath::getCompilationDatabasePath() const
{
return m_compilationDatabasePath;
}
FilePath SourceGroupSettingsWithCxxCdbPath::getCompilationDatabasePathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(
getCompilationDatabasePath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsWithCxxCdbPath::setCompilationDatabasePath(const FilePath& compilationDatabasePath)
{
m_compilationDatabasePath = compilationDatabasePath;
}
bool SourceGroupSettingsWithCxxCdbPath::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithCxxCdbPath* otherPtr =
dynamic_cast<const SourceGroupSettingsWithCxxCdbPath*>(other);
return (
otherPtr &&
m_compilationDatabasePath == otherPtr->m_compilationDatabasePath
);
}
void SourceGroupSettingsWithCxxCdbPath::load(const ConfigManager* config, const std::string& key)
{
setCompilationDatabasePath(config->getValueOrDefault(key + "/build_file_path/compilation_db_path", FilePath(L"")));
}
void SourceGroupSettingsWithCxxCdbPath::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/build_file_path/compilation_db_path", getCompilationDatabasePath().wstr());
}
@@ -0,0 +1,27 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CXX_CDB_PATH_H
#define SOURCE_GROUP_SETTINGS_WITH_CXX_CDB_PATH_H
#include "FilePath.h"
#include "SourceGroupSettingsComponent.h"
class SourceGroupSettingsWithCxxCdbPath
: public SourceGroupSettingsComponent
{
public:
virtual ~SourceGroupSettingsWithCxxCdbPath() = default;
FilePath getCompilationDatabasePath() const;
FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
void setCompilationDatabasePath(const FilePath& compilationDatabasePath);
protected:
bool equals(const SourceGroupSettingsBase* other) const override;
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private:
FilePath m_compilationDatabasePath;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_CXX_CDB_PATH_H
@@ -0,0 +1,40 @@
#include "SourceGroupSettingsWithCxxCodeblocksPath.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
FilePath SourceGroupSettingsWithCxxCodeblocksPath::getCodeblocksProjectPath() const
{
return m_codeblocksProjectPath;
}
FilePath SourceGroupSettingsWithCxxCodeblocksPath::getCodeblocksProjectPathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getCodeblocksProjectPath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsWithCxxCodeblocksPath::setCodeblocksProjectPath(const FilePath& codeblocksProjectPath)
{
m_codeblocksProjectPath = codeblocksProjectPath;
}
bool SourceGroupSettingsWithCxxCodeblocksPath::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithCxxCodeblocksPath* otherPtr =
dynamic_cast<const SourceGroupSettingsWithCxxCodeblocksPath*>(other);
return (
otherPtr &&
m_codeblocksProjectPath == otherPtr->m_codeblocksProjectPath
);
}
void SourceGroupSettingsWithCxxCodeblocksPath::load(const ConfigManager* config, const std::string& key)
{
setCodeblocksProjectPath(config->getValueOrDefault(key + "/codeblocks_project_path", FilePath(L"")));
}
void SourceGroupSettingsWithCxxCodeblocksPath::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/codeblocks_project_path", getCodeblocksProjectPath().wstr());
}
@@ -0,0 +1,27 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CXX_CODEBLOCKS_PATH_H
#define SOURCE_GROUP_SETTINGS_WITH_CXX_CODEBLOCKS_PATH_H
#include "FilePath.h"
#include "SourceGroupSettingsComponent.h"
class SourceGroupSettingsWithCxxCodeblocksPath
: public SourceGroupSettingsComponent
{
public:
virtual ~SourceGroupSettingsWithCxxCodeblocksPath() = default;
FilePath getCodeblocksProjectPath() const;
FilePath getCodeblocksProjectPathExpandedAndAbsolute() const;
void setCodeblocksProjectPath(const FilePath& codeblocksProjectPath);
protected:
bool equals(const SourceGroupSettingsBase* other) const override;
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private:
FilePath m_codeblocksProjectPath;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_CXX_CODEBLOCKS_PATH_H
@@ -140,41 +140,6 @@ std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::get
}; };
} }
SourceGroupSettingsWithCxxCrossCompilationOptions::SourceGroupSettingsWithCxxCrossCompilationOptions()
: m_targetOptionsEnabled(false)
, m_targetArch(L"")
, m_targetVendor(L"")
, m_targetSys(L"")
, m_targetAbi(L"")
{
}
bool SourceGroupSettingsWithCxxCrossCompilationOptions::equals(std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> other) const
{
return (
other &&
getTargetFlag() == other->getTargetFlag()
);
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setTargetOptionsEnabled(config->getValueOrDefault<bool>(key + "/cross_compilation/target_options_enabled", false));
setTargetArch(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/arch", L""));
setTargetVendor(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/vendor", L""));
setTargetSys(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/sys", L""));
setTargetAbi(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/abi", L""));
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValue(key + "/cross_compilation/target_options_enabled", getTargetOptionsEnabled());
config->setValue(key + "/cross_compilation/target/arch", getTargetArch());
config->setValue(key + "/cross_compilation/target/vendor", getTargetVendor());
config->setValue(key + "/cross_compilation/target/sys", getTargetSys());
config->setValue(key + "/cross_compilation/target/abi", getTargetAbi());
}
bool SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetOptionsEnabled() const bool SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetOptionsEnabled() const
{ {
return m_targetOptionsEnabled; return m_targetOptionsEnabled;
@@ -238,3 +203,32 @@ std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetFlag()
} }
return targetFlag; return targetFlag;
} }
bool SourceGroupSettingsWithCxxCrossCompilationOptions::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithCxxCrossCompilationOptions* otherPtr =
dynamic_cast<const SourceGroupSettingsWithCxxCrossCompilationOptions*>(other);
return (
other &&
getTargetFlag() == otherPtr->getTargetFlag()
);
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::load(const ConfigManager* config, const std::string& key)
{
setTargetOptionsEnabled(config->getValueOrDefault<bool>(key + "/cross_compilation/target_options_enabled", false));
setTargetArch(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/arch", L""));
setTargetVendor(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/vendor", L""));
setTargetSys(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/sys", L""));
setTargetAbi(config->getValueOrDefault<std::wstring>(key + "/cross_compilation/target/abi", L""));
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/cross_compilation/target_options_enabled", getTargetOptionsEnabled());
config->setValue(key + "/cross_compilation/target/arch", getTargetArch());
config->setValue(key + "/cross_compilation/target/vendor", getTargetVendor());
config->setValue(key + "/cross_compilation/target/sys", getTargetSys());
config->setValue(key + "/cross_compilation/target/abi", getTargetAbi());
}
@@ -1,16 +1,12 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CXX_CROSS_COMPILATION_OPTIONS_H #ifndef SOURCE_GROUP_SETTINGS_WITH_CXX_CROSS_COMPILATION_OPTIONS_H
#define SOURCE_GROUP_SETTINGS_WITH_CXX_CROSS_COMPILATION_OPTIONS_H #define SOURCE_GROUP_SETTINGS_WITH_CXX_CROSS_COMPILATION_OPTIONS_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class SourceGroupSettingsWithCxxCrossCompilationOptions class SourceGroupSettingsWithCxxCrossCompilationOptions
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
static std::vector<std::wstring> getAvailableArchTypes(); static std::vector<std::wstring> getAvailableArchTypes();
@@ -18,11 +14,8 @@ public:
static std::vector<std::wstring> getAvailableOsTypes(); static std::vector<std::wstring> getAvailableOsTypes();
static std::vector<std::wstring> getAvailableEnvironmentTypes(); static std::vector<std::wstring> getAvailableEnvironmentTypes();
SourceGroupSettingsWithCxxCrossCompilationOptions();
virtual ~SourceGroupSettingsWithCxxCrossCompilationOptions() = default; virtual ~SourceGroupSettingsWithCxxCrossCompilationOptions() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> other) const;
bool getTargetOptionsEnabled() const; bool getTargetOptionsEnabled() const;
void setTargetOptionsEnabled(bool targetOptionsEnabled); void setTargetOptionsEnabled(bool targetOptionsEnabled);
@@ -41,11 +34,13 @@ public:
std::wstring getTargetFlag() const; std::wstring getTargetFlag() const;
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
bool m_targetOptionsEnabled; bool m_targetOptionsEnabled = false;
std::wstring m_targetArch; std::wstring m_targetArch;
std::wstring m_targetVendor; std::wstring m_targetVendor;
std::wstring m_targetSys; std::wstring m_targetSys;
@@ -0,0 +1,71 @@
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "ProjectSettings.h"
#include "utility.h"
std::vector<FilePath> SourceGroupSettingsWithCxxPathsAndFlags::getHeaderSearchPaths() const
{
return m_headerSearchPaths;
}
std::vector<FilePath> SourceGroupSettingsWithCxxPathsAndFlags::getHeaderSearchPathsExpandedAndAbsolute() const
{
return getProjectSettings()->makePathsExpandedAndAbsolute(getHeaderSearchPaths());
}
void SourceGroupSettingsWithCxxPathsAndFlags::setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths)
{
m_headerSearchPaths = headerSearchPaths;
}
std::vector<FilePath> SourceGroupSettingsWithCxxPathsAndFlags::getFrameworkSearchPaths() const
{
return m_frameworkSearchPaths;
}
std::vector<FilePath> SourceGroupSettingsWithCxxPathsAndFlags::getFrameworkSearchPathsExpandedAndAbsolute() const
{
return getProjectSettings()->makePathsExpandedAndAbsolute(getFrameworkSearchPaths());
}
void SourceGroupSettingsWithCxxPathsAndFlags::setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths)
{
m_frameworkSearchPaths = frameworkSearchPaths;
}
std::vector<std::wstring> SourceGroupSettingsWithCxxPathsAndFlags::getCompilerFlags() const
{
return m_compilerFlags;
}
void SourceGroupSettingsWithCxxPathsAndFlags::setCompilerFlags(const std::vector<std::wstring>& compilerFlags)
{
m_compilerFlags = compilerFlags;
}
bool SourceGroupSettingsWithCxxPathsAndFlags::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithCxxPathsAndFlags* otherPtr =
dynamic_cast<const SourceGroupSettingsWithCxxPathsAndFlags*>(other);
return (
otherPtr &&
utility::isPermutation(m_headerSearchPaths, otherPtr->m_headerSearchPaths) &&
utility::isPermutation(m_frameworkSearchPaths, otherPtr->m_frameworkSearchPaths) &&
utility::isPermutation(m_compilerFlags, otherPtr->m_compilerFlags)
);
}
void SourceGroupSettingsWithCxxPathsAndFlags::load(const ConfigManager* config, const std::string& key)
{
setHeaderSearchPaths(config->getValuesOrDefaults(key + "/header_search_paths/header_search_path", std::vector<FilePath>()));
setFrameworkSearchPaths(config->getValuesOrDefaults(key + "/framework_search_paths/framework_search_path", std::vector<FilePath>()));
setCompilerFlags(config->getValuesOrDefaults(key + "/compiler_flags/compiler_flag", std::vector<std::wstring>()));
}
void SourceGroupSettingsWithCxxPathsAndFlags::save(ConfigManager* config, const std::string& key)
{
config->setValues(key + "/header_search_paths/header_search_path", getHeaderSearchPaths());
config->setValues(key + "/framework_search_paths/framework_search_path", getFrameworkSearchPaths());
config->setValues(key + "/compiler_flags/compiler_flag", getCompilerFlags());
}
@@ -1,20 +1,16 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_H #ifndef SOURCE_GROUP_SETTINGS_WITH_CXX_PATHS_AND_FLAGS_H
#define SOURCE_GROUP_SETTINGS_CXX_H #define SOURCE_GROUP_SETTINGS_WITH_CXX_PATHS_AND_FLAGS_H
#include "SourceGroupSettings.h" #include <vector>
#include "FilePath.h" #include "FilePath.h"
#include "SourceGroupSettingsComponent.h"
class SourceGroupSettingsCxx class SourceGroupSettingsWithCxxPathsAndFlags
: public SourceGroupSettings : public SourceGroupSettingsComponent
{ {
public: public:
SourceGroupSettingsCxx(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings); virtual ~SourceGroupSettingsWithCxxPathsAndFlags() = default;
void load(std::shared_ptr<const ConfigManager> config) override;
void save(std::shared_ptr<ConfigManager> config) override;
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
std::vector<FilePath> getHeaderSearchPaths() const; std::vector<FilePath> getHeaderSearchPaths() const;
std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const; std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const;
@@ -27,10 +23,16 @@ public:
std::vector<std::wstring> getCompilerFlags() const; std::vector<std::wstring> getCompilerFlags() const;
void setCompilerFlags(const std::vector<std::wstring>& compilerFlags); void setCompilerFlags(const std::vector<std::wstring>& compilerFlags);
protected:
bool equals(const SourceGroupSettingsBase* other) const override;
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
std::vector<FilePath> m_headerSearchPaths; std::vector<FilePath> m_headerSearchPaths;
std::vector<FilePath> m_frameworkSearchPaths; std::vector<FilePath> m_frameworkSearchPaths;
std::vector<std::wstring> m_compilerFlags; std::vector<std::wstring> m_compilerFlags;
}; };
#endif // SOURCE_GROUP_SETTINGS_CXX_H #endif // SOURCE_GROUP_SETTINGS_WITH_CXX_PATHS_AND_FLAGS_H
@@ -4,30 +4,6 @@
#include "utility.h" #include "utility.h"
#include "utilityFile.h" #include "utilityFile.h"
bool SourceGroupSettingsWithCxxPchOptions::equals(std::shared_ptr<SourceGroupSettingsWithCxxPchOptions> other) const
{
return (
other &&
m_pchInputFilePath == other->m_pchInputFilePath &&
utility::isPermutation(m_pchFlags, other->m_pchFlags) &&
m_useCompilerFlags == other->m_useCompilerFlags
);
}
void SourceGroupSettingsWithCxxPchOptions::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setPchInputFilePathFilePath(config->getValueOrDefault(key + "/pch_input_file_path", FilePath(L"")));
setPchFlags(config->getValuesOrDefaults(key + "/pch_flags/pch_flag", std::vector<std::wstring>()));
setUseCompilerFlags(config->getValueOrDefault(key + "/pch_flags/use_compiler_flags", false));
}
void SourceGroupSettingsWithCxxPchOptions::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValue(key + "/pch_input_file_path", getPchInputFilePath().wstr());
config->setValues(key + "/pch_flags/pch_flag", getPchFlags());
config->setValue(key + "/pch_flags/use_compiler_flags", getUseCompilerFlags());
}
FilePath SourceGroupSettingsWithCxxPchOptions::getPchDependenciesDirectoryPath() const FilePath SourceGroupSettingsWithCxxPchOptions::getPchDependenciesDirectoryPath() const
{ {
return getSourceGroupDependenciesDirectoryPath().concatenate(L"pch"); return getSourceGroupDependenciesDirectoryPath().concatenate(L"pch");
@@ -48,6 +24,33 @@ void SourceGroupSettingsWithCxxPchOptions::setPchInputFilePathFilePath(const Fil
m_pchInputFilePath = path; m_pchInputFilePath = path;
} }
bool SourceGroupSettingsWithCxxPchOptions::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithCxxPchOptions* otherPtr =
dynamic_cast<const SourceGroupSettingsWithCxxPchOptions*>(other);
return (
otherPtr &&
m_pchInputFilePath == otherPtr->m_pchInputFilePath &&
utility::isPermutation(m_pchFlags, otherPtr->m_pchFlags) &&
m_useCompilerFlags == otherPtr->m_useCompilerFlags
);
}
void SourceGroupSettingsWithCxxPchOptions::load(const ConfigManager* config, const std::string& key)
{
setPchInputFilePathFilePath(config->getValueOrDefault(key + "/pch_input_file_path", FilePath(L"")));
setPchFlags(config->getValuesOrDefaults(key + "/pch_flags/pch_flag", std::vector<std::wstring>()));
setUseCompilerFlags(config->getValueOrDefault(key + "/pch_flags/use_compiler_flags", false));
}
void SourceGroupSettingsWithCxxPchOptions::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/pch_input_file_path", getPchInputFilePath().wstr());
config->setValues(key + "/pch_flags/pch_flag", getPchFlags());
config->setValue(key + "/pch_flags/use_compiler_flags", getUseCompilerFlags());
}
bool SourceGroupSettingsWithCxxPchOptions::getUseCompilerFlags() const bool SourceGroupSettingsWithCxxPchOptions::getUseCompilerFlags() const
{ {
return m_useCompilerFlags; return m_useCompilerFlags;
@@ -1,23 +1,15 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CXX_PCH_OPTIONS_H #ifndef SOURCE_GROUP_SETTINGS_WITH_CXX_PCH_OPTIONS_H
#define SOURCE_GROUP_SETTINGS_WITH_CXX_PCH_OPTIONS_H #define SOURCE_GROUP_SETTINGS_WITH_CXX_PCH_OPTIONS_H
#include <memory>
#include <string>
#include "FilePath.h" #include "FilePath.h"
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class SourceGroupSettingsWithCxxPchOptions class SourceGroupSettingsWithCxxPchOptions
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
SourceGroupSettingsWithCxxPchOptions() = default;
virtual ~SourceGroupSettingsWithCxxPchOptions() = default; virtual ~SourceGroupSettingsWithCxxPchOptions() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithCxxPchOptions> other) const;
FilePath getPchDependenciesDirectoryPath() const; FilePath getPchDependenciesDirectoryPath() const;
FilePath getPchInputFilePath() const; FilePath getPchInputFilePath() const;
@@ -31,8 +23,10 @@ public:
void setUseCompilerFlags(bool useCompilerFlags); void setUseCompilerFlags(bool useCompilerFlags);
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
FilePath m_pchInputFilePath; FilePath m_pchInputFilePath;
@@ -3,28 +3,6 @@
#include "ProjectSettings.h" #include "ProjectSettings.h"
#include "utility.h" #include "utility.h"
SourceGroupSettingsWithIndexedHeaderPaths::SourceGroupSettingsWithIndexedHeaderPaths()
: m_indexedHeaderPaths(std::vector<FilePath>())
{
}
bool SourceGroupSettingsWithIndexedHeaderPaths::equals(std::shared_ptr<SourceGroupSettingsWithIndexedHeaderPaths> other) const
{
return (
utility::isPermutation(m_indexedHeaderPaths, other->m_indexedHeaderPaths)
);
}
void SourceGroupSettingsWithIndexedHeaderPaths::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setIndexedHeaderPaths(config->getValuesOrDefaults(key + "/indexed_header_paths/indexed_header_path", std::vector<FilePath>()));
}
void SourceGroupSettingsWithIndexedHeaderPaths::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValues(key + "/indexed_header_paths/indexed_header_path", getIndexedHeaderPaths());
}
std::vector<FilePath> SourceGroupSettingsWithIndexedHeaderPaths::getIndexedHeaderPaths() const std::vector<FilePath> SourceGroupSettingsWithIndexedHeaderPaths::getIndexedHeaderPaths() const
{ {
return m_indexedHeaderPaths; return m_indexedHeaderPaths;
@@ -39,3 +17,24 @@ void SourceGroupSettingsWithIndexedHeaderPaths::setIndexedHeaderPaths(const std:
{ {
m_indexedHeaderPaths = indexedHeaderPaths; m_indexedHeaderPaths = indexedHeaderPaths;
} }
bool SourceGroupSettingsWithIndexedHeaderPaths::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithIndexedHeaderPaths* otherPtr =
dynamic_cast<const SourceGroupSettingsWithIndexedHeaderPaths*>(other);
return (
otherPtr &&
utility::isPermutation(m_indexedHeaderPaths, otherPtr->m_indexedHeaderPaths)
);
}
void SourceGroupSettingsWithIndexedHeaderPaths::load(const ConfigManager* config, const std::string& key)
{
setIndexedHeaderPaths(config->getValuesOrDefaults(key + "/indexed_header_paths/indexed_header_path", std::vector<FilePath>()));
}
void SourceGroupSettingsWithIndexedHeaderPaths::save(ConfigManager* config, const std::string& key)
{
config->setValues(key + "/indexed_header_paths/indexed_header_path", getIndexedHeaderPaths());
}
@@ -1,31 +1,27 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_INDEXED_HEADER_PATHS_H #ifndef SOURCE_GROUP_SETTINGS_WITH_INDEXED_HEADER_PATHS_H
#define SOURCE_GROUP_SETTINGS_WITH_INDEXED_HEADER_PATHS_H #define SOURCE_GROUP_SETTINGS_WITH_INDEXED_HEADER_PATHS_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class FilePath; class FilePath;
class SourceGroupSettingsWithIndexedHeaderPaths class SourceGroupSettingsWithIndexedHeaderPaths
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
SourceGroupSettingsWithIndexedHeaderPaths();
virtual ~SourceGroupSettingsWithIndexedHeaderPaths() = default; virtual ~SourceGroupSettingsWithIndexedHeaderPaths() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithIndexedHeaderPaths> other) const;
std::vector<FilePath> getIndexedHeaderPaths() const; std::vector<FilePath> getIndexedHeaderPaths() const;
std::vector<FilePath> getIndexedHeaderPathsExpandedAndAbsolute() const; std::vector<FilePath> getIndexedHeaderPathsExpandedAndAbsolute() const;
void setIndexedHeaderPaths(const std::vector<FilePath>& indexedHeaderPaths); void setIndexedHeaderPaths(const std::vector<FilePath>& indexedHeaderPaths);
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
std::vector<FilePath> m_indexedHeaderPaths; std::vector<FilePath> m_indexedHeaderPaths;
@@ -0,0 +1,16 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_C_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_C_H
#include "SourceGroupSettingsWithSourceExtensions.h"
class SourceGroupSettingsWithSourceExtensionsC
: public SourceGroupSettingsWithSourceExtensions
{
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override
{
return { L".c" };
}
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_C_H
@@ -0,0 +1,20 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_CPP_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_CPP_H
#include "SourceGroupSettingsWithSourceExtensions.h"
class SourceGroupSettingsWithSourceExtensionsCpp
: public SourceGroupSettingsWithSourceExtensions
{
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override
{
return {
L".cpp",
L".cxx",
L".cc"
};
}
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_CPP_H
@@ -0,0 +1,21 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_CXX_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_CXX_H
#include "SourceGroupSettingsWithSourceExtensions.h"
class SourceGroupSettingsWithSourceExtensionsCxx
: public SourceGroupSettingsWithSourceExtensions
{
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override
{
return {
L".c",
L".cpp",
L".cxx",
L".cc"
};
}
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_CXX_H
@@ -3,32 +3,6 @@
#include "ProjectSettings.h" #include "ProjectSettings.h"
#include "utility.h" #include "utility.h"
SourceGroupSettingsWithClasspath::SourceGroupSettingsWithClasspath()
: m_classpath(std::vector<FilePath>())
, m_useJreSystemLibrary(true)
{
}
bool SourceGroupSettingsWithClasspath::equals(std::shared_ptr<SourceGroupSettingsWithClasspath> other) const
{
return (
(m_useJreSystemLibrary == other->m_useJreSystemLibrary) &&
utility::isPermutation(m_classpath, other->m_classpath)
);
}
void SourceGroupSettingsWithClasspath::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setClasspath(config->getValuesOrDefaults(key + "/class_paths/class_path", std::vector<FilePath>()));
setUseJreSystemLibrary(config->getValueOrDefault(key + "/use_jre_system_library", true));
}
void SourceGroupSettingsWithClasspath::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValues(key + "/class_paths/class_path", getClasspath());
config->setValue(key + "/use_jre_system_library", getUseJreSystemLibrary());
}
std::vector<FilePath> SourceGroupSettingsWithClasspath::getClasspath() const std::vector<FilePath> SourceGroupSettingsWithClasspath::getClasspath() const
{ {
return m_classpath; return m_classpath;
@@ -53,3 +27,26 @@ void SourceGroupSettingsWithClasspath::setUseJreSystemLibrary(bool useJreSystemL
{ {
m_useJreSystemLibrary = useJreSystemLibrary; m_useJreSystemLibrary = useJreSystemLibrary;
} }
bool SourceGroupSettingsWithClasspath::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithClasspath* otherPtr = dynamic_cast<const SourceGroupSettingsWithClasspath*>(other);
return (
otherPtr &&
(m_useJreSystemLibrary == otherPtr->m_useJreSystemLibrary) &&
utility::isPermutation(m_classpath, otherPtr->m_classpath)
);
}
void SourceGroupSettingsWithClasspath::load(const ConfigManager* config, const std::string& key)
{
setClasspath(config->getValuesOrDefaults(key + "/class_paths/class_path", std::vector<FilePath>()));
setUseJreSystemLibrary(config->getValueOrDefault(key + "/use_jre_system_library", true));
}
void SourceGroupSettingsWithClasspath::save(ConfigManager* config, const std::string& key)
{
config->setValues(key + "/class_paths/class_path", getClasspath());
config->setValue(key + "/use_jre_system_library", getUseJreSystemLibrary());
}
@@ -1,24 +1,17 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H #ifndef SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H
#define SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H #define SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "FilePath.h" #include "FilePath.h"
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class SourceGroupSettingsWithClasspath class SourceGroupSettingsWithClasspath
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
SourceGroupSettingsWithClasspath();
virtual ~SourceGroupSettingsWithClasspath() = default; virtual ~SourceGroupSettingsWithClasspath() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithClasspath> other) const;
std::vector<FilePath> getClasspath() const; std::vector<FilePath> getClasspath() const;
std::vector<FilePath> getClasspathExpandedAndAbsolute() const; std::vector<FilePath> getClasspathExpandedAndAbsolute() const;
void setClasspath(const std::vector<FilePath>& classpath); void setClasspath(const std::vector<FilePath>& classpath);
@@ -27,12 +20,14 @@ public:
void setUseJreSystemLibrary(bool useJreSystemLibrary); void setUseJreSystemLibrary(bool useJreSystemLibrary);
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
std::vector<FilePath> m_classpath; std::vector<FilePath> m_classpath;
bool m_useJreSystemLibrary; bool m_useJreSystemLibrary = true;
}; };
#endif // SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H #endif // SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H
@@ -0,0 +1,58 @@
#include "SourceGroupSettingsWithJavaGradle.h"
#include "ConfigManager.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
FilePath SourceGroupSettingsWithJavaGradle::getGradleDependenciesDirectoryPath() const
{
return getSourceGroupDependenciesDirectoryPath().concatenate(L"gradle");
}
FilePath SourceGroupSettingsWithJavaGradle::getGradleProjectFilePath() const
{
return m_gradleProjectFilePath;
}
FilePath SourceGroupSettingsWithJavaGradle::getGradleProjectFilePathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getGradleProjectFilePath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsWithJavaGradle::setGradleProjectFilePath(const FilePath& path)
{
m_gradleProjectFilePath = path;
}
bool SourceGroupSettingsWithJavaGradle::getShouldIndexGradleTests() const
{
return m_shouldIndexGradleTests;
}
void SourceGroupSettingsWithJavaGradle::setShouldIndexGradleTests(bool value)
{
m_shouldIndexGradleTests = value;
}
bool SourceGroupSettingsWithJavaGradle::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithJavaGradle* otherPtr = dynamic_cast<const SourceGroupSettingsWithJavaGradle*>(other);
return (
otherPtr &&
m_gradleProjectFilePath == otherPtr->m_gradleProjectFilePath &&
m_shouldIndexGradleTests == otherPtr->m_shouldIndexGradleTests
);
}
void SourceGroupSettingsWithJavaGradle::load(const ConfigManager* config, const std::string& key)
{
setGradleProjectFilePath(config->getValueOrDefault(key + "/gradle/project_file_path", FilePath(L"")));
setShouldIndexGradleTests(config->getValueOrDefault(key + "/gradle/should_index_tests", false));
}
void SourceGroupSettingsWithJavaGradle::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/gradle/project_file_path", getGradleProjectFilePath().wstr());
config->setValue(key + "/gradle/should_index_tests", getShouldIndexGradleTests());
}
@@ -0,0 +1,33 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_JAVA_GRADLE_H
#define SOURCE_GROUP_SETTINGS_WITH_JAVA_GRADLE_H
#include "FilePath.h"
#include "SourceGroupSettingsComponent.h"
class SourceGroupSettingsWithJavaGradle
: public SourceGroupSettingsComponent
{
public:
virtual ~SourceGroupSettingsWithJavaGradle() = default;
FilePath getGradleDependenciesDirectoryPath() const;
FilePath getGradleProjectFilePath() const;
FilePath getGradleProjectFilePathExpandedAndAbsolute() const;
void setGradleProjectFilePath(const FilePath& path);
bool getShouldIndexGradleTests() const;
void setShouldIndexGradleTests(bool value);
protected:
bool equals(const SourceGroupSettingsBase* other) const override;
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private:
FilePath m_gradleProjectFilePath;
bool m_shouldIndexGradleTests = false;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_JAVA_GRADLE_H
@@ -0,0 +1,58 @@
#include "SourceGroupSettingsWithJavaMaven.h"
#include "ConfigManager.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
FilePath SourceGroupSettingsWithJavaMaven::getMavenDependenciesDirectoryPath() const
{
return getSourceGroupDependenciesDirectoryPath().concatenate(L"maven");
}
FilePath SourceGroupSettingsWithJavaMaven::getMavenProjectFilePath() const
{
return m_mavenProjectFilePath;
}
FilePath SourceGroupSettingsWithJavaMaven::getMavenProjectFilePathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getMavenProjectFilePath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsWithJavaMaven::setMavenProjectFilePath(const FilePath& path)
{
m_mavenProjectFilePath = path;
}
bool SourceGroupSettingsWithJavaMaven::getShouldIndexMavenTests() const
{
return m_shouldIndexMavenTests;
}
void SourceGroupSettingsWithJavaMaven::setShouldIndexMavenTests(bool value)
{
m_shouldIndexMavenTests = value;
}
bool SourceGroupSettingsWithJavaMaven::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithJavaMaven* otherPtr = dynamic_cast<const SourceGroupSettingsWithJavaMaven*>(other);
return (
otherPtr &&
m_mavenProjectFilePath == otherPtr->m_mavenProjectFilePath &&
m_shouldIndexMavenTests == otherPtr->m_shouldIndexMavenTests
);
}
void SourceGroupSettingsWithJavaMaven::load(const ConfigManager* config, const std::string& key)
{
setMavenProjectFilePath(config->getValueOrDefault(key + "/maven/project_file_path", FilePath(L"")));
setShouldIndexMavenTests(config->getValueOrDefault(key + "/maven/should_index_tests", false));
}
void SourceGroupSettingsWithJavaMaven::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/maven/project_file_path", getMavenProjectFilePath().wstr());
config->setValue(key + "/maven/should_index_tests", getShouldIndexMavenTests());
}
@@ -0,0 +1,33 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_JAVA_MAVEN_H
#define SOURCE_GROUP_SETTINGS_WITH_JAVA_MAVEN_H
#include "FilePath.h"
#include "SourceGroupSettingsComponent.h"
class SourceGroupSettingsWithJavaMaven
: public SourceGroupSettingsComponent
{
public:
virtual ~SourceGroupSettingsWithJavaMaven() = default;
FilePath getMavenDependenciesDirectoryPath() const;
FilePath getMavenProjectFilePath() const;
FilePath getMavenProjectFilePathExpandedAndAbsolute() const;
void setMavenProjectFilePath(const FilePath& path);
bool getShouldIndexMavenTests() const;
void setShouldIndexMavenTests(bool value);
protected:
bool equals(const SourceGroupSettingsBase* other) const override;
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private:
FilePath m_mavenProjectFilePath;
bool m_shouldIndexMavenTests = false;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_JAVA_MAVEN_H
@@ -7,24 +7,6 @@ std::wstring SourceGroupSettingsWithJavaStandard::getDefaultJavaStandardStatic()
return L"8"; return L"8";
} }
bool SourceGroupSettingsWithJavaStandard::equals(std::shared_ptr<SourceGroupSettingsWithJavaStandard> other) const
{
return (
other &&
m_javaStandard == other->m_javaStandard
);
}
void SourceGroupSettingsWithJavaStandard::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setJavaStandard(config->getValueOrDefault<std::wstring>(key + "/java_standard", L""));
}
void SourceGroupSettingsWithJavaStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValue(key + "/java_standard", getJavaStandard());
}
std::wstring SourceGroupSettingsWithJavaStandard::getJavaStandard() const std::wstring SourceGroupSettingsWithJavaStandard::getJavaStandard() const
{ {
if (m_javaStandard.empty()) if (m_javaStandard.empty())
@@ -44,6 +26,26 @@ std::vector<std::wstring> SourceGroupSettingsWithJavaStandard::getAvailableJavaS
return {L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9", L"10"}; return {L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9", L"10"};
} }
bool SourceGroupSettingsWithJavaStandard::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithJavaStandard* otherPtr = dynamic_cast<const SourceGroupSettingsWithJavaStandard*>(other);
return (
otherPtr &&
m_javaStandard == otherPtr->m_javaStandard
);
}
void SourceGroupSettingsWithJavaStandard::load(const ConfigManager* config, const std::string& key)
{
setJavaStandard(config->getValueOrDefault<std::wstring>(key + "/java_standard", L""));
}
void SourceGroupSettingsWithJavaStandard::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/java_standard", getJavaStandard());
}
std::wstring SourceGroupSettingsWithJavaStandard::getDefaultJavaStandard() const std::wstring SourceGroupSettingsWithJavaStandard::getDefaultJavaStandard() const
{ {
return getDefaultJavaStandardStatic(); return getDefaultJavaStandardStatic();
@@ -1,33 +1,28 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H #ifndef SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
#define SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H #define SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
#include <memory>
#include <string>
#include <vector> #include <vector>
#include "SourceGroupSettingsBase.h" #include "SourceGroupSettingsComponent.h"
class ConfigManager;
class SourceGroupSettingsWithJavaStandard class SourceGroupSettingsWithJavaStandard
: virtual public SourceGroupSettingsBase : public SourceGroupSettingsComponent
{ {
public: public:
static std::wstring getDefaultJavaStandardStatic(); static std::wstring getDefaultJavaStandardStatic();
SourceGroupSettingsWithJavaStandard() = default;
virtual ~SourceGroupSettingsWithJavaStandard() = default; virtual ~SourceGroupSettingsWithJavaStandard() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithJavaStandard> other) const;
std::wstring getJavaStandard() const; std::wstring getJavaStandard() const;
void setJavaStandard(const std::wstring& standard); void setJavaStandard(const std::wstring& standard);
std::vector<std::wstring> getAvailableJavaStandards() const; std::vector<std::wstring> getAvailableJavaStandards() const;
protected: protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key); bool equals(const SourceGroupSettingsBase* other) const override;
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private: private:
std::wstring getDefaultJavaStandard() const; std::wstring getDefaultJavaStandard() const;
@@ -0,0 +1,16 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_JAVA_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_JAVA_H
#include "SourceGroupSettingsWithSourceExtensions.h"
class SourceGroupSettingsWithSourceExtensionsJava
: public SourceGroupSettingsWithSourceExtensions
{
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override
{
return { L".java" };
}
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_JAVA_H
@@ -0,0 +1,40 @@
#include "SourceGroupSettingsWithPythonEnvironmentPath.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
FilePath SourceGroupSettingsWithPythonEnvironmentPath::getEnvironmentPath() const
{
return m_environmentPath;
}
FilePath SourceGroupSettingsWithPythonEnvironmentPath::getEnvironmentPathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getEnvironmentPath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsWithPythonEnvironmentPath::setEnvironmentPath(const FilePath& environmentPath)
{
m_environmentPath = environmentPath;
}
bool SourceGroupSettingsWithPythonEnvironmentPath::equals(const SourceGroupSettingsBase* other) const
{
const SourceGroupSettingsWithPythonEnvironmentPath* otherPtr =
dynamic_cast<const SourceGroupSettingsWithPythonEnvironmentPath*>(other);
return (
otherPtr &&
m_environmentPath == otherPtr->m_environmentPath
);
}
void SourceGroupSettingsWithPythonEnvironmentPath::load(const ConfigManager* config, const std::string& key)
{
setEnvironmentPath(config->getValueOrDefault(key + "/python_environment_path", FilePath(L"")));
}
void SourceGroupSettingsWithPythonEnvironmentPath::save(ConfigManager* config, const std::string& key)
{
config->setValue(key + "/python_environment_path", getEnvironmentPath().wstr());
}
@@ -0,0 +1,27 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_PYTHON_ENVIRONMENT_PATH_H
#define SOURCE_GROUP_SETTINGS_WITH_PYTHON_ENVIRONMENT_PATH_H
#include "FilePath.h"
#include "SourceGroupSettingsComponent.h"
class SourceGroupSettingsWithPythonEnvironmentPath
: public SourceGroupSettingsComponent
{
public:
virtual ~SourceGroupSettingsWithPythonEnvironmentPath() = default;
FilePath getEnvironmentPath() const;
FilePath getEnvironmentPathExpandedAndAbsolute() const;
void setEnvironmentPath(const FilePath& environmentPath);
protected:
bool equals(const SourceGroupSettingsBase* other) const override;
void load(const ConfigManager* config, const std::string& key) override;
void save(ConfigManager* config, const std::string& key) override;
private:
FilePath m_environmentPath;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_PYTHON_ENVIRONMENT_PATH_H
@@ -0,0 +1,16 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_PYTHON_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_PYTHON_H
#include "SourceGroupSettingsWithSourceExtensions.h"
class SourceGroupSettingsWithSourceExtensionsPython
: public SourceGroupSettingsWithSourceExtensions
{
private:
std::vector<std::wstring> getDefaultSourceExtensions() const override
{
return { L".py" };
}
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_PYTHON_H
@@ -0,0 +1,35 @@
#ifndef SOURCE_GROUP_SETTINGS_C_EMPTY_H
#define SOURCE_GROUP_SETTINGS_C_EMPTY_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithCStandard.h"
#include "SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "SourceGroupSettingsWithCxxPchOptions.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithSourceExtensionsC.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsCEmpty
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithCStandard,
SourceGroupSettingsWithCxxCrossCompilationOptions,
SourceGroupSettingsWithCxxPathsAndFlags,
SourceGroupSettingsWithCxxPchOptions,
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithSourceExtensionsC,
SourceGroupSettingsWithSourcePaths>
{
public:
SourceGroupSettingsCEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_C_EMPTY, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsCEmpty>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_C_EMPTY_H
@@ -0,0 +1,35 @@
#ifndef SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
#define SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithCppStandard.h"
#include "SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "SourceGroupSettingsWithCxxPchOptions.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithSourceExtensionsCpp.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsCppEmpty
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithCppStandard,
SourceGroupSettingsWithCxxCrossCompilationOptions,
SourceGroupSettingsWithCxxPathsAndFlags,
SourceGroupSettingsWithCxxPchOptions,
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithSourceExtensionsCpp,
SourceGroupSettingsWithSourcePaths>
{
public:
SourceGroupSettingsCppEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_CPP_EMPTY, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsCppEmpty>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
@@ -0,0 +1,29 @@
#ifndef SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
#define SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithCustomCommand.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithSourceExtensionsEmpty.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsCustomCommand
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithCustomCommand,
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithSourceExtensionsEmpty,
SourceGroupSettingsWithSourcePaths>
{
public:
SourceGroupSettingsCustomCommand(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_CUSTOM_COMMAND, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsCustomCommand>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_CUSTOM_COMMAND_H
@@ -0,0 +1,31 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_CDB_H
#define SOURCE_GROUP_SETTINGS_CXX_CDB_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithCxxCdbPath.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "SourceGroupSettingsWithCxxPchOptions.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
class SourceGroupSettingsCxxCdb
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithCxxCdbPath,
SourceGroupSettingsWithCxxPathsAndFlags,
SourceGroupSettingsWithCxxPchOptions,
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithIndexedHeaderPaths>
{
public:
SourceGroupSettingsCxxCdb(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_CXX_CDB, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsCxxCdb>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_CXX_CDB_H
@@ -2,15 +2,11 @@
#define SOURCE_GROUP_SETTINGS_CXX_CDB_VS_H #define SOURCE_GROUP_SETTINGS_CXX_CDB_VS_H
#include "SourceGroupSettingsCxxCdb.h" #include "SourceGroupSettingsCxxCdb.h"
#include "FilePath.h"
class SourceGroupSettingsCxxCdbVs class SourceGroupSettingsCxxCdbVs
: public SourceGroupSettingsCxxCdb : public SourceGroupSettingsCxxCdb
{ {
public: using SourceGroupSettingsCxxCdb::SourceGroupSettingsCxxCdb;
SourceGroupSettingsCxxCdbVs(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
}; };
#endif // SOURCE_GROUP_SETTINGS_CXX_CDB_VS_H #endif // SOURCE_GROUP_SETTINGS_CXX_CDB_VS_H
@@ -0,0 +1,35 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
#define SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithCppStandard.h"
#include "SourceGroupSettingsWithCStandard.h"
#include "SourceGroupSettingsWithCxxCodeblocksPath.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "SourceGroupSettingsWithSourceExtensionsCxx.h"
class SourceGroupSettingsCxxCodeblocks
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithCppStandard,
SourceGroupSettingsWithCStandard,
SourceGroupSettingsWithCxxCodeblocksPath,
SourceGroupSettingsWithCxxPathsAndFlags,
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithIndexedHeaderPaths,
SourceGroupSettingsWithSourceExtensionsCxx>
{
public:
SourceGroupSettingsCxxCodeblocks(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_CXX_CODEBLOCKS, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsCxxCodeblocks>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
@@ -0,0 +1,29 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
#define SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithCppStandard.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "SourceGroupSettingsWithSonargraphProjectPath.h"
class SourceGroupSettingsCxxSonargraph
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithCppStandard,
SourceGroupSettingsWithCxxPathsAndFlags,
SourceGroupSettingsWithIndexedHeaderPaths,
SourceGroupSettingsWithSonargraphProjectPath>
{
public:
SourceGroupSettingsCxxSonargraph(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_CXX_SONARGRAPH, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsCxxSonargraph>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
@@ -0,0 +1,31 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
#define SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithClasspath.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithJavaStandard.h"
#include "SourceGroupSettingsWithSourceExtensionsJava.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsJavaEmpty
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithClasspath,
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithJavaStandard,
SourceGroupSettingsWithSourceExtensionsJava,
SourceGroupSettingsWithSourcePaths>
{
public:
SourceGroupSettingsJavaEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_JAVA_EMPTY, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsJavaEmpty>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_EMPTY_H
@@ -0,0 +1,29 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
#define SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithJavaGradle.h"
#include "SourceGroupSettingsWithJavaStandard.h"
#include "SourceGroupSettingsWithSourceExtensionsJava.h"
class SourceGroupSettingsJavaGradle
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithJavaGradle,
SourceGroupSettingsWithJavaStandard,
SourceGroupSettingsWithSourceExtensionsJava>
{
public:
SourceGroupSettingsJavaGradle(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_JAVA_GRADLE, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsJavaGradle>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_GRADLE_H
@@ -0,0 +1,29 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
#define SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithJavaMaven.h"
#include "SourceGroupSettingsWithJavaStandard.h"
#include "SourceGroupSettingsWithSourceExtensionsJava.h"
class SourceGroupSettingsJavaMaven
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithJavaMaven,
SourceGroupSettingsWithJavaStandard,
SourceGroupSettingsWithSourceExtensionsJava>
{
public:
SourceGroupSettingsJavaMaven(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_JAVA_MAVEN, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsJavaMaven>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_JAVA_MAVEN_H
@@ -1,26 +1,27 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H #ifndef SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
#define SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H #define SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
#include "SourceGroupSettings.h" #include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithClasspath.h" #include "SourceGroupSettingsWithClasspath.h"
#include "SourceGroupSettingsWithJavaStandard.h" #include "SourceGroupSettingsWithJavaStandard.h"
#include "SourceGroupSettingsWithSonargraphProjectPath.h" #include "SourceGroupSettingsWithSonargraphProjectPath.h"
class SourceGroupSettingsJavaSonargraph class SourceGroupSettingsJavaSonargraph
: public SourceGroupSettings : public SourceGroupSettingsWithComponents<
, public SourceGroupSettingsWithClasspath SourceGroupSettingsWithClasspath,
, public SourceGroupSettingsWithJavaStandard SourceGroupSettingsWithJavaStandard,
, public SourceGroupSettingsWithSonargraphProjectPath SourceGroupSettingsWithSonargraphProjectPath>
{ {
public: public:
SourceGroupSettingsJavaSonargraph(const std::string& id, const ProjectSettings* projectSettings); SourceGroupSettingsJavaSonargraph(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_JAVA_SONARGRAPH, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override; std::shared_ptr<SourceGroupSettings> createCopy() const override
{
void load(std::shared_ptr<const ConfigManager> config) override; return std::make_shared<SourceGroupSettingsJavaSonargraph>(*this);
void save(std::shared_ptr<ConfigManager> config) override; }
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
}; };
#endif // SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H #endif // SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
@@ -0,0 +1,29 @@
#ifndef SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
#define SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
#include "SourceGroupSettingsWithComponents.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithPythonEnvironmentPath.h"
#include "SourceGroupSettingsWithSourceExtensionsPython.h"
#include "SourceGroupSettingsWithSourcePaths.h"
class SourceGroupSettingsPythonEmpty
: public SourceGroupSettingsWithComponents<
SourceGroupSettingsWithExcludeFilters,
SourceGroupSettingsWithPythonEnvironmentPath,
SourceGroupSettingsWithSourceExtensionsPython,
SourceGroupSettingsWithSourcePaths>
{
public:
SourceGroupSettingsPythonEmpty(const std::string& id, const ProjectSettings* projectSettings)
: SourceGroupSettingsWithComponents(SOURCE_GROUP_PYTHON_EMPTY, id, projectSettings)
{
}
std::shared_ptr<SourceGroupSettings> createCopy() const override
{
return std::make_shared<SourceGroupSettingsPythonEmpty>(*this);
}
};
#endif // SOURCE_GROUP_SETTINGS_PYTHON_EMPTY_H
+28 -7
View File
@@ -8,11 +8,13 @@
#include "SourceGroupSettingsCEmpty.h" #include "SourceGroupSettingsCEmpty.h"
#include "SourceGroupSettingsCppEmpty.h" #include "SourceGroupSettingsCppEmpty.h"
#include "SourceGroupSettingsWithCppStandard.h" #include "SourceGroupSettingsWithCppStandard.h"
#include "SourceGroupSettingsWithCStandard.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "TaskLambda.h" #include "TaskLambda.h"
#include "utility.h" #include "utility.h"
#include "utilitySourceGroupCxx.h" #include "utilitySourceGroupCxx.h"
SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx> settings) SourceGroupCxxEmpty::SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettings> settings)
: m_settings(settings) : m_settings(settings)
{ {
} }
@@ -85,8 +87,8 @@ std::shared_ptr<IndexerCommandProvider> SourceGroupCxxEmpty::getIndexerCommandPr
} }
std::vector<std::wstring> compilerFlags = getBaseCompilerFlags(); std::vector<std::wstring> compilerFlags = getBaseCompilerFlags();
utility::append(compilerFlags, m_settings->getCompilerFlags()); utility::append(compilerFlags, dynamic_cast<const SourceGroupSettingsWithCxxPathsAndFlags*>(m_settings.get())->getCompilerFlags());
utility::append(compilerFlags, utility::getIncludePchFlags(m_settings.get())); utility::append(compilerFlags, utility::getIncludePchFlags(dynamic_cast<const SourceGroupSettingsWithCxxPchOptions*>(m_settings.get())));
std::shared_ptr<CxxIndexerCommandProvider> provider = std::make_shared<CxxIndexerCommandProvider>(); std::shared_ptr<CxxIndexerCommandProvider> provider = std::make_shared<CxxIndexerCommandProvider>();
for (const FilePath& sourcePath: getAllSourceFilePaths()) for (const FilePath& sourcePath: getAllSourceFilePaths())
@@ -129,13 +131,15 @@ std::shared_ptr<Task> SourceGroupCxxEmpty::getPreIndexTask(
{ {
if (pchSettings->getUseCompilerFlags()) if (pchSettings->getUseCompilerFlags())
{ {
utility::append(compilerFlags, m_settings->getCompilerFlags()); utility::append(compilerFlags,
dynamic_cast<const SourceGroupSettingsWithCxxPathsAndFlags*>(m_settings.get())->getCompilerFlags());
} }
utility::append(compilerFlags, pchSettings->getPchFlags()); utility::append(compilerFlags, pchSettings->getPchFlags());
} }
return utility::createBuildPchTask(m_settings.get(), compilerFlags, storageProvider, dialogView); return utility::createBuildPchTask(dynamic_cast<const SourceGroupSettingsWithCxxPchOptions*>(
m_settings.get()), compilerFlags, storageProvider, dialogView);
} }
std::shared_ptr<SourceGroupSettings> SourceGroupCxxEmpty::getSourceGroupSettings() std::shared_ptr<SourceGroupSettings> SourceGroupCxxEmpty::getSourceGroupSettings()
@@ -189,6 +193,15 @@ std::vector<std::wstring> SourceGroupCxxEmpty::getBaseCompilerFlags() const
compilerFlags.push_back(L"c++"); compilerFlags.push_back(L"c++");
} }
const SourceGroupSettingsWithCxxPathsAndFlags* settingsCxx =
dynamic_cast<const SourceGroupSettingsWithCxxPathsAndFlags*>(m_settings.get());
if (!settingsCxx)
{
LOG_ERROR(L"Source group doesn't specify cxx headers and flags.");
return compilerFlags;
}
{ {
// Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files. // Add the source paths as HeaderSearchPaths as well, so clang will also look here when searching include files.
std::vector<FilePath> indexedDirectoryPaths; std::vector<FilePath> indexedDirectoryPaths;
@@ -201,11 +214,19 @@ std::vector<std::wstring> SourceGroupCxxEmpty::getBaseCompilerFlags() const
} }
utility::append(compilerFlags, IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths( utility::append(compilerFlags, IndexerCommandCxx::getCompilerFlagsForSystemHeaderSearchPaths(
utility::concat(indexedDirectoryPaths, utility::concat(m_settings->getHeaderSearchPathsExpandedAndAbsolute(), appSettings->getHeaderSearchPathsExpanded())))); utility::concat(indexedDirectoryPaths, utility::concat(
settingsCxx->getHeaderSearchPathsExpandedAndAbsolute(),
appSettings->getHeaderSearchPathsExpanded()
)))
);
} }
{ {
utility::append(compilerFlags, IndexerCommandCxx::getCompilerFlagsForFrameworkSearchPaths( utility::append(compilerFlags, IndexerCommandCxx::getCompilerFlagsForFrameworkSearchPaths(
utility::concat(m_settings->getFrameworkSearchPathsExpandedAndAbsolute(), appSettings->getFrameworkSearchPathsExpanded()))); utility::concat(
settingsCxx->getFrameworkSearchPathsExpandedAndAbsolute(),
appSettings->getFrameworkSearchPathsExpanded()
)
));
} }
return compilerFlags; return compilerFlags;
+4 -3
View File
@@ -8,10 +8,11 @@
class SourceGroupSettingsCxx; class SourceGroupSettingsCxx;
class SourceGroupCxxEmpty: public SourceGroup class SourceGroupCxxEmpty
: public SourceGroup
{ {
public: public:
SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxx> settings); SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettings> settings);
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override; std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
std::set<FilePath> getAllSourceFilePaths() const override; std::set<FilePath> getAllSourceFilePaths() const override;
@@ -25,7 +26,7 @@ private:
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override; std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
std::vector<std::wstring> getBaseCompilerFlags() const; std::vector<std::wstring> getBaseCompilerFlags() const;
std::shared_ptr<SourceGroupSettingsCxx> m_settings; std::shared_ptr<SourceGroupSettings> m_settings;
}; };
#endif // SOURCE_GROUP_CXX_EMPTY_H #endif // SOURCE_GROUP_CXX_EMPTY_H
+20 -29
View File
@@ -14,7 +14,6 @@
#include "logging.h" #include "logging.h"
#include "ParserClientImpl.h" #include "ParserClientImpl.h"
#include "SingleFrontendActionFactory.h" #include "SingleFrontendActionFactory.h"
#include "SourceGroupSettingsCxx.h"
#include "SourceGroupSettingsWithCxxPchOptions.h" #include "SourceGroupSettingsWithCxxPchOptions.h"
#include "StorageProvider.h" #include "StorageProvider.h"
#include "TaskLambda.h" #include "TaskLambda.h"
@@ -23,18 +22,13 @@
namespace utility namespace utility
{ {
std::shared_ptr<Task> createBuildPchTask( std::shared_ptr<Task> createBuildPchTask(
const SourceGroupSettingsCxx* settings, std::vector<std::wstring> compilerFlags, const SourceGroupSettingsWithCxxPchOptions* settings,
std::shared_ptr<StorageProvider> storageProvider, std::shared_ptr<DialogView> dialogView) std::vector<std::wstring> compilerFlags,
std::shared_ptr<StorageProvider> storageProvider,
std::shared_ptr<DialogView> dialogView)
{ {
const SourceGroupSettingsWithCxxPchOptions* pchSettings = FilePath pchInputFilePath = settings->getPchInputFilePathExpandedAndAbsolute();
dynamic_cast<const SourceGroupSettingsWithCxxPchOptions*>(settings); FilePath pchDependenciesDirectoryPath = settings->getPchDependenciesDirectoryPath();
if (!pchSettings)
{
return std::make_shared<TaskLambda>([](){});
}
FilePath pchInputFilePath = pchSettings->getPchInputFilePathExpandedAndAbsolute();
FilePath pchDependenciesDirectoryPath = pchSettings->getPchDependenciesDirectoryPath();
if (pchInputFilePath.empty() || pchDependenciesDirectoryPath.empty()) if (pchInputFilePath.empty() || pchDependenciesDirectoryPath.empty())
{ {
@@ -158,26 +152,23 @@ namespace utility
} }
} }
std::vector<std::wstring> getIncludePchFlags(const SourceGroupSettingsCxx* settings) std::vector<std::wstring> getIncludePchFlags(const SourceGroupSettingsWithCxxPchOptions* settings)
{ {
const SourceGroupSettingsWithCxxPchOptions* pchSettings = const FilePath pchInputFilePath = settings->getPchInputFilePathExpandedAndAbsolute();
dynamic_cast<const SourceGroupSettingsWithCxxPchOptions*>(settings); const FilePath pchDependenciesDirectoryPath = settings->getPchDependenciesDirectoryPath();
if (pchSettings)
{
const FilePath pchInputFilePath = pchSettings->getPchInputFilePathExpandedAndAbsolute();
const FilePath pchDependenciesDirectoryPath = pchSettings->getPchDependenciesDirectoryPath();
if (!pchInputFilePath.empty() && !pchDependenciesDirectoryPath.empty()) if (!pchInputFilePath.empty() && !pchDependenciesDirectoryPath.empty())
{ {
const FilePath pchOutputFilePath = const FilePath pchOutputFilePath =
pchDependenciesDirectoryPath.getConcatenated(pchInputFilePath.fileName()).replaceExtension(L"pch"); pchDependenciesDirectoryPath.getConcatenated(pchInputFilePath.fileName()).replaceExtension(L"pch");
return {
L"-fallow-pch-with-compiler-errors", return {
L"-include-pch", L"-fallow-pch-with-compiler-errors",
pchOutputFilePath.wstr() L"-include-pch",
}; pchOutputFilePath.wstr()
} };
} }
return {}; return {};
} }
} }
+7 -4
View File
@@ -12,20 +12,23 @@ namespace clang {
} }
class DialogView; class DialogView;
class SourceGroupSettingsCxx; class SourceGroupSettingsWithCxxPchOptions;
class StorageProvider; class StorageProvider;
class Task; class Task;
namespace utility namespace utility
{ {
std::shared_ptr<Task> createBuildPchTask( std::shared_ptr<Task> createBuildPchTask(
const SourceGroupSettingsCxx* settings, std::vector<std::wstring> compilerFlags, const SourceGroupSettingsWithCxxPchOptions* settings,
std::shared_ptr<StorageProvider> storageProvider, std::shared_ptr<DialogView> dialogView); std::vector<std::wstring> compilerFlags,
std::shared_ptr<StorageProvider> storageProvider,
std::shared_ptr<DialogView> dialogView);
bool containsIncludePchFlags(std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb); bool containsIncludePchFlags(std::shared_ptr<clang::tooling::JSONCompilationDatabase> cdb);
bool containsIncludePchFlag(const std::vector<std::string>& args); bool containsIncludePchFlag(const std::vector<std::string>& args);
std::vector<std::wstring> getWithRemoveIncludePchFlag(const std::vector<std::wstring>& args); std::vector<std::wstring> getWithRemoveIncludePchFlag(const std::vector<std::wstring>& args);
void removeIncludePchFlag(std::vector<std::wstring>& args); void removeIncludePchFlag(std::vector<std::wstring>& args);
std::vector<std::wstring> getIncludePchFlags(const SourceGroupSettingsCxx* settings); std::vector<std::wstring> getIncludePchFlags(const SourceGroupSettingsWithCxxPchOptions* settings);
} }
#endif // UTILITY_SOURCE_GROUP_CXX_H #endif // UTILITY_SOURCE_GROUP_CXX_H
@@ -93,7 +93,7 @@ namespace
return false; return false;
} }
void addMsvcCompatibilityFlagsOnDemand(std::shared_ptr<SourceGroupSettingsCxx> settings) void addMsvcCompatibilityFlagsOnDemand(std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> settings)
{ {
if (applicationSettingsContainVisualStudioHeaderSearchPaths()) if (applicationSettingsContainVisualStudioHeaderSearchPaths())
{ {
@@ -4,9 +4,13 @@
#include <QMessageBox> #include <QMessageBox>
#include "QtStringListBox.h" #include "QtStringListBox.h"
#include "SourceGroupSettingsCxx.h" #include "SourceGroupSettingsWithCxxPathsAndFlags.h"
QtProjectWizardContentFlags::QtProjectWizardContentFlags(std::shared_ptr<SourceGroupSettingsCxx> settings, QtProjectWizardWindow* window, bool indicateAsAdditional) QtProjectWizardContentFlags::QtProjectWizardContentFlags(
std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> settings,
QtProjectWizardWindow* window,
bool indicateAsAdditional
)
: QtProjectWizardContent(window) : QtProjectWizardContent(window)
, m_settings(settings) , m_settings(settings)
, m_indicateAsAdditional(indicateAsAdditional) , m_indicateAsAdditional(indicateAsAdditional)
@@ -4,7 +4,7 @@
#include "QtProjectWizardContent.h" #include "QtProjectWizardContent.h"
class QtStringListBox; class QtStringListBox;
class SourceGroupSettingsCxx; class SourceGroupSettingsWithCxxPathsAndFlags;
class QtProjectWizardContentFlags class QtProjectWizardContentFlags
: public QtProjectWizardContent : public QtProjectWizardContent
@@ -12,7 +12,11 @@ class QtProjectWizardContentFlags
Q_OBJECT Q_OBJECT
public: public:
QtProjectWizardContentFlags(std::shared_ptr<SourceGroupSettingsCxx> settings, QtProjectWizardWindow* window, bool indicateAsAdditional = false); QtProjectWizardContentFlags(
std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> settings,
QtProjectWizardWindow* window,
bool indicateAsAdditional = false
);
// QtProjectWizardContent implementation // QtProjectWizardContent implementation
virtual void populate(QGridLayout* layout, int& row) override; virtual void populate(QGridLayout* layout, int& row) override;
@@ -22,7 +26,7 @@ public:
virtual bool check() override; virtual bool check() override;
private: private:
std::shared_ptr<SourceGroupSettingsCxx> m_settings; std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> m_settings;
const bool m_indicateAsAdditional; const bool m_indicateAsAdditional;
QtStringListBox* m_list; QtStringListBox* m_list;
@@ -1,6 +1,7 @@
#include "QtProjectWizardContentPathsFrameworkSearch.h" #include "QtProjectWizardContentPathsFrameworkSearch.h"
#include "SourceGroupSettingsCxx.h" #include "SourceGroupSettings.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
QtProjectWizardContentPathsFrameworkSearch::QtProjectWizardContentPathsFrameworkSearch( QtProjectWizardContentPathsFrameworkSearch::QtProjectWizardContentPathsFrameworkSearch(
std::shared_ptr<SourceGroupSettings> settings, QtProjectWizardWindow* window, bool indicateAsAdditional std::shared_ptr<SourceGroupSettings> settings, QtProjectWizardWindow* window, bool indicateAsAdditional
@@ -18,7 +19,8 @@ QtProjectWizardContentPathsFrameworkSearch::QtProjectWizardContentPathsFramework
void QtProjectWizardContentPathsFrameworkSearch::load() void QtProjectWizardContentPathsFrameworkSearch::load()
{ {
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings); std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithCxxPathsAndFlags>(m_settings);
if (cxxSettings) if (cxxSettings)
{ {
m_list->setPaths(cxxSettings->getFrameworkSearchPaths()); m_list->setPaths(cxxSettings->getFrameworkSearchPaths());
@@ -27,7 +29,8 @@ void QtProjectWizardContentPathsFrameworkSearch::load()
void QtProjectWizardContentPathsFrameworkSearch::save() void QtProjectWizardContentPathsFrameworkSearch::save()
{ {
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings); std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithCxxPathsAndFlags>(m_settings);
if (cxxSettings) if (cxxSettings)
{ {
cxxSettings->setFrameworkSearchPaths(m_list->getPathsAsDisplayed()); cxxSettings->setFrameworkSearchPaths(m_list->getPathsAsDisplayed());
@@ -11,7 +11,8 @@
#include "QtPathListDialog.h" #include "QtPathListDialog.h"
#include "QtTextEditDialog.h" #include "QtTextEditDialog.h"
#include "ScopedFunctor.h" #include "ScopedFunctor.h"
#include "SourceGroupSettingsCxx.h" #include "SourceGroupSettings.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "SourceGroupSettingsWithExcludeFilters.h" #include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithSourceExtensions.h" #include "SourceGroupSettingsWithSourceExtensions.h"
#include "SourceGroupSettingsWithSourcePaths.h" #include "SourceGroupSettingsWithSourcePaths.h"
@@ -73,7 +74,8 @@ void QtProjectWizardContentPathsHeaderSearch::populate(QGridLayout* layout, int&
void QtProjectWizardContentPathsHeaderSearch::load() void QtProjectWizardContentPathsHeaderSearch::load()
{ {
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings); std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithCxxPathsAndFlags>(m_settings);
if (cxxSettings) if (cxxSettings)
{ {
m_list->setPaths(cxxSettings->getHeaderSearchPaths()); m_list->setPaths(cxxSettings->getHeaderSearchPaths());
@@ -82,7 +84,8 @@ void QtProjectWizardContentPathsHeaderSearch::load()
void QtProjectWizardContentPathsHeaderSearch::save() void QtProjectWizardContentPathsHeaderSearch::save()
{ {
std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings); std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsWithCxxPathsAndFlags>(m_settings);
if (cxxSettings) if (cxxSettings)
{ {
cxxSettings->setHeaderSearchPaths(m_list->getPathsAsDisplayed()); cxxSettings->setHeaderSearchPaths(m_list->getPathsAsDisplayed());
@@ -162,8 +165,8 @@ void QtProjectWizardContentPathsHeaderSearch::validateIncludesButtonClicked()
indexedFilePaths = pathSettings->getSourcePathsExpandedAndAbsolute(); indexedFilePaths = pathSettings->getSourcePathsExpandedAndAbsolute();
headerSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded(); headerSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded();
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = if (std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings)) std::dynamic_pointer_cast<SourceGroupSettingsWithCxxPathsAndFlags>(m_settings))
{ {
utility::append(headerSearchPaths, cxxSettings->getHeaderSearchPathsExpandedAndAbsolute()); utility::append(headerSearchPaths, cxxSettings->getHeaderSearchPathsExpandedAndAbsolute());
} }
@@ -232,8 +235,8 @@ void QtProjectWizardContentPathsHeaderSearch::finishedSelectDetectIncludesRootPa
sourceFilePaths = fileManager.getAllSourceFilePaths(); sourceFilePaths = fileManager.getAllSourceFilePaths();
headerSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded(); headerSearchPaths = ApplicationSettings::getInstance()->getHeaderSearchPathsExpanded();
if (std::shared_ptr<SourceGroupSettingsCxx> cxxSettings = if (std::shared_ptr<SourceGroupSettingsWithCxxPathsAndFlags> cxxSettings =
std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings)) std::dynamic_pointer_cast<SourceGroupSettingsWithCxxPathsAndFlags>(m_settings))
{ {
utility::append(headerSearchPaths, cxxSettings->getHeaderSearchPathsExpandedAndAbsolute()); utility::append(headerSearchPaths, cxxSettings->getHeaderSearchPathsExpandedAndAbsolute());
} }
@@ -4,10 +4,10 @@
#include "SourceGroupCxxEmpty.h" #include "SourceGroupCxxEmpty.h"
#include "SourceGroupJavaEmpty.h" #include "SourceGroupJavaEmpty.h"
#include "SourceGroupPythonEmpty.h" #include "SourceGroupPythonEmpty.h"
#include "SourceGroupSettingsCxx.h"
#include "SourceGroupSettingsCustomCommand.h" #include "SourceGroupSettingsCustomCommand.h"
#include "SourceGroupSettingsJavaEmpty.h" #include "SourceGroupSettingsJavaEmpty.h"
#include "SourceGroupSettingsPythonEmpty.h" #include "SourceGroupSettingsPythonEmpty.h"
#include "SourceGroupSettingsWithCxxPathsAndFlags.h"
#include "SourceGroupSettingsWithSourcePaths.h" #include "SourceGroupSettingsWithSourcePaths.h"
#include "utility.h" #include "utility.h"
#include "utilityFile.h" #include "utilityFile.h"
@@ -50,9 +50,9 @@ void QtProjectWizardContentPathsSource::save()
std::vector<FilePath> QtProjectWizardContentPathsSource::getFilePaths() const std::vector<FilePath> QtProjectWizardContentPathsSource::getFilePaths() const
{ {
std::set<FilePath> allSourceFilePaths; std::set<FilePath> allSourceFilePaths;
if (std::shared_ptr<SourceGroupSettingsCxx> settings = std::dynamic_pointer_cast<SourceGroupSettingsCxx>(m_settings)) if (std::dynamic_pointer_cast<SourceGroupSettingsWithCxxPathsAndFlags>(m_settings))
{ {
allSourceFilePaths = SourceGroupCxxEmpty(settings).getAllSourceFilePaths(); allSourceFilePaths = SourceGroupCxxEmpty(m_settings).getAllSourceFilePaths();
} }
else if (std::shared_ptr<SourceGroupSettingsJavaEmpty> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(m_settings)) else if (std::shared_ptr<SourceGroupSettingsJavaEmpty> settings = std::dynamic_pointer_cast<SourceGroupSettingsJavaEmpty>(m_settings))
{ {
+8 -14
View File
@@ -1,9 +1,12 @@
#include "SourceGroupJava.h" #include "SourceGroupJava.h"
#include "IndexerCommandJava.h" #include "IndexerCommandJava.h"
#include "SourceGroupSettingsJava.h"
#include "FileManager.h" #include "FileManager.h"
#include "logging.h" #include "logging.h"
#include "SourceGroupSettings.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithJavaStandard.h"
#include "SourceGroupSettingsWithSourceExtensions.h"
std::set<FilePath> SourceGroupJava::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const std::set<FilePath> SourceGroupJava::filterToContainedFilePaths(const std::set<FilePath>& filePaths) const
{ {
@@ -24,15 +27,16 @@ std::set<FilePath> SourceGroupJava::getAllSourceFilePaths() const
FileManager fileManager; FileManager fileManager;
fileManager.update( fileManager.update(
getAllSourcePaths(), getAllSourcePaths(),
getSourceGroupSettingsJava()->getExcludeFiltersExpandedAndAbsolute(), dynamic_cast<const SourceGroupSettingsWithExcludeFilters*>(getSourceGroupSettings().get())->getExcludeFiltersExpandedAndAbsolute(),
getSourceGroupSettingsJava()->getSourceExtensions() dynamic_cast<const SourceGroupSettingsWithSourceExtensions*>(getSourceGroupSettings().get())->getSourceExtensions()
); );
return fileManager.getAllSourceFilePaths(); return fileManager.getAllSourceFilePaths();
} }
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) const std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
{ {
const std::wstring languageStandard = getSourceGroupSettingsJava()->getJavaStandard(); const std::wstring languageStandard =
dynamic_cast<const SourceGroupSettingsWithJavaStandard*>(getSourceGroupSettings().get())->getJavaStandard();
std::vector<FilePath> classPath = getClassPath(); std::vector<FilePath> classPath = getClassPath();
@@ -50,16 +54,6 @@ std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands
return indexerCommands; return indexerCommands;
} }
std::shared_ptr<SourceGroupSettings> SourceGroupJava::getSourceGroupSettings()
{
return getSourceGroupSettingsJava();
}
std::shared_ptr<const SourceGroupSettings> SourceGroupJava::getSourceGroupSettings() const
{
return getSourceGroupSettingsJava();
}
std::vector<FilePath> SourceGroupJava::getClassPath() const std::vector<FilePath> SourceGroupJava::getClassPath() const
{ {
LOG_INFO("Retrieving classpath for indexer commands"); LOG_INFO("Retrieving classpath for indexer commands");
+2 -7
View File
@@ -7,9 +7,8 @@
#include "SourceGroup.h" #include "SourceGroup.h"
class SourceGroupSettingsJava; class SourceGroupJava
: public SourceGroup
class SourceGroupJava: public SourceGroup
{ {
public: public:
std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override; std::set<FilePath> filterToContainedFilePaths(const std::set<FilePath>& filePaths) const override;
@@ -19,10 +18,6 @@ public:
private: private:
virtual std::vector<FilePath> getAllSourcePaths() const = 0; virtual std::vector<FilePath> getAllSourcePaths() const = 0;
virtual std::vector<FilePath> doGetClassPath() const = 0; virtual std::vector<FilePath> doGetClassPath() const = 0;
virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava() = 0;
virtual std::shared_ptr<const SourceGroupSettingsJava> getSourceGroupSettingsJava() const = 0;
std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
std::vector<FilePath> getClassPath() const; std::vector<FilePath> getClassPath() const;
}; };
@@ -24,15 +24,16 @@ std::vector<FilePath> SourceGroupJavaEmpty::getAllSourcePaths() const
std::vector<FilePath> SourceGroupJavaEmpty::doGetClassPath() const std::vector<FilePath> SourceGroupJavaEmpty::doGetClassPath() const
{ {
return utility::getClassPath(m_settings->getClasspathExpandedAndAbsolute(), m_settings->getUseJreSystemLibrary(), getAllSourceFilePaths()); return utility::getClassPath(
m_settings->getClasspathExpandedAndAbsolute(), m_settings->getUseJreSystemLibrary(), getAllSourceFilePaths());
} }
std::shared_ptr<SourceGroupSettingsJava> SourceGroupJavaEmpty::getSourceGroupSettingsJava() std::shared_ptr<SourceGroupSettings> SourceGroupJavaEmpty::getSourceGroupSettings()
{ {
return m_settings; return m_settings;
} }
std::shared_ptr<const SourceGroupSettingsJava> SourceGroupJavaEmpty::getSourceGroupSettingsJava() const std::shared_ptr<const SourceGroupSettings> SourceGroupJavaEmpty::getSourceGroupSettings() const
{ {
return m_settings; return m_settings;
} }
+4 -3
View File
@@ -8,7 +8,8 @@
class SourceGroupSettingsJavaEmpty; class SourceGroupSettingsJavaEmpty;
class SourceGroupJavaEmpty: public SourceGroupJava class SourceGroupJavaEmpty
: public SourceGroupJava
{ {
public: public:
SourceGroupJavaEmpty(std::shared_ptr<SourceGroupSettingsJavaEmpty> settings); SourceGroupJavaEmpty(std::shared_ptr<SourceGroupSettingsJavaEmpty> settings);
@@ -17,8 +18,8 @@ public:
private: private:
std::vector<FilePath> getAllSourcePaths() const override; std::vector<FilePath> getAllSourcePaths() const override;
std::vector<FilePath> doGetClassPath() const override; std::vector<FilePath> doGetClassPath() const override;
std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava() override; std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
std::shared_ptr<const SourceGroupSettingsJava> getSourceGroupSettingsJava() const override; std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
std::shared_ptr<SourceGroupSettingsJavaEmpty> m_settings; std::shared_ptr<SourceGroupSettingsJavaEmpty> m_settings;
}; };
@@ -72,12 +72,12 @@ std::vector<FilePath> SourceGroupJavaGradle::doGetClassPath() const
return classPath; return classPath;
} }
std::shared_ptr<SourceGroupSettingsJava> SourceGroupJavaGradle::getSourceGroupSettingsJava() std::shared_ptr<SourceGroupSettings> SourceGroupJavaGradle::getSourceGroupSettings()
{ {
return m_settings; return m_settings;
} }
std::shared_ptr<const SourceGroupSettingsJava> SourceGroupJavaGradle::getSourceGroupSettingsJava() const std::shared_ptr<const SourceGroupSettings> SourceGroupJavaGradle::getSourceGroupSettings() const
{ {
return m_settings; return m_settings;
} }

Some files were not shown because too many files have changed in this diff Show More