src: Moved path prefilling to ApplicationSettingsPrefiller

* added subdirectory for all source group settings related files
This commit is contained in:
Eberhard Graether
2019-07-16 14:29:34 +02:00
parent 086c19f25e
commit 70febae55b
61 changed files with 239 additions and 195 deletions
@@ -0,0 +1,110 @@
#include "SourceGroupSettings.h"
#include "ConfigManager.h"
#include "ProjectSettings.h"
#include "utilityString.h"
const size_t SourceGroupSettings::s_version = 1;
const std::string SourceGroupSettings::s_keyPrefix = "source_groups/source_group_";
SourceGroupSettings::SourceGroupSettings(
const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings
)
: m_projectSettings(projectSettings)
, m_id(id)
, m_name(sourceGroupTypeToString(type))
, m_type(type)
, m_status(SOURCE_GROUP_STATUS_ENABLED)
{
}
void SourceGroupSettings::load(std::shared_ptr<const ConfigManager> config)
{
const std::string key = s_keyPrefix + getId();
const std::string name = config->getValueOrDefault<std::string>(key + "/name", "");
if (!name.empty())
{
setName(name);
}
setStatus(stringToSourceGroupStatusType(config->getValueOrDefault(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED))));
}
void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
{
const std::string key = s_keyPrefix + getId();
config->setValue(key + "/status", sourceGroupStatusTypeToString(getStatus()));
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
{
return m_id;
}
void SourceGroupSettings::setId(const std::string& id)
{
m_id = id;
}
SourceGroupType SourceGroupSettings::getType() const
{
return m_type;
}
LanguageType SourceGroupSettings::getLanguage() const
{
return getLanguageTypeForSourceGroupType(getType());
}
std::string SourceGroupSettings::getName() const
{
return m_name;
}
void SourceGroupSettings::setName(const std::string& name)
{
m_name = name;
}
SourceGroupStatusType SourceGroupSettings::getStatus() const
{
return m_status;
}
void SourceGroupSettings::setStatus(SourceGroupStatusType status)
{
m_status = status;
}
const ProjectSettings* SourceGroupSettings::getProjectSettings() const
{
return m_projectSettings;
}
FilePath SourceGroupSettings::getSourceGroupDependenciesDirectoryPath() const
{
return getProjectSettings()->getDependenciesDirectoryPath().concatenate(utility::decodeFromUtf8(getId()));
}
FilePath SourceGroupSettings::getProjectDirectoryPath() const
{
return m_projectSettings->getProjectDirectoryPath();
}
std::vector<FilePath> SourceGroupSettings::makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const
{
return m_projectSettings->makePathsExpandedAndAbsolute(paths);
}
@@ -0,0 +1,60 @@
#ifndef SOURCE_GROUP_SETTINGS_H
#define SOURCE_GROUP_SETTINGS_H
#include <memory>
#include <vector>
#include "LanguageType.h"
#include "SourceGroupSettingsBase.h"
#include "SourceGroupStatusType.h"
#include "SourceGroupType.h"
class ConfigManager;
class FilePath;
class SourceGroupSettings
: virtual public SourceGroupSettingsBase
{
public:
static const size_t s_version;
static const std::string s_keyPrefix;
SourceGroupSettings(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettings() = default;
virtual std::shared_ptr<SourceGroupSettings> createCopy() const = 0;
virtual void load(std::shared_ptr<const ConfigManager> config);
virtual void save(std::shared_ptr<ConfigManager> config);
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const;
std::string getId() const;
void setId(const std::string& id);
SourceGroupType getType() const;
LanguageType getLanguage() const;
std::string getName() const;
void setName(const std::string& name);
SourceGroupStatusType getStatus() const;
void setStatus(SourceGroupStatusType status);
const ProjectSettings* getProjectSettings() const override;
FilePath getSourceGroupDependenciesDirectoryPath() const override;
FilePath getProjectDirectoryPath() const;
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
protected:
const ProjectSettings* m_projectSettings;
private:
std::string m_id;
std::string m_name;
const SourceGroupType m_type;
SourceGroupStatusType m_status;
};
#endif // SOURCE_GROUP_SETTINGS_H
@@ -0,0 +1,16 @@
#ifndef SOURCE_GROUP_SETTINGS_BASE_H
#define SOURCE_GROUP_SETTINGS_BASE_H
class FilePath;
class ProjectSettings;
class SourceGroupSettingsBase
{
public:
virtual ~SourceGroupSettingsBase() = default;
virtual const ProjectSettings* getProjectSettings() const = 0;
virtual FilePath getSourceGroupDependenciesDirectoryPath() const = 0;
};
#endif // SOURCE_GROUP_SETTINGS_BASE_H
@@ -0,0 +1,60 @@
#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" };
}
@@ -0,0 +1,35 @@
#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
@@ -0,0 +1,64 @@
#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"
};
}
@@ -0,0 +1,35 @@
#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
@@ -0,0 +1,85 @@
#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 {};
}
@@ -0,0 +1,38 @@
#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
@@ -0,0 +1,88 @@
#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;
}
@@ -0,0 +1,36 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_H
#define SOURCE_GROUP_SETTINGS_CXX_H
#include "SourceGroupSettings.h"
#include "FilePath.h"
class SourceGroupSettingsCxx
: public SourceGroupSettings
{
public:
SourceGroupSettingsCxx(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;
std::vector<FilePath> getHeaderSearchPaths() const;
std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const;
void setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths);
std::vector<FilePath> getFrameworkSearchPaths() const;
std::vector<FilePath> getFrameworkSearchPathsExpandedAndAbsolute() const;
void setFrameworkSearchPaths(const std::vector<FilePath>& frameworkSearchPaths);
std::vector<std::wstring> getCompilerFlags() const;
void setCompilerFlags(const std::vector<std::wstring>& compilerFlags);
private:
std::vector<FilePath> m_headerSearchPaths;
std::vector<FilePath> m_frameworkSearchPaths;
std::vector<std::wstring> m_compilerFlags;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_H
@@ -0,0 +1,68 @@
#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();
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();
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) &&
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;
}
@@ -0,0 +1,32 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_CDB_H
#define SOURCE_GROUP_SETTINGS_CXX_CDB_H
#include "SourceGroupSettingsCxx.h"
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "FilePath.h"
class SourceGroupSettingsCxxCdb
: public SourceGroupSettingsCxx
, 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
@@ -0,0 +1,11 @@
#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);
}
@@ -0,0 +1,16 @@
#ifndef SOURCE_GROUP_SETTINGS_CXX_CDB_VS_H
#define SOURCE_GROUP_SETTINGS_CXX_CDB_VS_H
#include "SourceGroupSettingsCxxCdb.h"
#include "FilePath.h"
class SourceGroupSettingsCxxCdbVs
: public SourceGroupSettingsCxxCdb
{
public:
SourceGroupSettingsCxxCdbVs(const std::string& id, const ProjectSettings* projectSettings);
std::shared_ptr<SourceGroupSettings> createCopy() const override;
};
#endif // SOURCE_GROUP_SETTINGS_CXX_CDB_VS_H
@@ -0,0 +1,86 @@
#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"
};
}
@@ -0,0 +1,39 @@
#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
@@ -0,0 +1,46 @@
#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)
);
}
@@ -0,0 +1,26 @@
#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
@@ -0,0 +1,46 @@
#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" };
}
@@ -0,0 +1,30 @@
#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
@@ -0,0 +1,43 @@
#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)
);
}
@@ -0,0 +1,24 @@
#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
@@ -0,0 +1,79 @@
#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;
}
@@ -0,0 +1,34 @@
#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
@@ -0,0 +1,79 @@
#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;
}
@@ -0,0 +1,34 @@
#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
@@ -0,0 +1,46 @@
#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)
);
}
@@ -0,0 +1,26 @@
#ifndef SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
#define SOURCE_GROUP_SETTINGS_JAVA_SONARGRAPH_H
#include "SourceGroupSettings.h"
#include "SourceGroupSettingsWithClasspath.h"
#include "SourceGroupSettingsWithJavaStandard.h"
#include "SourceGroupSettingsWithSonargraphProjectPath.h"
class SourceGroupSettingsJavaSonargraph
: public SourceGroupSettings
, public SourceGroupSettingsWithClasspath
, public SourceGroupSettingsWithJavaStandard
, public SourceGroupSettingsWithSonargraphProjectPath
{
public:
SourceGroupSettingsJavaSonargraph(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_SONARGRAPH_H
@@ -0,0 +1,77 @@
#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"
};
}
@@ -0,0 +1,36 @@
#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,63 @@
#include "SourceGroupSettingsWithCStandard.h"
#include "ProjectSettings.h"
std::wstring SourceGroupSettingsWithCStandard::getDefaultCStandardStatic()
{
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
{
if (m_cStandard.empty())
{
return getDefaultCStandard();
}
return m_cStandard;
}
void SourceGroupSettingsWithCStandard::setCStandard(const std::wstring& standard)
{
m_cStandard = standard;
}
std::vector<std::wstring> SourceGroupSettingsWithCStandard::getAvailableCStandards() const
{
return {
L"c11",
L"gnu11",
L"iso9899:2011",
L"c99",
L"gnu99",
L"iso9899:1999",
L"iso9899:199409",
L"c90",
L"gnu90",
L"iso9899:1990",
L"c89",
L"gnu89"
};
}
std::wstring SourceGroupSettingsWithCStandard::getDefaultCStandard() const
{
return getDefaultCStandardStatic();
}
@@ -0,0 +1,38 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
#define SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
#include <memory>
#include <string>
#include <vector>
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class SourceGroupSettingsWithCStandard
: virtual public SourceGroupSettingsBase
{
public:
static std::wstring getDefaultCStandardStatic();
SourceGroupSettingsWithCStandard() = default;
virtual ~SourceGroupSettingsWithCStandard() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithCStandard> other) const;
std::wstring getCStandard() const;
void setCStandard(const std::wstring& standard);
std::vector<std::wstring> getAvailableCStandards() const;
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
std::wstring getDefaultCStandard() const;
std::wstring m_cStandard;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
@@ -0,0 +1,55 @@
#include "SourceGroupSettingsWithClasspath.h"
#include "ProjectSettings.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
{
return m_classpath;
}
std::vector<FilePath> SourceGroupSettingsWithClasspath::getClasspathExpandedAndAbsolute() const
{
return getProjectSettings()->makePathsExpandedAndAbsolute(getClasspath());
}
void SourceGroupSettingsWithClasspath::setClasspath(const std::vector<FilePath>& classpath)
{
m_classpath = classpath;
}
bool SourceGroupSettingsWithClasspath::getUseJreSystemLibrary() const
{
return m_useJreSystemLibrary;
}
void SourceGroupSettingsWithClasspath::setUseJreSystemLibrary(bool useJreSystemLibrary)
{
m_useJreSystemLibrary = useJreSystemLibrary;
}
@@ -0,0 +1,38 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H
#define SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H
#include <memory>
#include <string>
#include <vector>
#include "FilePath.h"
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class SourceGroupSettingsWithClasspath
: virtual public SourceGroupSettingsBase
{
public:
SourceGroupSettingsWithClasspath();
virtual ~SourceGroupSettingsWithClasspath() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithClasspath> other) const;
std::vector<FilePath> getClasspath() const;
std::vector<FilePath> getClasspathExpandedAndAbsolute() const;
void setClasspath(const std::vector<FilePath>& classpath);
bool getUseJreSystemLibrary() const;
void setUseJreSystemLibrary(bool useJreSystemLibrary);
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
std::vector<FilePath> m_classpath;
bool m_useJreSystemLibrary;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_CLASSPATH_H
@@ -0,0 +1,63 @@
#include "SourceGroupSettingsWithCppStandard.h"
#include "ProjectSettings.h"
std::wstring SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic()
{
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
{
if (m_cppStandard.empty())
{
return getDefaultCppStandard();
}
return m_cppStandard;
}
void SourceGroupSettingsWithCppStandard::setCppStandard(const std::wstring& standard)
{
m_cppStandard = standard;
}
std::vector<std::wstring> SourceGroupSettingsWithCppStandard::getAvailableCppStandards() const
{
return {
L"c++2a",
L"gnu++2a",
L"c++17",
L"gnu++17",
L"c++14",
L"gnu++14",
L"c++11",
L"gnu++11",
L"c++03",
L"gnu++03",
L"c++98",
L"gnu++98"
};
}
std::wstring SourceGroupSettingsWithCppStandard::getDefaultCppStandard() const
{
return getDefaultCppStandardStatic();
}
@@ -0,0 +1,38 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
#define SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
#include <memory>
#include <string>
#include <vector>
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class SourceGroupSettingsWithCppStandard
: virtual public SourceGroupSettingsBase
{
public:
static std::wstring getDefaultCppStandardStatic();
SourceGroupSettingsWithCppStandard() = default;
virtual ~SourceGroupSettingsWithCppStandard() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithCppStandard> other) const;
std::wstring getCppStandard() const;
void setCppStandard(const std::wstring& standard);
std::vector<std::wstring> getAvailableCppStandards() const;
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
std::wstring getDefaultCppStandard() const;
std::wstring m_cppStandard;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
@@ -0,0 +1,240 @@
#include "SourceGroupSettingsWithCxxCrossCompilationOptions.h"
#include "ProjectSettings.h"
std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableArchTypes()
{
return{
L"aarch64",
L"aarch64_be",
L"arm",
L"armeb",
L"avr",
L"bpfel",
L"bpfeb",
L"hexagon",
L"mips",
L"mipsel",
L"mips64",
L"mips64el",
L"msp430",
L"powerpc64",
L"powerpc64le",
L"powerpc",
L"r600",
L"amdgcn",
L"riscv32",
L"riscv64",
L"sparc",
L"sparcv9",
L"sparcel",
L"s390x",
L"tce",
L"tcele",
L"thumb",
L"thumbeb",
L"i386",
L"x86_64",
L"xcore",
L"nvptx",
L"nvptx64",
L"le32",
L"le64",
L"amdil",
L"amdil64",
L"hsail",
L"hsail64",
L"spir",
L"spir64",
L"kalimba",
L"lanai",
L"shave",
L"wasm32",
L"wasm64",
L"renderscript32",
L"renderscript64",
};
}
std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableVendorTypes()
{
return{
L"unknown",
L"apple",
L"pc",
L"scei",
L"bgp",
L"bgq",
L"fsl",
L"ibm",
L"img",
L"mti",
L"nvidia",
L"csr",
L"myriad",
L"amd",
L"mesa"
};
}
std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableOsTypes()
{
return{
L"unknown",
L"cloudabi",
L"darwin",
L"dragonfly",
L"freebsd",
L"fuchsia",
L"ios",
L"kfreebsd",
L"linux",
L"lv2",
L"macosx",
L"netbsd",
L"openbsd",
L"solaris",
L"windows",
L"haiku",
L"minix",
L"rtems",
L"nacl",
L"cnk",
L"bitrig",
L"aix",
L"cuda",
L"nvcl",
L"amdhsa",
L"ps4",
L"elfiamcu",
L"tvos",
L"watchos",
L"mesa3d",
L"contiki"
};
}
std::vector<std::wstring> SourceGroupSettingsWithCxxCrossCompilationOptions::getAvailableEnvironmentTypes()
{
return{
L"unknown",
L"gnu",
L"gnuabi64",
L"gnueabihf",
L"gnueabi",
L"gnux32",
L"code16",
L"eabi",
L"eabihf",
L"android",
L"musl",
L"musleabi",
L"musleabihf",
L"msvc",
L"itanium",
L"cygnus",
L"amdopencl",
L"coreclr",
L"opencl"
};
}
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
{
return m_targetOptionsEnabled;
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetOptionsEnabled(bool targetOptionsEnabled)
{
m_targetOptionsEnabled = targetOptionsEnabled;
}
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetArch() const
{
return m_targetArch;
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetArch(const std::wstring& arch)
{
m_targetArch = arch;
}
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetVendor() const
{
return m_targetVendor;
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetVendor(const std::wstring& vendor)
{
m_targetVendor = vendor;
}
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetSys() const
{
return m_targetSys;
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetSys(const std::wstring& sys)
{
m_targetSys = sys;
}
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetAbi() const
{
return m_targetAbi;
}
void SourceGroupSettingsWithCxxCrossCompilationOptions::setTargetAbi(const std::wstring& abi)
{
m_targetAbi = abi;
}
std::wstring SourceGroupSettingsWithCxxCrossCompilationOptions::getTargetFlag() const
{
std::wstring targetFlag = L"";
if (m_targetOptionsEnabled && !m_targetArch.empty())
{
targetFlag = L"--target=";
targetFlag += m_targetArch;
targetFlag += L"-" + (m_targetVendor.empty() ? L"unknown" : m_targetVendor);
targetFlag += L"-" + (m_targetSys.empty() ? L"unknown" : m_targetSys);
targetFlag += L"-" + (m_targetAbi.empty() ? L"unknown" : m_targetAbi);
}
return targetFlag;
}
@@ -0,0 +1,55 @@
#ifndef 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 "SourceGroupSettingsBase.h"
class ConfigManager;
class SourceGroupSettingsWithCxxCrossCompilationOptions
: virtual public SourceGroupSettingsBase
{
public:
static std::vector<std::wstring> getAvailableArchTypes();
static std::vector<std::wstring> getAvailableVendorTypes();
static std::vector<std::wstring> getAvailableOsTypes();
static std::vector<std::wstring> getAvailableEnvironmentTypes();
SourceGroupSettingsWithCxxCrossCompilationOptions();
virtual ~SourceGroupSettingsWithCxxCrossCompilationOptions() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithCxxCrossCompilationOptions> other) const;
bool getTargetOptionsEnabled() const;
void setTargetOptionsEnabled(bool targetOptionsEnabled);
std::wstring getTargetArch() const;
void setTargetArch(const std::wstring& arch);
std::wstring getTargetVendor() const;
void setTargetVendor(const std::wstring& vendor);
std::wstring getTargetSys() const;
void setTargetSys(const std::wstring& sys);
std::wstring getTargetAbi() const;
void setTargetAbi(const std::wstring& abi);
std::wstring getTargetFlag() const;
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
bool m_targetOptionsEnabled;
std::wstring m_targetArch;
std::wstring m_targetVendor;
std::wstring m_targetSys;
std::wstring m_targetAbi;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_CXX_CROSS_COMPILATION_OPTIONS_H
@@ -0,0 +1,42 @@
#include "SourceGroupSettingsWithCxxPchOptions.h"
#include "ProjectSettings.h"
#include "utilityFile.h"
bool SourceGroupSettingsWithCxxPchOptions::equals(std::shared_ptr<SourceGroupSettingsWithCxxPchOptions> other) const
{
return (
other &&
m_pchInputFilePath == other->m_pchInputFilePath
);
}
void SourceGroupSettingsWithCxxPchOptions::load(std::shared_ptr<const ConfigManager> config, const std::string& key)
{
setPchInputFilePathFilePath(config->getValueOrDefault(key + "/pch_input_file_path", FilePath(L"")));
}
void SourceGroupSettingsWithCxxPchOptions::save(std::shared_ptr<ConfigManager> config, const std::string& key)
{
config->setValue(key + "/pch_input_file_path", getPchInputFilePath().wstr());
}
FilePath SourceGroupSettingsWithCxxPchOptions::getPchDependenciesDirectoryPath() const
{
return getSourceGroupDependenciesDirectoryPath().concatenate(L"pch");
}
FilePath SourceGroupSettingsWithCxxPchOptions::getPchInputFilePath() const
{
return m_pchInputFilePath;
}
FilePath SourceGroupSettingsWithCxxPchOptions::getPchInputFilePathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getPchInputFilePath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsWithCxxPchOptions::setPchInputFilePathFilePath(const FilePath& path)
{
m_pchInputFilePath = path;
}
@@ -0,0 +1,35 @@
#ifndef 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 "SourceGroupSettingsBase.h"
class ConfigManager;
class SourceGroupSettingsWithCxxPchOptions
: virtual public SourceGroupSettingsBase
{
public:
SourceGroupSettingsWithCxxPchOptions() = default;
virtual ~SourceGroupSettingsWithCxxPchOptions() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithCxxPchOptions> other) const;
FilePath getPchDependenciesDirectoryPath() const;
FilePath getPchInputFilePath() const;
FilePath getPchInputFilePathExpandedAndAbsolute() const;
void setPchInputFilePathFilePath(const FilePath& path);
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
FilePath m_pchInputFilePath;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_CXX_PCH_OPTIONS_H
@@ -0,0 +1,106 @@
#include "SourceGroupSettingsWithExcludeFilters.h"
#include "ProjectSettings.h"
#include "FilePathFilter.h"
#include "FileSystem.h"
#include "utility.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
{
return m_excludeFilters;
}
std::vector<FilePathFilter> SourceGroupSettingsWithExcludeFilters::getExcludeFiltersExpandedAndAbsolute() const
{
return getFiltersExpandedAndAbsolute(getExcludeFilterStrings());
}
void SourceGroupSettingsWithExcludeFilters::setExcludeFilterStrings(const std::vector<std::wstring>& excludeFilters)
{
m_excludeFilters = excludeFilters;
}
std::vector<FilePathFilter> SourceGroupSettingsWithExcludeFilters::getFiltersExpandedAndAbsolute(const std::vector<std::wstring>& filterStrings) const
{
const FilePath projectDirectoryPath = getProjectSettings()->getProjectDirectoryPath();
std::vector<FilePathFilter> result;
for (const std::wstring& filterString : filterStrings)
{
if (!filterString.empty())
{
const size_t wildcardPos = filterString.find(L"*");
if (wildcardPos != filterString.npos)
{
std::wsmatch match;
if (std::regex_search(filterString, match, std::wregex(L"[\\\\/]")) && !match.empty() &&
match.position(0) < int(wildcardPos))
{
const FilePath p = utility::getExpandedAndAbsolutePath(FilePath(match.prefix().str()), projectDirectoryPath);
std::set<FilePath> symLinkPaths = FileSystem::getSymLinkedDirectories(p);
symLinkPaths.insert(p);
utility::append(result,
utility::convert<FilePath, FilePathFilter>(
utility::toVector(symLinkPaths),
[match](const FilePath& filePath)
{
return FilePathFilter(filePath.wstr() + L"/" + match.suffix().str());
}
)
);
}
else
{
result.push_back(FilePathFilter(filterString));
}
}
else
{
const FilePath p = utility::getExpandedAndAbsolutePath(FilePath(filterString), projectDirectoryPath);
const bool isFile = p.exists() && !p.isDirectory();
std::set<FilePath> symLinkPaths = FileSystem::getSymLinkedDirectories(p);
symLinkPaths.insert(p);
utility::append(result,
utility::convert<FilePath, FilePathFilter>
(
utility::toVector(symLinkPaths),
[isFile](const FilePath& filePath)
{
return FilePathFilter(filePath.wstr() + (isFile ? L"" : L"**"));
}
)
);
}
}
}
return result;
}
@@ -0,0 +1,36 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_EXCLUDE_FILTERS_H
#define SOURCE_GROUP_SETTINGS_WITH_EXCLUDE_FILTERS_H
#include <memory>
#include <string>
#include <vector>
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class FilePathFilter;
class SourceGroupSettingsWithExcludeFilters
: virtual public SourceGroupSettingsBase
{
public:
SourceGroupSettingsWithExcludeFilters();
virtual ~SourceGroupSettingsWithExcludeFilters() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithExcludeFilters> other) const;
std::vector<std::wstring> getExcludeFilterStrings() const;
std::vector<FilePathFilter> getExcludeFiltersExpandedAndAbsolute() const;
void setExcludeFilterStrings(const std::vector<std::wstring>& excludeFilters);
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
std::vector<FilePathFilter> getFiltersExpandedAndAbsolute(const std::vector<std::wstring>& filterStrings) const;
std::vector<std::wstring> m_excludeFilters;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_EXCLUDE_FILTERS_H
@@ -0,0 +1,41 @@
#include "SourceGroupSettingsWithIndexedHeaderPaths.h"
#include "ProjectSettings.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
{
return m_indexedHeaderPaths;
}
std::vector<FilePath> SourceGroupSettingsWithIndexedHeaderPaths::getIndexedHeaderPathsExpandedAndAbsolute() const
{
return getProjectSettings()->makePathsExpandedAndAbsolute(getIndexedHeaderPaths());
}
void SourceGroupSettingsWithIndexedHeaderPaths::setIndexedHeaderPaths(const std::vector<FilePath>& indexedHeaderPaths)
{
m_indexedHeaderPaths = indexedHeaderPaths;
}
@@ -0,0 +1,34 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_INDEXED_HEADER_PATHS_H
#define SOURCE_GROUP_SETTINGS_WITH_INDEXED_HEADER_PATHS_H
#include <memory>
#include <string>
#include <vector>
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class FilePath;
class SourceGroupSettingsWithIndexedHeaderPaths
: virtual public SourceGroupSettingsBase
{
public:
SourceGroupSettingsWithIndexedHeaderPaths();
virtual ~SourceGroupSettingsWithIndexedHeaderPaths() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithIndexedHeaderPaths> other) const;
std::vector<FilePath> getIndexedHeaderPaths() const;
std::vector<FilePath> getIndexedHeaderPathsExpandedAndAbsolute() const;
void setIndexedHeaderPaths(const std::vector<FilePath>& indexedHeaderPaths);
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
std::vector<FilePath> m_indexedHeaderPaths;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_INDEXED_HEADER_PATHS_H
@@ -0,0 +1,50 @@
#include "SourceGroupSettingsWithJavaStandard.h"
#include "ProjectSettings.h"
std::wstring SourceGroupSettingsWithJavaStandard::getDefaultJavaStandardStatic()
{
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
{
if (m_javaStandard.empty())
{
return getDefaultJavaStandard();
}
return m_javaStandard;
}
void SourceGroupSettingsWithJavaStandard::setJavaStandard(const std::wstring& standard)
{
m_javaStandard = standard;
}
std::vector<std::wstring> SourceGroupSettingsWithJavaStandard::getAvailableJavaStandards() const
{
return {L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9", L"10"};
}
std::wstring SourceGroupSettingsWithJavaStandard::getDefaultJavaStandard() const
{
return getDefaultJavaStandardStatic();
}
@@ -0,0 +1,38 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
#define SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
#include <memory>
#include <string>
#include <vector>
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class SourceGroupSettingsWithJavaStandard
: virtual public SourceGroupSettingsBase
{
public:
static std::wstring getDefaultJavaStandardStatic();
SourceGroupSettingsWithJavaStandard() = default;
virtual ~SourceGroupSettingsWithJavaStandard() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithJavaStandard> other) const;
std::wstring getJavaStandard() const;
void setJavaStandard(const std::wstring& standard);
std::vector<std::wstring> getAvailableJavaStandards() const;
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
std::wstring getDefaultJavaStandard() const;
std::wstring m_javaStandard;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
@@ -0,0 +1,41 @@
#include "SourceGroupSettingsWithSonargraphProjectPath.h"
#include "ProjectSettings.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
{
return m_sonargraphProjectPath;
}
FilePath SourceGroupSettingsWithSonargraphProjectPath::getSonargraphProjectPathExpandedAndAbsolute() const
{
return utility::getExpandedAndAbsolutePath(getSonargraphProjectPath(), getProjectSettings()->getProjectDirectoryPath());
}
void SourceGroupSettingsWithSonargraphProjectPath::setSonargraphProjectPath(const FilePath& sonargraphProjectPath)
{
m_sonargraphProjectPath = sonargraphProjectPath;
}
@@ -0,0 +1,33 @@
#ifndef 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"
class ConfigManager;
class SourceGroupSettingsWithSonargraphProjectPath
: virtual public SourceGroupSettingsBase
{
public:
SourceGroupSettingsWithSonargraphProjectPath();
virtual ~SourceGroupSettingsWithSonargraphProjectPath() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithSonargraphProjectPath> other) const;
FilePath getSonargraphProjectPath() const;
FilePath getSonargraphProjectPathExpandedAndAbsolute() const;
void setSonargraphProjectPath(const FilePath& sonargraphProjectPath);
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
FilePath m_sonargraphProjectPath;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SONARGRAPH_PROJECT_PATH_H
@@ -0,0 +1,38 @@
#include "SourceGroupSettingsWithSourceExtensions.h"
#include "ProjectSettings.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
{
if (m_sourceExtensions.empty())
{
return getDefaultSourceExtensions();
}
return m_sourceExtensions;
}
void SourceGroupSettingsWithSourceExtensions::setSourceExtensions(const std::vector<std::wstring>& sourceExtensions)
{
m_sourceExtensions = sourceExtensions;
}
@@ -0,0 +1,35 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
#include <memory>
#include <string>
#include <vector>
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class FilePath;
class SourceGroupSettingsWithSourceExtensions
: virtual public SourceGroupSettingsBase
{
public:
SourceGroupSettingsWithSourceExtensions();
virtual ~SourceGroupSettingsWithSourceExtensions() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithSourceExtensions> other) const;
std::vector<std::wstring> getSourceExtensions() const;
void setSourceExtensions(const std::vector<std::wstring>& sourceExtensions);
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0;
std::vector<std::wstring> m_sourceExtensions;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
@@ -0,0 +1,39 @@
#include "SourceGroupSettingsWithSourcePaths.h"
#include "ProjectSettings.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
{
return m_sourcePaths;
}
std::vector<FilePath> SourceGroupSettingsWithSourcePaths::getSourcePathsExpandedAndAbsolute() const
{
return getProjectSettings()->makePathsExpandedAndAbsolute(getSourcePaths());
}
void SourceGroupSettingsWithSourcePaths::setSourcePaths(const std::vector<FilePath>& sourcePaths)
{
m_sourcePaths = sourcePaths;
}
@@ -0,0 +1,34 @@
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H
#include <memory>
#include <string>
#include <vector>
#include "SourceGroupSettingsBase.h"
class ConfigManager;
class FilePath;
class SourceGroupSettingsWithSourcePaths
: virtual public SourceGroupSettingsBase
{
public:
SourceGroupSettingsWithSourcePaths();
virtual ~SourceGroupSettingsWithSourcePaths() = default;
bool equals(std::shared_ptr<SourceGroupSettingsWithSourcePaths> other) const;
std::vector<FilePath> getSourcePaths() const;
std::vector<FilePath> getSourcePathsExpandedAndAbsolute() const;
void setSourcePaths(const std::vector<FilePath>& sourcePaths);
protected:
void load(std::shared_ptr<const ConfigManager> config, const std::string& key);
void save(std::shared_ptr<ConfigManager> config, const std::string& key);
private:
std::vector<FilePath> m_sourcePaths;
};
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H
@@ -0,0 +1,31 @@
#include "SourceGroupStatusType.h"
#include "logging.h"
std::string sourceGroupStatusTypeToString(SourceGroupStatusType v)
{
switch (v)
{
case SOURCE_GROUP_STATUS_ENABLED:
return "enabled";
case SOURCE_GROUP_STATUS_DISABLED:
return "disabled";
}
LOG_WARNING("Trying to convert unknown Source Group status type to string, falling back to disabled status.");
return "disabled";
}
SourceGroupStatusType stringToSourceGroupStatusType(std::string v)
{
if (v == sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED))
{
return SOURCE_GROUP_STATUS_ENABLED;
}
else if (v == sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_DISABLED))
{
return SOURCE_GROUP_STATUS_DISABLED;
}
LOG_WARNING("Trying to convert unknown string to Source Group status type, falling back to disabled status.");
return SOURCE_GROUP_STATUS_DISABLED;
}
@@ -0,0 +1,15 @@
#ifndef SOURCE_GROUP_STATUS_TYPE_H
#define SOURCE_GROUP_STATUS_TYPE_H
#include <string>
enum SourceGroupStatusType
{
SOURCE_GROUP_STATUS_ENABLED,
SOURCE_GROUP_STATUS_DISABLED
};
std::string sourceGroupStatusTypeToString(SourceGroupStatusType v);
SourceGroupStatusType stringToSourceGroupStatusType(std::string v);
#endif // SOURCE_GROUP_STATUS_TYPE_H
@@ -0,0 +1,123 @@
#include "SourceGroupType.h"
std::string sourceGroupTypeToString(SourceGroupType v)
{
switch (v)
{
case SOURCE_GROUP_C_EMPTY:
return "C Source Group";
case SOURCE_GROUP_CPP_EMPTY:
return "C++ Source Group";
case SOURCE_GROUP_CXX_CDB:
return "C/C++ from Compilation Database";
case SOURCE_GROUP_CXX_CODEBLOCKS:
return "C/C++ from Code::Blocks";
case SOURCE_GROUP_CXX_SONARGRAPH:
return "C/C++ from Sonargraph";
case SOURCE_GROUP_CXX_VS:
return "C/C++ from Visual Studio";
case SOURCE_GROUP_JAVA_EMPTY:
return "Java Source Group";
case SOURCE_GROUP_JAVA_MAVEN:
return "Java Source Group from Maven";
case SOURCE_GROUP_JAVA_GRADLE:
return "Java Source Group from Gradle";
case SOURCE_GROUP_JAVA_SONARGRAPH:
return "Java from Sonargraph";
case SOURCE_GROUP_PYTHON_EMPTY:
return "Python Source Group";
case SOURCE_GROUP_CUSTOM_COMMAND:
return "Custom Command Source Group";
case SOURCE_GROUP_UNKNOWN:
break;
}
return "unknown";
}
std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
{
switch (v)
{
case SOURCE_GROUP_C_EMPTY:
return "Empty C Source Group";
case SOURCE_GROUP_CPP_EMPTY:
return "Empty C++ Source Group";
case SOURCE_GROUP_CXX_CDB:
return "C/C++ from Compilation Database";
case SOURCE_GROUP_CXX_CODEBLOCKS:
return "C/C++ from Code::Blocks";
case SOURCE_GROUP_CXX_SONARGRAPH:
return "C/C++ from Sonargraph";
case SOURCE_GROUP_CXX_VS:
return "C/C++ from Visual Studio";
case SOURCE_GROUP_JAVA_EMPTY:
return "Empty Java Source Group";
case SOURCE_GROUP_JAVA_MAVEN:
return "Java Source Group from Maven";
case SOURCE_GROUP_JAVA_GRADLE:
return "Java Source Group from Gradle";
case SOURCE_GROUP_JAVA_SONARGRAPH:
return "Java from Sonargraph";
case SOURCE_GROUP_PYTHON_EMPTY:
return "Empty Python Source Group";
case SOURCE_GROUP_CUSTOM_COMMAND:
return "Custom Command Source Group";
case SOURCE_GROUP_UNKNOWN:
break;
}
return "unknown";
}
SourceGroupType stringToSourceGroupType(const std::string& v)
{
if (v == sourceGroupTypeToString(SOURCE_GROUP_C_EMPTY))
{
return SOURCE_GROUP_C_EMPTY;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CPP_EMPTY))
{
return SOURCE_GROUP_CPP_EMPTY;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CXX_CDB))
{
return SOURCE_GROUP_CXX_CDB;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CXX_CODEBLOCKS))
{
return SOURCE_GROUP_CXX_CODEBLOCKS;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CXX_SONARGRAPH))
{
return SOURCE_GROUP_CXX_SONARGRAPH;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CXX_VS))
{
return SOURCE_GROUP_CXX_VS;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_JAVA_EMPTY))
{
return SOURCE_GROUP_JAVA_EMPTY;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_JAVA_MAVEN))
{
return SOURCE_GROUP_JAVA_MAVEN;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_JAVA_GRADLE))
{
return SOURCE_GROUP_JAVA_GRADLE;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_JAVA_SONARGRAPH))
{
return SOURCE_GROUP_JAVA_SONARGRAPH;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_PYTHON_EMPTY))
{
return SOURCE_GROUP_PYTHON_EMPTY;
}
else if (v == sourceGroupTypeToString(SOURCE_GROUP_CUSTOM_COMMAND))
{
return SOURCE_GROUP_CUSTOM_COMMAND;
}
return SOURCE_GROUP_UNKNOWN;
}
@@ -0,0 +1,27 @@
#ifndef SOURCE_GROUP_TYPE_H
#define SOURCE_GROUP_TYPE_H
#include <string>
enum SourceGroupType
{
SOURCE_GROUP_C_EMPTY,
SOURCE_GROUP_CPP_EMPTY,
SOURCE_GROUP_CXX_CDB,
SOURCE_GROUP_CXX_CODEBLOCKS,
SOURCE_GROUP_CXX_SONARGRAPH,
SOURCE_GROUP_CXX_VS,
SOURCE_GROUP_JAVA_EMPTY,
SOURCE_GROUP_JAVA_MAVEN,
SOURCE_GROUP_JAVA_GRADLE,
SOURCE_GROUP_JAVA_SONARGRAPH,
SOURCE_GROUP_PYTHON_EMPTY,
SOURCE_GROUP_CUSTOM_COMMAND,
SOURCE_GROUP_UNKNOWN
};
std::string sourceGroupTypeToString(SourceGroupType v);
std::string sourceGroupTypeToProjectSetupString(SourceGroupType v);
SourceGroupType stringToSourceGroupType(const std::string& v);
#endif // SOURCE_GROUP_TYPE_H