logic: added C/C++ project setup from Code::Blocks
* also changed xml elements in sourcegroup settings that specify the used language standard, so that one sourcegroup can maintain multiple language standards * added migration and migrated sample projects
This commit is contained in:
@@ -43,6 +43,8 @@ LanguageType getLanguageTypeForSourceGroupType(SourceGroupType t)
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return LANGUAGE_CPP;
|
||||
case SOURCE_GROUP_CXX_VS:
|
||||
|
||||
@@ -3,8 +3,10 @@
|
||||
#include "settings/migration/SettingsMigrationDeleteKey.h"
|
||||
#include "settings/migration/SettingsMigrationLambda.h"
|
||||
#include "settings/migration/SettingsMigrationMoveKey.h"
|
||||
#include "settings/SourceGroupSettingsCEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCppEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCxxCdb.h"
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
#include "settings/SourceGroupSettingsCxxSonargraph.h"
|
||||
#include "settings/SourceGroupSettingsJavaEmpty.h"
|
||||
#include "settings/SourceGroupSettingsJavaMaven.h"
|
||||
@@ -14,7 +16,7 @@
|
||||
#include "utility/utilityString.h"
|
||||
#include "utility/utilityUuid.h"
|
||||
|
||||
const size_t ProjectSettings::VERSION = 6;
|
||||
const size_t ProjectSettings::VERSION = 7;
|
||||
const wchar_t PROJECT_FILE_EXTENSION[] = L".srctrlprj";
|
||||
|
||||
LanguageType ProjectSettings::getLanguageOfProject(const FilePath& filePath)
|
||||
@@ -144,14 +146,17 @@ std::vector<std::shared_ptr<SourceGroupSettings>> ProjectSettings::getAllSourceG
|
||||
switch (type)
|
||||
{
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxEmpty>(id, SOURCE_GROUP_C_EMPTY, this);
|
||||
settings = std::make_shared<SourceGroupSettingsCEmpty>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxEmpty>(id, SOURCE_GROUP_CPP_EMPTY, this);
|
||||
settings = std::make_shared<SourceGroupSettingsCppEmpty>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxCdb>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_CODEBLOCKS:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxCodeblocks>(id, this);
|
||||
break;
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
settings = std::make_shared<SourceGroupSettingsCxxSonargraph>(id, this);
|
||||
break;
|
||||
@@ -337,6 +342,26 @@ SettingsMigrator ProjectSettings::getMigrations() const
|
||||
}
|
||||
}
|
||||
|
||||
for (std::shared_ptr<SourceGroupSettings> sourceGroupSettings : getAllSourceGroupSettings())
|
||||
{
|
||||
std::string languageName;
|
||||
switch (getLanguageTypeForSourceGroupType(sourceGroupSettings->getType()))
|
||||
{
|
||||
case LANGUAGE_C:
|
||||
languageName = "c";
|
||||
break;
|
||||
case LANGUAGE_CPP:
|
||||
languageName = "cpp";
|
||||
break;
|
||||
case LANGUAGE_JAVA:
|
||||
languageName = "java";
|
||||
break;
|
||||
}
|
||||
|
||||
std::string key = SourceGroupSettings::s_keyPrefix + sourceGroupSettings->getId();
|
||||
migrator.addMigration(7, std::make_shared<SettingsMigrationMoveKey>(key + "/standard", key + "/" + languageName + "_standard"));
|
||||
}
|
||||
|
||||
return migrator;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ SourceGroupSettings::SourceGroupSettings(
|
||||
, m_name(sourceGroupTypeToString(type))
|
||||
, m_type(type)
|
||||
, m_status(SOURCE_GROUP_STATUS_ENABLED)
|
||||
, m_standard("")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -29,7 +28,6 @@ void SourceGroupSettings::load(std::shared_ptr<const ConfigManager> config)
|
||||
}
|
||||
|
||||
setStatus(stringToSourceGroupStatusType(config->getValueOrDefault(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED))));
|
||||
setStandard(config->getValueOrDefault<std::string>(key + "/standard", ""));
|
||||
}
|
||||
|
||||
void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
|
||||
@@ -38,7 +36,6 @@ void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
config->setValue(key + "/status", sourceGroupStatusTypeToString(getStatus()));
|
||||
config->setValue(key + "/name", getName());
|
||||
config->setValue(key + "/standard", getStandard());
|
||||
}
|
||||
|
||||
bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) const
|
||||
@@ -47,8 +44,7 @@ bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) con
|
||||
m_id == other->m_id &&
|
||||
m_name == other->m_name &&
|
||||
m_type == other->m_type &&
|
||||
m_status == other->m_status &&
|
||||
m_standard == other->m_standard
|
||||
m_status == other->m_status
|
||||
);
|
||||
}
|
||||
|
||||
@@ -106,17 +102,3 @@ std::vector<FilePath> SourceGroupSettings::makePathsExpandedAndAbsolute(const st
|
||||
{
|
||||
return m_projectSettings->makePathsExpandedAndAbsolute(paths);
|
||||
}
|
||||
|
||||
std::string SourceGroupSettings::getStandard() const
|
||||
{
|
||||
if (m_standard.empty())
|
||||
{
|
||||
return getDefaultStandard();
|
||||
}
|
||||
return m_standard;
|
||||
}
|
||||
|
||||
void SourceGroupSettings::setStandard(const std::string& standard)
|
||||
{
|
||||
m_standard = standard;
|
||||
}
|
||||
|
||||
@@ -42,23 +42,14 @@ public:
|
||||
FilePath makePathExpandedAndAbsolute(const FilePath& path) const;
|
||||
std::vector<FilePath> makePathsExpandedAndAbsolute(const std::vector<FilePath>& paths) const;
|
||||
|
||||
virtual std::vector<std::string> getAvailableLanguageStandards() const = 0;
|
||||
|
||||
std::string getStandard() const;
|
||||
void setStandard(const std::string& standard);
|
||||
|
||||
protected:
|
||||
const ProjectSettings* m_projectSettings;
|
||||
|
||||
private:
|
||||
virtual std::string getDefaultStandard() const = 0;
|
||||
|
||||
std::string m_id;
|
||||
std::string m_name;
|
||||
const SourceGroupType m_type;
|
||||
SourceGroupStatusType m_status;
|
||||
|
||||
std::string m_standard;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_H
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
#include "settings/SourceGroupSettingsCEmpty.h"
|
||||
|
||||
SourceGroupSettingsCEmpty::SourceGroupSettingsCEmpty(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettingsCxxEmpty(id, SOURCE_GROUP_C_EMPTY, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCEmpty::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxxEmpty::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCStandard::load(config, key);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCEmpty::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxxEmpty::save(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCStandard::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 &&
|
||||
SourceGroupSettingsCxxEmpty::equals(other) &&
|
||||
SourceGroupSettingsWithCStandard::equals(otherCxxEmpty)
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
return { L".c" };
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_C_EMPTY_H
|
||||
#define SOURCE_GROUP_SETTINGS_C_EMPTY_H
|
||||
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
|
||||
class SourceGroupSettingsCEmpty
|
||||
: public SourceGroupSettingsCxxEmpty
|
||||
, public SourceGroupSettingsWithCStandard
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsCEmpty(const std::string& id, 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:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_C_EMPTY_H
|
||||
@@ -0,0 +1,49 @@
|
||||
#include "settings/SourceGroupSettingsCppEmpty.h"
|
||||
|
||||
SourceGroupSettingsCppEmpty::SourceGroupSettingsCppEmpty(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettingsCxxEmpty(id, SOURCE_GROUP_CPP_EMPTY, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCppEmpty::load(std::shared_ptr<const ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxxEmpty::load(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::load(config, key);
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCppEmpty::save(std::shared_ptr<ConfigManager> config)
|
||||
{
|
||||
SourceGroupSettingsCxxEmpty::save(config);
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::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 &&
|
||||
SourceGroupSettingsCxxEmpty::equals(other) &&
|
||||
SourceGroupSettingsWithCppStandard::equals(otherCxxEmpty)
|
||||
);
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCppEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCppEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {
|
||||
L".cpp",
|
||||
L".cxx",
|
||||
L".cc"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
|
||||
#define SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
|
||||
|
||||
#include "settings/SourceGroupSettingsCxxEmpty.h"
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
|
||||
class SourceGroupSettingsCppEmpty
|
||||
: public SourceGroupSettingsCxxEmpty
|
||||
, public SourceGroupSettingsWithCppStandard
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsCppEmpty(const std::string& id, 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:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_CPP_EMPTY_H
|
||||
@@ -47,60 +47,6 @@ bool SourceGroupSettingsCxx::equals(std::shared_ptr<SourceGroupSettings> other)
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsCxx::getAvailableLanguageStandards() const
|
||||
{
|
||||
std::vector<std::string> standards;
|
||||
|
||||
switch (getType())
|
||||
{
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
standards.push_back("c++2a");
|
||||
standards.push_back("gnu++2a");
|
||||
|
||||
standards.push_back("c++17");
|
||||
standards.push_back("gnu++17");
|
||||
|
||||
standards.push_back("c++14");
|
||||
standards.push_back("gnu++14");
|
||||
|
||||
standards.push_back("c++11");
|
||||
standards.push_back("gnu++11");
|
||||
|
||||
standards.push_back("c++03");
|
||||
standards.push_back("gnu++03");
|
||||
|
||||
standards.push_back("c++98");
|
||||
standards.push_back("gnu++98");
|
||||
break;
|
||||
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
standards.push_back("c11");
|
||||
standards.push_back("gnu11");
|
||||
standards.push_back("iso9899:2011");
|
||||
|
||||
standards.push_back("c99");
|
||||
standards.push_back("gnu99");
|
||||
standards.push_back("iso9899:1999");
|
||||
|
||||
standards.push_back("iso9899:199409");
|
||||
|
||||
standards.push_back("c90");
|
||||
standards.push_back("gnu90");
|
||||
standards.push_back("iso9899:1990");
|
||||
|
||||
standards.push_back("c89");
|
||||
standards.push_back("gnu89");
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return standards;
|
||||
}
|
||||
|
||||
std::vector<FilePath> SourceGroupSettingsCxx::getHeaderSearchPaths() const
|
||||
{
|
||||
return m_headerSearchPaths;
|
||||
@@ -140,20 +86,3 @@ void SourceGroupSettingsCxx::setCompilerFlags(const std::vector<std::wstring>& c
|
||||
{
|
||||
m_compilerFlags = compilerFlags;
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsCxx::getDefaultStandard() const
|
||||
{
|
||||
switch (getType())
|
||||
{
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
case SOURCE_GROUP_CXX_SONARGRAPH:
|
||||
return "c++17";
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
return "c11";
|
||||
case SOURCE_GROUP_CXX_CDB:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
|
||||
#include "utility/file/FilePath.h"
|
||||
|
||||
class SourceGroupSettingsCxx
|
||||
: public SourceGroupSettings
|
||||
{
|
||||
@@ -14,8 +16,6 @@ public:
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
std::vector<std::string> getAvailableLanguageStandards() const override;
|
||||
|
||||
std::vector<FilePath> getHeaderSearchPaths() const;
|
||||
std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const;
|
||||
void setHeaderSearchPaths(const std::vector<FilePath>& headerSearchPaths);
|
||||
@@ -28,8 +28,6 @@ public:
|
||||
void setCompilerFlags(const std::vector<std::wstring>& compilerFlags);
|
||||
|
||||
private:
|
||||
std::string getDefaultStandard() const override;
|
||||
|
||||
std::vector<FilePath> m_headerSearchPaths;
|
||||
std::vector<FilePath> m_frameworkSearchPaths;
|
||||
std::vector<std::wstring> m_compilerFlags;
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
#include "settings/SourceGroupSettingsCxxCodeblocks.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "utility/ConfigManager.h"
|
||||
|
||||
SourceGroupSettingsCxxCodeblocks::SourceGroupSettingsCxxCodeblocks(const std::string& id, const ProjectSettings* projectSettings)
|
||||
: SourceGroupSettingsCxx(id, SOURCE_GROUP_CXX_CODEBLOCKS, projectSettings)
|
||||
{
|
||||
}
|
||||
|
||||
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);
|
||||
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);
|
||||
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) &&
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxCodeblocks) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherCxxCodeblocks) &&
|
||||
m_codeblocksProjectPath == otherCxxCodeblocks->m_codeblocksProjectPath
|
||||
);
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettingsCxxCodeblocks::getCodeblocksProjectPath() const
|
||||
{
|
||||
return m_codeblocksProjectPath;
|
||||
}
|
||||
|
||||
FilePath SourceGroupSettingsCxxCodeblocks::getCodeblocksProjectPathExpandedAndAbsolute() const
|
||||
{
|
||||
return m_projectSettings->makePathExpandedAndAbsolute(getCodeblocksProjectPath());
|
||||
}
|
||||
|
||||
void SourceGroupSettingsCxxCodeblocks::setCodeblocksProjectPath(const FilePath& compilationDatabasePath)
|
||||
{
|
||||
m_codeblocksProjectPath = compilationDatabasePath;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCxxCodeblocks::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCxxCodeblocks::getDefaultSourceExtensions() const
|
||||
{
|
||||
return {
|
||||
L".c",
|
||||
L".cpp",
|
||||
L".cxx",
|
||||
L".cc"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
|
||||
#define SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
|
||||
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
|
||||
class SourceGroupSettingsCxxCodeblocks
|
||||
: public SourceGroupSettingsCxx
|
||||
, public SourceGroupSettingsWithCppStandard
|
||||
, public SourceGroupSettingsWithCStandard
|
||||
, public SourceGroupSettingsWithIndexedHeaderPaths
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
{
|
||||
public:
|
||||
SourceGroupSettingsCxxCodeblocks(const std::string& id, 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;
|
||||
|
||||
FilePath getCodeblocksProjectPath() const;
|
||||
FilePath getCodeblocksProjectPathExpandedAndAbsolute() const;
|
||||
void setCodeblocksProjectPath(const FilePath& compilationDatabasePath);
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
|
||||
FilePath m_codeblocksProjectPath;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_CXX_CODEBLOCKS_H
|
||||
@@ -157,6 +157,7 @@ void SourceGroupSettingsCxxEmpty::load(std::shared_ptr<const ConfigManager> conf
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::load(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::load(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::load(config, key);
|
||||
|
||||
@@ -173,6 +174,7 @@ void SourceGroupSettingsCxxEmpty::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::save(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::save(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::save(config, key);
|
||||
|
||||
@@ -190,6 +192,7 @@ bool SourceGroupSettingsCxxEmpty::equals(std::shared_ptr<SourceGroupSettings> ot
|
||||
return (
|
||||
otherCxxEmpty &&
|
||||
SourceGroupSettingsCxx::equals(other) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherCxxEmpty) &&
|
||||
SourceGroupSettingsWithSourcePaths::equals(otherCxxEmpty) &&
|
||||
SourceGroupSettingsWithExcludeFilters::equals(otherCxxEmpty) &&
|
||||
getTargetFlag() == otherCxxEmpty->getTargetFlag()
|
||||
@@ -258,30 +261,4 @@ std::wstring SourceGroupSettingsCxxEmpty::getTargetFlag() const
|
||||
targetFlag += L"-" + (m_targetAbi.empty() ? L"unknown" : m_targetAbi);
|
||||
}
|
||||
return targetFlag;
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsCxxEmpty::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsCxxEmpty::getDefaultSourceExtensions() const
|
||||
{
|
||||
std::vector<std::wstring> defaultValues;
|
||||
|
||||
switch (getType())
|
||||
{
|
||||
case SOURCE_GROUP_CPP_EMPTY:
|
||||
defaultValues.push_back(L".cpp");
|
||||
defaultValues.push_back(L".cxx");
|
||||
defaultValues.push_back(L".cc");
|
||||
break;
|
||||
case SOURCE_GROUP_C_EMPTY:
|
||||
defaultValues.push_back(L".c");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return defaultValues;
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,13 @@
|
||||
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "settings/SourceGroupSettingsWithSourcePaths.h"
|
||||
|
||||
class SourceGroupSettingsCxxEmpty
|
||||
: public SourceGroupSettingsCxx
|
||||
, public SourceGroupSettingsWithExcludeFilters
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
, public SourceGroupSettingsWithSourcePaths
|
||||
{
|
||||
public:
|
||||
@@ -41,9 +43,6 @@ public:
|
||||
std::wstring getTargetFlag() const;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
|
||||
bool m_targetOptionsEnabled;
|
||||
std::wstring m_targetArch;
|
||||
std::wstring m_targetVendor;
|
||||
|
||||
@@ -11,6 +11,7 @@ void SourceGroupSettingsCxxSonargraph::load(std::shared_ptr<const ConfigManager>
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::load(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::load(config, key);
|
||||
SourceGroupSettingsWithSonargraphProjectPath::load(config, key);
|
||||
}
|
||||
@@ -21,6 +22,7 @@ void SourceGroupSettingsCxxSonargraph::save(std::shared_ptr<ConfigManager> confi
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithCppStandard::save(config, key);
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::save(config, key);
|
||||
SourceGroupSettingsWithSonargraphProjectPath::save(config, key);
|
||||
}
|
||||
@@ -32,7 +34,8 @@ bool SourceGroupSettingsCxxSonargraph::equals(std::shared_ptr<SourceGroupSetting
|
||||
return (
|
||||
otherCxxSonargraph &&
|
||||
SourceGroupSettingsCxx::equals(other) &&
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxSonargraph) &&
|
||||
SourceGroupSettingsWithCppStandard::equals(otherCxxSonargraph) &&
|
||||
SourceGroupSettingsWithIndexedHeaderPaths::equals(otherCxxSonargraph) &&
|
||||
SourceGroupSettingsWithSonargraphProjectPath::equals(otherCxxSonargraph)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2,11 +2,13 @@
|
||||
#define SOURCE_GROUP_SETTINGS_CXX_SONARGRAPH_H
|
||||
|
||||
#include "settings/SourceGroupSettingsCxx.h"
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithIndexedHeaderPaths.h"
|
||||
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
|
||||
class SourceGroupSettingsCxxSonargraph
|
||||
: public SourceGroupSettingsCxx
|
||||
, public SourceGroupSettingsWithCppStandard
|
||||
, public SourceGroupSettingsWithIndexedHeaderPaths
|
||||
, public SourceGroupSettingsWithSonargraphProjectPath
|
||||
{
|
||||
|
||||
@@ -10,9 +10,11 @@ void SourceGroupSettingsJava::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);
|
||||
SourceGroupSettingsWithJavaStandard::load(config, key);
|
||||
SourceGroupSettingsWithClasspath::load(config, key);
|
||||
}
|
||||
|
||||
@@ -22,8 +24,10 @@ void SourceGroupSettingsJava::save(std::shared_ptr<ConfigManager> config)
|
||||
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithSourceExtensions::save(config, key);
|
||||
SourceGroupSettingsWithSourcePaths::save(config, key);
|
||||
SourceGroupSettingsWithExcludeFilters::save(config, key);
|
||||
SourceGroupSettingsWithJavaStandard::save(config, key);
|
||||
SourceGroupSettingsWithClasspath::save(config, key);
|
||||
}
|
||||
|
||||
@@ -34,17 +38,14 @@ bool SourceGroupSettingsJava::equals(std::shared_ptr<SourceGroupSettings> other)
|
||||
return (
|
||||
otherJava &&
|
||||
SourceGroupSettings::equals(other) &&
|
||||
SourceGroupSettingsWithSourceExtensions::equals(otherJava) &&
|
||||
SourceGroupSettingsWithSourcePaths::equals(otherJava) &&
|
||||
SourceGroupSettingsWithExcludeFilters::equals(otherJava) &&
|
||||
SourceGroupSettingsWithJavaStandard::equals(otherJava) &&
|
||||
SourceGroupSettingsWithClasspath::equals(otherJava)
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsJava::getAvailableLanguageStandards() const
|
||||
{
|
||||
return std::vector<std::string>{"1", "2", "3", "4", "5", "6", "7", "8"};
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsJava::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
@@ -54,8 +55,3 @@ std::vector<std::wstring> SourceGroupSettingsJava::getDefaultSourceExtensions()
|
||||
{
|
||||
return { L".java" };
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsJava::getDefaultStandard() const
|
||||
{
|
||||
return "8";
|
||||
}
|
||||
|
||||
@@ -7,12 +7,16 @@
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "settings/SourceGroupSettingsWithClasspath.h"
|
||||
#include "settings/SourceGroupSettingsWithExcludeFilters.h"
|
||||
#include "settings/SourceGroupSettingsWithJavaStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
#include "settings/SourceGroupSettingsWithSourcePaths.h"
|
||||
|
||||
class SourceGroupSettingsJava
|
||||
: public SourceGroupSettings
|
||||
, public SourceGroupSettingsWithSourceExtensions
|
||||
, public SourceGroupSettingsWithSourcePaths
|
||||
, public SourceGroupSettingsWithExcludeFilters
|
||||
, public SourceGroupSettingsWithJavaStandard
|
||||
, public SourceGroupSettingsWithClasspath
|
||||
{
|
||||
public:
|
||||
@@ -23,12 +27,9 @@ public:
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
std::vector<std::string> getAvailableLanguageStandards() const override;
|
||||
|
||||
private:
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
std::vector<std::wstring> getDefaultSourceExtensions() const override;
|
||||
std::string getDefaultStandard() const override;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_JAVA_H
|
||||
|
||||
@@ -12,6 +12,7 @@ void SourceGroupSettingsJavaSonargraph::load(std::shared_ptr<const ConfigManager
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithClasspath::load(config, key);
|
||||
SourceGroupSettingsWithJavaStandard::load(config, key);
|
||||
SourceGroupSettingsWithSonargraphProjectPath::load(config, key);
|
||||
}
|
||||
|
||||
@@ -22,6 +23,7 @@ void SourceGroupSettingsJavaSonargraph::save(std::shared_ptr<ConfigManager> conf
|
||||
const std::string key = s_keyPrefix + getId();
|
||||
|
||||
SourceGroupSettingsWithClasspath::save(config, key);
|
||||
SourceGroupSettingsWithJavaStandard::save(config, key);
|
||||
SourceGroupSettingsWithSonargraphProjectPath::save(config, key);
|
||||
}
|
||||
|
||||
@@ -33,20 +35,11 @@ bool SourceGroupSettingsJavaSonargraph::equals(std::shared_ptr<SourceGroupSettin
|
||||
otherJavaSonargraph &&
|
||||
SourceGroupSettings::equals(other) &&
|
||||
SourceGroupSettingsWithClasspath::equals(otherJavaSonargraph) &&
|
||||
SourceGroupSettingsWithJavaStandard::equals(otherJavaSonargraph) &&
|
||||
SourceGroupSettingsWithSonargraphProjectPath::equals(otherJavaSonargraph)
|
||||
);
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsJavaSonargraph::getAvailableLanguageStandards() const
|
||||
{
|
||||
return std::vector<std::string>{"1", "2", "3", "4", "5", "6", "7", "8"};
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsJavaSonargraph::getDefaultStandard() const
|
||||
{
|
||||
return "8";
|
||||
}
|
||||
|
||||
const ProjectSettings* SourceGroupSettingsJavaSonargraph::getProjectSettings() const
|
||||
{
|
||||
return m_projectSettings;
|
||||
|
||||
@@ -3,11 +3,13 @@
|
||||
|
||||
#include "settings/SourceGroupSettings.h"
|
||||
#include "settings/SourceGroupSettingsWithClasspath.h"
|
||||
#include "settings/SourceGroupSettingsWithJavaStandard.h"
|
||||
#include "settings/SourceGroupSettingsWithSonargraphProjectPath.h"
|
||||
|
||||
class SourceGroupSettingsJavaSonargraph
|
||||
: public SourceGroupSettings
|
||||
, public SourceGroupSettingsWithClasspath
|
||||
, public SourceGroupSettingsWithJavaStandard
|
||||
, public SourceGroupSettingsWithSonargraphProjectPath
|
||||
{
|
||||
public:
|
||||
@@ -18,10 +20,7 @@ public:
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
|
||||
|
||||
std::vector<std::string> getAvailableLanguageStandards() const override;
|
||||
|
||||
private:
|
||||
std::string getDefaultStandard() const override;
|
||||
const ProjectSettings* getProjectSettings() const override;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "settings/SourceGroupSettingsWithCStandard.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
std::string SourceGroupSettingsWithCStandard::getDefaultCStandardStatic()
|
||||
{
|
||||
return "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::string>(key + "/c_standard", ""));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValue(key + "/c_standard", getCStandard());
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithCStandard::getCStandard() const
|
||||
{
|
||||
if (m_cStandard.empty())
|
||||
{
|
||||
return getDefaultCStandard();
|
||||
}
|
||||
return m_cStandard;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCStandard::setCStandard(const std::string& standard)
|
||||
{
|
||||
m_cStandard = standard;
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsWithCStandard::getAvailableCStandards() const
|
||||
{
|
||||
return {
|
||||
"c11",
|
||||
"gnu11",
|
||||
"iso9899:2011",
|
||||
"c99",
|
||||
"gnu99",
|
||||
"iso9899:1999",
|
||||
"iso9899:199409",
|
||||
"c90",
|
||||
"gnu90",
|
||||
"iso9899:1990",
|
||||
"c89",
|
||||
"gnu89"
|
||||
};
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithCStandard::getDefaultCStandard() const
|
||||
{
|
||||
return getDefaultCStandardStatic();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithCStandard
|
||||
{
|
||||
public:
|
||||
static std::string getDefaultCStandardStatic();
|
||||
|
||||
SourceGroupSettingsWithCStandard() = default;
|
||||
virtual ~SourceGroupSettingsWithCStandard() = default;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithCStandard> other) const;
|
||||
|
||||
std::string getCStandard() const;
|
||||
void setCStandard(const std::string& standard);
|
||||
|
||||
std::vector<std::string> 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:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::string getDefaultCStandard() const;
|
||||
|
||||
std::string m_cStandard;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_C_STANDARD_H
|
||||
@@ -0,0 +1,63 @@
|
||||
#include "settings/SourceGroupSettingsWithCppStandard.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
std::string SourceGroupSettingsWithCppStandard::getDefaultCppStandardStatic()
|
||||
{
|
||||
return "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::string>(key + "/cpp_standard", ""));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCppStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValue(key + "/cpp_standard", getCppStandard());
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithCppStandard::getCppStandard() const
|
||||
{
|
||||
if (m_cppStandard.empty())
|
||||
{
|
||||
return getDefaultCppStandard();
|
||||
}
|
||||
return m_cppStandard;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithCppStandard::setCppStandard(const std::string& standard)
|
||||
{
|
||||
m_cppStandard = standard;
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsWithCppStandard::getAvailableCppStandards() const
|
||||
{
|
||||
return {
|
||||
"c++2a",
|
||||
"gnu++2a",
|
||||
"c++17",
|
||||
"gnu++17",
|
||||
"c++14",
|
||||
"gnu++14",
|
||||
"c++11",
|
||||
"gnu++11",
|
||||
"c++03",
|
||||
"gnu++03",
|
||||
"c++98",
|
||||
"gnu++98"
|
||||
};
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithCppStandard::getDefaultCppStandard() const
|
||||
{
|
||||
return getDefaultCppStandardStatic();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithCppStandard
|
||||
{
|
||||
public:
|
||||
static std::string getDefaultCppStandardStatic();
|
||||
|
||||
SourceGroupSettingsWithCppStandard() = default;
|
||||
virtual ~SourceGroupSettingsWithCppStandard() = default;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithCppStandard> other) const;
|
||||
|
||||
std::string getCppStandard() const;
|
||||
void setCppStandard(const std::string& standard);
|
||||
|
||||
std::vector<std::string> 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:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::string getDefaultCppStandard() const;
|
||||
|
||||
std::string m_cppStandard;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_CPP_STANDARD_H
|
||||
@@ -0,0 +1,50 @@
|
||||
#include "settings/SourceGroupSettingsWithJavaStandard.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
|
||||
std::string SourceGroupSettingsWithJavaStandard::getDefaultJavaStandardStatic()
|
||||
{
|
||||
return "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::string>(key + "/java_standard", ""));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithJavaStandard::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValue(key + "/java_standard", getJavaStandard());
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithJavaStandard::getJavaStandard() const
|
||||
{
|
||||
if (m_javaStandard.empty())
|
||||
{
|
||||
return getDefaultJavaStandard();
|
||||
}
|
||||
return m_javaStandard;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithJavaStandard::setJavaStandard(const std::string& standard)
|
||||
{
|
||||
m_javaStandard = standard;
|
||||
}
|
||||
|
||||
std::vector<std::string> SourceGroupSettingsWithJavaStandard::getAvailableJavaStandards() const
|
||||
{
|
||||
return {"1", "2", "3", "4", "5", "6", "7", "8"};
|
||||
}
|
||||
|
||||
std::string SourceGroupSettingsWithJavaStandard::getDefaultJavaStandard() const
|
||||
{
|
||||
return getDefaultJavaStandardStatic();
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigManager;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithJavaStandard
|
||||
{
|
||||
public:
|
||||
static std::string getDefaultJavaStandardStatic();
|
||||
|
||||
SourceGroupSettingsWithJavaStandard() = default;
|
||||
virtual ~SourceGroupSettingsWithJavaStandard() = default;
|
||||
|
||||
bool equals(std::shared_ptr<SourceGroupSettingsWithJavaStandard> other) const;
|
||||
|
||||
std::string getJavaStandard() const;
|
||||
void setJavaStandard(const std::string& standard);
|
||||
|
||||
std::vector<std::string> 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:
|
||||
virtual const ProjectSettings* getProjectSettings() const = 0;
|
||||
std::string getDefaultJavaStandard() const;
|
||||
|
||||
std::string m_javaStandard;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_JAVA_STANDARD_H
|
||||
@@ -0,0 +1,38 @@
|
||||
#include "settings/SourceGroupSettingsWithSourceExtensions.h"
|
||||
|
||||
#include "settings/ProjectSettings.h"
|
||||
#include "utility/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,34 @@
|
||||
#ifndef SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
|
||||
#define SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
class ConfigManager;
|
||||
class FilePath;
|
||||
class ProjectSettings;
|
||||
|
||||
class SourceGroupSettingsWithSourceExtensions
|
||||
{
|
||||
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 const ProjectSettings* getProjectSettings() const = 0;
|
||||
virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0;
|
||||
|
||||
std::vector<std::wstring> m_sourceExtensions;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_EXTENSIONS_H
|
||||
@@ -5,28 +5,22 @@
|
||||
|
||||
SourceGroupSettingsWithSourcePaths::SourceGroupSettingsWithSourcePaths()
|
||||
: m_sourcePaths(std::vector<FilePath>())
|
||||
, m_sourceExtensions(std::vector<std::wstring>())
|
||||
{
|
||||
}
|
||||
|
||||
bool SourceGroupSettingsWithSourcePaths::equals(std::shared_ptr<SourceGroupSettingsWithSourcePaths> other) const
|
||||
{
|
||||
return (
|
||||
utility::isPermutation(m_sourcePaths, other->m_sourcePaths) &&
|
||||
utility::isPermutation(m_sourceExtensions, other->m_sourceExtensions)
|
||||
);
|
||||
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>()));
|
||||
setSourceExtensions(config->getValuesOrDefaults(key + "/source_extensions/source_extension", std::vector<std::wstring>()));
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSourcePaths::save(std::shared_ptr<ConfigManager> config, const std::string& key)
|
||||
{
|
||||
config->setValues(key + "/source_paths/source_path", getSourcePaths());
|
||||
config->setValues(key + "/source_extensions/source_extension", getSourceExtensions());
|
||||
}
|
||||
|
||||
std::vector<FilePath> SourceGroupSettingsWithSourcePaths::getSourcePaths() const
|
||||
@@ -43,17 +37,3 @@ void SourceGroupSettingsWithSourcePaths::setSourcePaths(const std::vector<FilePa
|
||||
{
|
||||
m_sourcePaths = sourcePaths;
|
||||
}
|
||||
|
||||
std::vector<std::wstring> SourceGroupSettingsWithSourcePaths::getSourceExtensions() const
|
||||
{
|
||||
if (m_sourceExtensions.empty())
|
||||
{
|
||||
return getDefaultSourceExtensions();
|
||||
}
|
||||
return m_sourceExtensions;
|
||||
}
|
||||
|
||||
void SourceGroupSettingsWithSourcePaths::setSourceExtensions(const std::vector<std::wstring>& sourceExtensions)
|
||||
{
|
||||
m_sourceExtensions = sourceExtensions;
|
||||
}
|
||||
|
||||
@@ -21,19 +21,14 @@ public:
|
||||
std::vector<FilePath> getSourcePathsExpandedAndAbsolute() const;
|
||||
void setSourcePaths(const std::vector<FilePath>& sourcePaths);
|
||||
|
||||
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 const ProjectSettings* getProjectSettings() const = 0;
|
||||
virtual std::vector<std::wstring> getDefaultSourceExtensions() const = 0;
|
||||
|
||||
std::vector<FilePath> m_sourcePaths;
|
||||
std::vector<std::wstring> m_sourceExtensions;
|
||||
};
|
||||
|
||||
#endif // SOURCE_GROUP_SETTINGS_WITH_SOURCE_PATHS_H
|
||||
|
||||
@@ -10,6 +10,8 @@ std::string sourceGroupTypeToString(SourceGroupType v)
|
||||
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:
|
||||
@@ -38,6 +40,8 @@ std::string sourceGroupTypeToProjectSetupString(SourceGroupType v)
|
||||
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:
|
||||
@@ -70,6 +74,10 @@ SourceGroupType stringToSourceGroupType(const std::string& v)
|
||||
{
|
||||
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;
|
||||
|
||||
@@ -8,6 +8,7 @@ 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,
|
||||
|
||||
Reference in New Issue
Block a user