logic: added Gradle project setup (issue #379)

* added implementation for Gradle project setup (icon is still missing)
* refactored project loading/saving and SourceGroupSettings
* removed long deprecated Cxx UseSourcePathsForHeaderSearch option

fortune cookie message = There is true and sincere friendship between you and your friends.
This commit is contained in:
mlangkabel
2017-10-02 18:43:59 +02:00
parent 72ae4d5695
commit e604d24c40
83 changed files with 3518 additions and 1182 deletions
+71
View File
@@ -12,9 +12,14 @@ class ProjectSettings;
class SourceGroupSettings
{
public:
static std::string s_keyPrefix;
SourceGroupSettings(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettings();
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;
@@ -45,6 +50,22 @@ public:
void setSourceExtensions(const std::vector<std::string>& sourceExtensions);
protected:
template<typename T>
static T getValue(const std::string& key, T defaultValue, std::shared_ptr<const ConfigManager> config);
template<typename T>
static std::vector<T> getValues(const std::string& key, std::vector<T> defaultValues, std::shared_ptr<const ConfigManager> config);
static std::vector<FilePath> getPathValues(const std::string& key, std::shared_ptr<const ConfigManager> config);
template<typename T>
static bool setValue(const std::string& key, T value, std::shared_ptr<ConfigManager> config);
template<typename T>
static bool setValues(const std::string& key, std::vector<T> values, std::shared_ptr<ConfigManager> config);
static bool setPathValues(const std::string& key, const std::vector<FilePath>& paths, std::shared_ptr<ConfigManager> config);
const ProjectSettings* m_projectSettings;
private:
@@ -61,4 +82,54 @@ private:
std::vector<std::string> m_sourceExtensions;
};
template<typename T>
T SourceGroupSettings::getValue(const std::string& key, T defaultValue, std::shared_ptr<const ConfigManager> config)
{
if (config)
{
T value;
if (config->getValue(key, value))
{
return value;
}
}
return defaultValue;
}
template<typename T>
std::vector<T> SourceGroupSettings::getValues(const std::string& key, std::vector<T> defaultValues, std::shared_ptr<const ConfigManager> config)
{
if (config)
{
std::vector<T> values;
if (config->getValues(key, values))
{
return values;
}
}
return defaultValues;
}
template<typename T>
bool SourceGroupSettings::setValue(const std::string& key, T value, std::shared_ptr<ConfigManager> config)
{
if (config)
{
config->setValue(key, value);
return true;
}
return false;
}
template<typename T>
bool SourceGroupSettings::setValues(const std::string& key, std::vector<T> values, std::shared_ptr<ConfigManager> config)
{
if (config)
{
config->setValues(key, values);
return true;
}
return false;
}
#endif // SOURCE_GROUP_SETTINGS_H