logic: implemented disabling of source groups

* added source group status (enabled/disabled)
* fixed bug where the removal of an indexed directory has not affected the files to clear
* added lots of const and override keywords in SourceGroupSettings
This commit is contained in:
mlangkabel
2018-01-15 14:39:15 +01:00
parent c569f921a2
commit cad064b9da
28 changed files with 268 additions and 112 deletions
+2 -1
View File
@@ -328,8 +328,9 @@ add_files(
settings/SourceGroupSettingsJavaGradle.h settings/SourceGroupSettingsJavaGradle.h
settings/SourceGroupSettingsJavaMaven.cpp settings/SourceGroupSettingsJavaMaven.cpp
settings/SourceGroupSettingsJavaMaven.h settings/SourceGroupSettingsJavaMaven.h
settings/SourceGroupStatusType.cpp
settings/SourceGroupStatusType.h
settings/SourceGroupType.cpp settings/SourceGroupType.cpp
settings/SourceGroupType.h settings/SourceGroupType.h
utility/commandline/CommandlineHelper.cpp utility/commandline/CommandlineHelper.cpp
+72 -29
View File
@@ -34,6 +34,7 @@
#include "utility/text/TextAccess.h" #include "utility/text/TextAccess.h"
#include "utility/utility.h" #include "utility/utility.h"
#include "utility/utilityApp.h" #include "utility/utilityApp.h"
#include "utility/utilityFile.h"
#include "utility/utilityString.h" #include "utility/utilityString.h"
Project::Project(std::shared_ptr<ProjectSettings> settings, StorageCache* storageCache, bool hasGUI) Project::Project(std::shared_ptr<ProjectSettings> settings, StorageCache* storageCache, bool hasGUI)
@@ -314,7 +315,7 @@ RefreshInfo Project::getRefreshInfo(RefreshMode mode) const
void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView) void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
{ {
if (info.mode == REFRESH_NONE || (!info.filesToClear.size() && !info.filesToIndex.size())) if (info.mode == REFRESH_NONE || (info.filesToClear.empty() && info.filesToIndex.empty()))
{ {
if (m_hasGUI) if (m_hasGUI)
{ {
@@ -334,20 +335,19 @@ void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
dialogView->showUnknownProgressDialog("Preparing Indexing", "Setting up Indexers"); dialogView->showUnknownProgressDialog("Preparing Indexing", "Setting up Indexers");
if (info.mode == REFRESH_ALL_FILES)
{
m_storage->clear();
}
m_storageCache->clear(); m_storageCache->clear();
m_storage->setProjectSettingsText(TextAccess::createFromFile(getProjectSettingsFilePath())->getText()); m_storage->setProjectSettingsText(TextAccess::createFromFile(getProjectSettingsFilePath())->getText());
std::shared_ptr<TaskGroupSequence> taskSequential = std::make_shared<TaskGroupSequence>(); std::shared_ptr<TaskGroupSequence> taskSequential = std::make_shared<TaskGroupSequence>();
// add task for clearing the database if (info.mode == REFRESH_ALL_FILES)
if (info.filesToClear.size())
{ {
m_storage->clear();
}
else if (info.filesToClear.size())
{
// add task for clearing the database
taskSequential->addTask(std::make_shared<TaskCleanStorage>( taskSequential->addTask(std::make_shared<TaskCleanStorage>(
m_storage.get(), m_storage.get(),
utility::toVector(info.filesToClear) utility::toVector(info.filesToClear)
@@ -357,9 +357,12 @@ void Project::buildIndex(const RefreshInfo& info, DialogView* dialogView)
std::shared_ptr<IndexerCommandList> indexerCommandList = std::make_shared<IndexerCommandList>(); std::shared_ptr<IndexerCommandList> indexerCommandList = std::make_shared<IndexerCommandList>();
for (const std::shared_ptr<SourceGroup>& sourceGroup : m_sourceGroups) for (const std::shared_ptr<SourceGroup>& sourceGroup : m_sourceGroups)
{ {
for (const std::shared_ptr<IndexerCommand>& command : sourceGroup->getIndexerCommands(info.filesToIndex)) if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
{ {
indexerCommandList->addCommand(command); for (const std::shared_ptr<IndexerCommand>& command : sourceGroup->getIndexerCommands(info.filesToIndex))
{
indexerCommandList->addCommand(command);
}
} }
} }
@@ -467,7 +470,10 @@ std::set<FilePath> Project::getAllSourceFilePaths() const
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups) for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
{ {
utility::append(allSourceFilePaths, sourceGroup->getAllSourceFilePaths()); if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
{
utility::append(allSourceFilePaths, sourceGroup->getAllSourceFilePaths());
}
} }
return allSourceFilePaths; return allSourceFilePaths;
@@ -478,22 +484,44 @@ RefreshInfo Project::getRefreshInfoForUpdatedFiles() const
std::set<FilePath> unchangedFilePaths; std::set<FilePath> unchangedFilePaths;
std::set<FilePath> changedFilePaths; std::set<FilePath> changedFilePaths;
for (const FileInfo& info: m_storage->getFileInfoForAllFiles())
{ {
if (info.path.exists()) std::set<FilePath> indexedPaths;
for (const std::shared_ptr<SourceGroup>& sourceGroup : m_sourceGroups)
{ {
if (didFileChange(info)) if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
{
utility::append(indexedPaths, sourceGroup->getIndexedPaths());
}
}
indexedPaths = utility::toSet(utility::getTopLevelPaths(utility::toVector(indexedPaths)));
for (const FileInfo& info : m_storage->getFileInfoForAllFiles())
{
bool isInIndexedPaths = false;
for (const FilePath& indexedPath : indexedPaths)
{
if (indexedPath == info.path || indexedPath.contains(info.path))
{
isInIndexedPaths = true;
break;
}
}
if (isInIndexedPaths && info.path.exists())
{
if (didFileChange(info))
{
changedFilePaths.insert(info.path);
}
else
{
unchangedFilePaths.insert(info.path);
}
}
else // file has been removed
{ {
changedFilePaths.insert(info.path); changedFilePaths.insert(info.path);
} }
else
{
unchangedFilePaths.insert(info.path);
}
}
else // file has been removed
{
changedFilePaths.insert(info.path);
} }
} }
@@ -503,7 +531,7 @@ RefreshInfo Project::getRefreshInfoForUpdatedFiles() const
utility::append(filesToClear, m_storage->getReferencing(changedFilePaths)); utility::append(filesToClear, m_storage->getReferencing(changedFilePaths));
// handle referenced paths // handle referenced paths
std::set<FilePath> allSourceFilePaths = getAllSourceFilePaths(); const std::set<FilePath> allSourceFilePaths = getAllSourceFilePaths();
std::set<FilePath> staticSourceFiles = allSourceFilePaths; std::set<FilePath> staticSourceFiles = allSourceFilePaths;
for (const FilePath& path: changedFilePaths) for (const FilePath& path: changedFilePaths)
{ {
@@ -528,7 +556,7 @@ RefreshInfo Project::getRefreshInfoForUpdatedFiles() const
staticSourceFiles.erase(path); staticSourceFiles.erase(path);
} }
std::set<FilePath> filesToAdd = staticSourceFiles; const std::set<FilePath> filesToAdd = staticSourceFiles;
std::set<FilePath> staticSourceFilePaths; std::set<FilePath> staticSourceFilePaths;
for (const FilePath& path: allSourceFilePaths) for (const FilePath& path: allSourceFilePaths)
@@ -545,7 +573,10 @@ RefreshInfo Project::getRefreshInfoForUpdatedFiles() const
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups) for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
{ {
utility::append(info.filesToIndex, sourceGroup->getSourceFilePathsToIndex(staticSourceFilePaths)); if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
{
utility::append(info.filesToIndex, sourceGroup->getSourceFilePathsToIndex(staticSourceFilePaths));
}
} }
return info; return info;
@@ -565,7 +596,7 @@ RefreshInfo Project::getRefreshInfoForIncompleteFiles() const
} }
} }
if (incompleteFiles.size()) if (!incompleteFiles.empty())
{ {
utility::append(incompleteFiles, m_storage->getReferencing(incompleteFiles)); utility::append(incompleteFiles, m_storage->getReferencing(incompleteFiles));
utility::append(info.filesToClear, incompleteFiles); utility::append(info.filesToClear, incompleteFiles);
@@ -578,7 +609,10 @@ RefreshInfo Project::getRefreshInfoForIncompleteFiles() const
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups) for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
{ {
utility::append(info.filesToIndex, sourceGroup->getSourceFilePathsToIndex(staticSourceFilePaths)); if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
{
utility::append(info.filesToIndex, sourceGroup->getSourceFilePathsToIndex(staticSourceFilePaths));
}
} }
} }
@@ -590,6 +624,12 @@ RefreshInfo Project::getRefreshInfoForAllFiles() const
RefreshInfo info; RefreshInfo info;
info.mode = REFRESH_ALL_FILES; info.mode = REFRESH_ALL_FILES;
info.filesToIndex = getAllSourceFilePaths(); info.filesToIndex = getAllSourceFilePaths();
{
for (const FileInfo& fileInfo : m_storage->getFileInfoForAllFiles())
{
info.filesToClear.insert(fileInfo.path);
}
}
return info; return info;
} }
@@ -597,9 +637,12 @@ bool Project::hasCxxSourceGroup() const
{ {
for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups) for (const std::shared_ptr<SourceGroup>& sourceGroup: m_sourceGroups)
{ {
if (sourceGroup->getLanguage() == LANGUAGE_C || sourceGroup->getLanguage() == LANGUAGE_CPP) if (sourceGroup->getStatus() == SOURCE_GROUP_STATUS_ENABLED)
{ {
return true; if (sourceGroup->getLanguage() == LANGUAGE_C || sourceGroup->getLanguage() == LANGUAGE_CPP)
{
return true;
}
} }
} }
return false; return false;
+17 -12
View File
@@ -9,6 +9,11 @@ SourceGroup::~SourceGroup()
{ {
} }
SourceGroupStatusType SourceGroup::getStatus() const
{
return getSourceGroupSettings()->getStatus();
}
LanguageType SourceGroup::getLanguage() const LanguageType SourceGroup::getLanguage() const
{ {
return getLanguageTypeForSourceGroupType(getType()); return getLanguageTypeForSourceGroupType(getType());
@@ -30,12 +35,22 @@ void SourceGroup::fetchAllSourceFilePaths()
m_allSourceFilePaths = fileManager.getAllSourceFilePaths(); m_allSourceFilePaths = fileManager.getAllSourceFilePaths();
} }
std::set<FilePath> SourceGroup::getIndexedPaths() const
{
return findAndAddSymlinkedDirectories(getSourceGroupSettings()->getSourcePathsExpandedAndAbsolute());
}
std::set<FilePath> SourceGroup::getExcludedPaths() const
{
return findAndAddSymlinkedDirectories(getSourceGroupSettings()->getExcludePathsExpandedAndAbsolute());
}
std::set<FilePath> SourceGroup::getAllSourceFilePaths() const std::set<FilePath> SourceGroup::getAllSourceFilePaths() const
{ {
return m_allSourceFilePaths; return m_allSourceFilePaths;
} }
std::set<FilePath> SourceGroup::getSourceFilePathsToIndex(const std::set<FilePath>& staticSourceFilePaths) std::set<FilePath> SourceGroup::getSourceFilePathsToIndex(const std::set<FilePath>& staticSourceFilePaths) const
{ {
std::set<FilePath> sourceFilePathsToIndex; std::set<FilePath> sourceFilePathsToIndex;
for (const FilePath& sourceFilePath: m_allSourceFilePaths) for (const FilePath& sourceFilePath: m_allSourceFilePaths)
@@ -48,17 +63,7 @@ std::set<FilePath> SourceGroup::getSourceFilePathsToIndex(const std::set<FilePat
return sourceFilePathsToIndex; return sourceFilePathsToIndex;
} }
std::set<FilePath> SourceGroup::getIndexedPaths() std::set<FilePath> SourceGroup::findAndAddSymlinkedDirectories(const std::vector<FilePath>& paths) const
{
return findAndAddSymlinkedDirectories(getSourceGroupSettings()->getSourcePathsExpandedAndAbsolute());
}
std::set<FilePath> SourceGroup::getExcludedPaths()
{
return findAndAddSymlinkedDirectories(getSourceGroupSettings()->getExcludePathsExpandedAndAbsolute());
}
std::set<FilePath> SourceGroup::findAndAddSymlinkedDirectories(const std::vector<FilePath>& paths)
{ {
std::set<FilePath> resultPaths; std::set<FilePath> resultPaths;
for (const FilePath& path: paths) for (const FilePath& path: paths)
+8 -8
View File
@@ -6,6 +6,7 @@
#include <vector> #include <vector>
#include "settings/LanguageType.h" #include "settings/LanguageType.h"
#include "settings/SourceGroupStatusType.h"
#include "settings/SourceGroupType.h" #include "settings/SourceGroupType.h"
#include "utility/file/FilePath.h" #include "utility/file/FilePath.h"
@@ -18,28 +19,27 @@ public:
virtual ~SourceGroup(); virtual ~SourceGroup();
virtual SourceGroupType getType() const = 0; virtual SourceGroupType getType() const = 0;
SourceGroupStatusType getStatus() const;
LanguageType getLanguage() const; LanguageType getLanguage() const;
virtual bool prepareIndexing(); virtual bool prepareIndexing();
void fetchAllSourceFilePaths(); void fetchAllSourceFilePaths();
std::set<FilePath> getIndexedPaths() const;
std::set<FilePath> getExcludedPaths() const;
std::set<FilePath> getAllSourceFilePaths() const; std::set<FilePath> getAllSourceFilePaths() const;
std::set<FilePath> getSourceFilePathsToIndex(const std::set<FilePath>& staticSourceFilePaths); std::set<FilePath> getSourceFilePathsToIndex(const std::set<FilePath>& staticSourceFilePaths) const;
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) = 0; virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const = 0;
protected:
std::set<FilePath> getIndexedPaths();
std::set<FilePath> getExcludedPaths();
std::set<FilePath> m_allSourceFilePaths; std::set<FilePath> m_allSourceFilePaths;
private: private:
virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() = 0; virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() = 0;
virtual std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const = 0;
virtual std::vector<FilePath> getAllSourcePaths() const = 0; virtual std::vector<FilePath> getAllSourcePaths() const = 0;
std::set<FilePath> findAndAddSymlinkedDirectories(const std::vector<FilePath>& paths); std::set<FilePath> findAndAddSymlinkedDirectories(const std::vector<FilePath>& paths) const;
}; };
#endif // SOURCE_GROUP_H #endif // SOURCE_GROUP_H
+15 -1
View File
@@ -9,6 +9,7 @@ SourceGroupSettings::SourceGroupSettings(const std::string& id, SourceGroupType
, m_id(id) , m_id(id)
, m_name(sourceGroupTypeToString(type)) , m_name(sourceGroupTypeToString(type))
, m_type(type) , m_type(type)
, m_status(SOURCE_GROUP_STATUS_ENABLED)
, m_standard("") , m_standard("")
, m_sourcePaths(std::vector<FilePath>()) , m_sourcePaths(std::vector<FilePath>())
, m_excludePaths(std::vector<FilePath>()) , m_excludePaths(std::vector<FilePath>())
@@ -29,7 +30,8 @@ void SourceGroupSettings::load(std::shared_ptr<const ConfigManager> config)
{ {
setName(name); setName(name);
} }
setStatus(stringToSourceGroupStatusType(getValue(key + "/status", sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED), config)));
setStandard(getValue<std::string>(key + "/standard", "", config)); setStandard(getValue<std::string>(key + "/standard", "", config));
setSourcePaths(getPathValues(key + "/source_paths/source_path", config)); setSourcePaths(getPathValues(key + "/source_paths/source_path", config));
setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path", config)); setExcludePaths(getPathValues(key + "/exclude_paths/exclude_path", config));
@@ -40,6 +42,7 @@ void SourceGroupSettings::save(std::shared_ptr<ConfigManager> config)
{ {
const std::string key = s_keyPrefix + getId(); const std::string key = s_keyPrefix + getId();
setValue(key + "/status", sourceGroupStatusTypeToString(getStatus()), config);
setValue(key + "/name", getName(), config); setValue(key + "/name", getName(), config);
setValue(key + "/standard", getStandard(), config); setValue(key + "/standard", getStandard(), config);
setPathValues(key + "/source_paths/source_path", getSourcePaths(), config); setPathValues(key + "/source_paths/source_path", getSourcePaths(), config);
@@ -53,6 +56,7 @@ bool SourceGroupSettings::equals(std::shared_ptr<SourceGroupSettings> other) con
m_id == other->m_id && m_id == other->m_id &&
m_name == other->m_name && m_name == other->m_name &&
m_type == other->m_type && m_type == other->m_type &&
m_status == other->m_status &&
m_standard == other->m_standard && m_standard == other->m_standard &&
utility::isPermutation(m_sourcePaths, other->m_sourcePaths) && utility::isPermutation(m_sourcePaths, other->m_sourcePaths) &&
utility::isPermutation(m_excludePaths, other->m_excludePaths) && utility::isPermutation(m_excludePaths, other->m_excludePaths) &&
@@ -100,6 +104,16 @@ SourceGroupType SourceGroupSettings::getType() const
return m_type; return m_type;
} }
SourceGroupStatusType SourceGroupSettings::getStatus() const
{
return m_status;
}
void SourceGroupSettings::setStatus(SourceGroupStatusType status)
{
m_status = status;
}
std::string SourceGroupSettings::getStandard() const std::string SourceGroupSettings::getStandard() const
{ {
if (m_standard.empty()) if (m_standard.empty())
+5
View File
@@ -5,6 +5,7 @@
#include <vector> #include <vector>
#include "settings/ProjectSettings.h" #include "settings/ProjectSettings.h"
#include "settings/SourceGroupStatusType.h"
#include "settings/SourceGroupType.h" #include "settings/SourceGroupType.h"
class ProjectSettings; class ProjectSettings;
@@ -35,6 +36,9 @@ public:
virtual std::vector<std::string> getAvailableLanguageStandards() const = 0; virtual std::vector<std::string> getAvailableLanguageStandards() const = 0;
virtual SourceGroupType getType() const; virtual SourceGroupType getType() const;
SourceGroupStatusType getStatus() const;
void setStatus(SourceGroupStatusType status);
std::string getStandard() const; std::string getStandard() const;
void setStandard(const std::string& standard); void setStandard(const std::string& standard);
@@ -75,6 +79,7 @@ private:
std::string m_id; std::string m_id;
std::string m_name; std::string m_name;
const SourceGroupType m_type; const SourceGroupType m_type;
SourceGroupStatusType m_status;
std::string m_standard; std::string m_standard;
std::vector<FilePath> m_sourcePaths; std::vector<FilePath> m_sourcePaths;
+6 -6
View File
@@ -10,12 +10,12 @@ public:
SourceGroupSettingsCxx(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings); SourceGroupSettingsCxx(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsCxx(); virtual ~SourceGroupSettingsCxx();
virtual void load(std::shared_ptr<const ConfigManager> config); virtual void load(std::shared_ptr<const ConfigManager> config) override;
virtual void save(std::shared_ptr<ConfigManager> config); virtual void save(std::shared_ptr<ConfigManager> config) override;
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const; virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
virtual std::vector<std::string> getAvailableLanguageStandards() const; virtual std::vector<std::string> getAvailableLanguageStandards() const override;
std::vector<FilePath> getHeaderSearchPaths() const; std::vector<FilePath> getHeaderSearchPaths() const;
std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const; std::vector<FilePath> getHeaderSearchPathsExpandedAndAbsolute() const;
@@ -29,8 +29,8 @@ public:
void setCompilerFlags(const std::vector<std::string>& compilerFlags); void setCompilerFlags(const std::vector<std::string>& compilerFlags);
private: private:
virtual std::vector<std::string> getDefaultSourceExtensions() const; virtual std::vector<std::string> getDefaultSourceExtensions() const override;
virtual std::string getDefaultStandard() const; virtual std::string getDefaultStandard() const override;
std::vector<FilePath> m_headerSearchPaths; std::vector<FilePath> m_headerSearchPaths;
std::vector<FilePath> m_frameworkSearchPaths; std::vector<FilePath> m_frameworkSearchPaths;
+3 -3
View File
@@ -10,10 +10,10 @@ public:
SourceGroupSettingsCxxCdb(const std::string& id, const ProjectSettings* projectSettings); SourceGroupSettingsCxxCdb(const std::string& id, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsCxxCdb(); virtual ~SourceGroupSettingsCxxCdb();
virtual void load(std::shared_ptr<const ConfigManager> config); virtual void load(std::shared_ptr<const ConfigManager> config) override;
virtual void save(std::shared_ptr<ConfigManager> config); virtual void save(std::shared_ptr<ConfigManager> config) override;
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const; virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
FilePath getCompilationDatabasePath() const; FilePath getCompilationDatabasePath() const;
FilePath getCompilationDatabasePathExpandedAndAbsolute() const; FilePath getCompilationDatabasePathExpandedAndAbsolute() const;
@@ -15,10 +15,10 @@ public:
SourceGroupSettingsCxxEmpty(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings); SourceGroupSettingsCxxEmpty(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsCxxEmpty(); virtual ~SourceGroupSettingsCxxEmpty();
virtual void load(std::shared_ptr<const ConfigManager> config); virtual void load(std::shared_ptr<const ConfigManager> config) override;
virtual void save(std::shared_ptr<ConfigManager> config); virtual void save(std::shared_ptr<ConfigManager> config) override;
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const; virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
bool getTargetOptionsEnabled() const; bool getTargetOptionsEnabled() const;
void setTargetOptionsEnabled(bool targetOptionsEnabled); void setTargetOptionsEnabled(bool targetOptionsEnabled);
+6 -6
View File
@@ -13,12 +13,12 @@ public:
SourceGroupSettingsJava(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings); SourceGroupSettingsJava(const std::string& id, SourceGroupType type, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsJava(); virtual ~SourceGroupSettingsJava();
virtual void load(std::shared_ptr<const ConfigManager> config); virtual void load(std::shared_ptr<const ConfigManager> config) override;
virtual void save(std::shared_ptr<ConfigManager> config); virtual void save(std::shared_ptr<ConfigManager> config) override;
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const; virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
virtual std::vector<std::string> getAvailableLanguageStandards() const; virtual std::vector<std::string> getAvailableLanguageStandards() const override;
bool getUseJreSystemLibrary() const; bool getUseJreSystemLibrary() const;
void setUseJreSystemLibrary(bool useJreSystemLibrary); void setUseJreSystemLibrary(bool useJreSystemLibrary);
@@ -28,8 +28,8 @@ public:
void setClasspath(const std::vector<FilePath>& classpath); void setClasspath(const std::vector<FilePath>& classpath);
private: private:
virtual std::vector<std::string> getDefaultSourceExtensions() const; virtual std::vector<std::string> getDefaultSourceExtensions() const override;
virtual std::string getDefaultStandard() const; virtual std::string getDefaultStandard() const override;
bool m_useJreSystemLibrary; bool m_useJreSystemLibrary;
std::vector<FilePath> m_classpath; std::vector<FilePath> m_classpath;
@@ -10,10 +10,10 @@ public:
SourceGroupSettingsJavaGradle(const std::string& id, const ProjectSettings* projectSettings); SourceGroupSettingsJavaGradle(const std::string& id, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsJavaGradle(); virtual ~SourceGroupSettingsJavaGradle();
virtual void load(std::shared_ptr<const ConfigManager> config); virtual void load(std::shared_ptr<const ConfigManager> config) override;
virtual void save(std::shared_ptr<ConfigManager> config); virtual void save(std::shared_ptr<ConfigManager> config) override;
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const; virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
FilePath getGradleProjectFilePath() const; FilePath getGradleProjectFilePath() const;
FilePath getGradleProjectFilePathExpandedAndAbsolute() const; FilePath getGradleProjectFilePathExpandedAndAbsolute() const;
@@ -10,10 +10,10 @@ public:
SourceGroupSettingsJavaMaven(const std::string& id, const ProjectSettings* projectSettings); SourceGroupSettingsJavaMaven(const std::string& id, const ProjectSettings* projectSettings);
virtual ~SourceGroupSettingsJavaMaven(); virtual ~SourceGroupSettingsJavaMaven();
virtual void load(std::shared_ptr<const ConfigManager> config); virtual void load(std::shared_ptr<const ConfigManager> config) override;
virtual void save(std::shared_ptr<ConfigManager> config); virtual void save(std::shared_ptr<ConfigManager> config) override;
virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const; virtual bool equals(std::shared_ptr<SourceGroupSettings> other) const override;
FilePath getMavenProjectFilePath() const; FilePath getMavenProjectFilePath() const;
FilePath getMavenProjectFilePathExpandedAndAbsolute() const; FilePath getMavenProjectFilePathExpandedAndAbsolute() const;
@@ -0,0 +1,29 @@
#include "settings/SourceGroupStatusType.h"
std::string sourceGroupStatusTypeToString(SourceGroupStatusType v)
{
switch (v)
{
case SOURCE_GROUP_STATUS_ENABLED:
return "enabled";
case SOURCE_GROUP_STATUS_DISABLED:
return "disabled";
case SOURCE_GROUP_STATUS_UNKNOWN:
break;
}
return "unknown";
}
SourceGroupStatusType stringToSourceGroupStatusType(std::string v)
{
if (v == sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_ENABLED))
{
return SOURCE_GROUP_STATUS_ENABLED;
}
else if (v == sourceGroupStatusTypeToString(SOURCE_GROUP_STATUS_DISABLED))
{
return SOURCE_GROUP_STATUS_DISABLED;
}
return SOURCE_GROUP_STATUS_UNKNOWN;
}
+16
View File
@@ -0,0 +1,16 @@
#ifndef SOURCE_GROUP_STATUS_TYPE_H
#define SOURCE_GROUP_STATUS_TYPE_H
#include <string>
enum SourceGroupStatusType
{
SOURCE_GROUP_STATUS_ENABLED,
SOURCE_GROUP_STATUS_DISABLED,
SOURCE_GROUP_STATUS_UNKNOWN
};
std::string sourceGroupStatusTypeToString(SourceGroupStatusType v);
SourceGroupStatusType stringToSourceGroupStatusType(std::string v);
#endif // SOURCE_GROUP_STATUS_TYPE_H
+5
View File
@@ -26,3 +26,8 @@ std::shared_ptr<SourceGroupSettings> SourceGroupCxx::getSourceGroupSettings()
{ {
return getSourceGroupSettingsCxx(); return getSourceGroupSettingsCxx();
} }
std::shared_ptr<const SourceGroupSettings> SourceGroupCxx::getSourceGroupSettings() const
{
return getSourceGroupSettingsCxx();
}
+3 -1
View File
@@ -15,7 +15,9 @@ public:
private: private:
virtual std::shared_ptr<SourceGroupSettingsCxx> getSourceGroupSettingsCxx() = 0; virtual std::shared_ptr<SourceGroupSettingsCxx> getSourceGroupSettingsCxx() = 0;
virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings(); virtual std::shared_ptr<const SourceGroupSettingsCxx> getSourceGroupSettingsCxx() const = 0;
virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
virtual std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
}; };
#endif // SOURCE_GROUP_CXX_H #endif // SOURCE_GROUP_CXX_H
+6 -1
View File
@@ -47,7 +47,7 @@ bool SourceGroupCxxCdb::prepareIndexing()
return true; return true;
} }
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerCommands(const std::set<FilePath>& filesToIndex) std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxCdb::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
{ {
std::shared_ptr<ApplicationSettings> appSettings = ApplicationSettings::getInstance(); std::shared_ptr<ApplicationSettings> appSettings = ApplicationSettings::getInstance();
@@ -128,6 +128,11 @@ std::shared_ptr<SourceGroupSettingsCxx> SourceGroupCxxCdb::getSourceGroupSetting
return m_settings; return m_settings;
} }
std::shared_ptr<const SourceGroupSettingsCxx> SourceGroupCxxCdb::getSourceGroupSettingsCxx() const
{
return m_settings;
}
std::vector<FilePath> SourceGroupCxxCdb::getAllSourcePaths() const std::vector<FilePath> SourceGroupCxxCdb::getAllSourcePaths() const
{ {
std::vector<FilePath> sourcePaths; std::vector<FilePath> sourcePaths;
+5 -4
View File
@@ -13,14 +13,15 @@ public:
SourceGroupCxxCdb(std::shared_ptr<SourceGroupSettingsCxxCdb> settings); SourceGroupCxxCdb(std::shared_ptr<SourceGroupSettingsCxxCdb> settings);
virtual ~SourceGroupCxxCdb(); virtual ~SourceGroupCxxCdb();
virtual SourceGroupType getType() const; virtual SourceGroupType getType() const override;
virtual bool prepareIndexing(); virtual bool prepareIndexing() override;
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex); virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
private: private:
virtual std::shared_ptr<SourceGroupSettingsCxx> getSourceGroupSettingsCxx(); virtual std::shared_ptr<SourceGroupSettingsCxx> getSourceGroupSettingsCxx() override;
virtual std::shared_ptr<const SourceGroupSettingsCxx> getSourceGroupSettingsCxx() const override;
virtual std::vector<FilePath> getAllSourcePaths() const; virtual std::vector<FilePath> getAllSourcePaths() const;
std::shared_ptr<SourceGroupSettingsCxxCdb> m_settings; std::shared_ptr<SourceGroupSettingsCxxCdb> m_settings;
+6 -1
View File
@@ -18,7 +18,7 @@ SourceGroupType SourceGroupCxxEmpty::getType() const
return m_settings->getType(); // may be either C or Cpp return m_settings->getType(); // may be either C or Cpp
} }
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerCommands(const std::set<FilePath>& filesToIndex) std::vector<std::shared_ptr<IndexerCommand>> SourceGroupCxxEmpty::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
{ {
std::shared_ptr<ApplicationSettings> appSettings = ApplicationSettings::getInstance(); std::shared_ptr<ApplicationSettings> appSettings = ApplicationSettings::getInstance();
@@ -80,6 +80,11 @@ std::shared_ptr<SourceGroupSettingsCxx> SourceGroupCxxEmpty::getSourceGroupSetti
return m_settings; return m_settings;
} }
std::shared_ptr<const SourceGroupSettingsCxx> SourceGroupCxxEmpty::getSourceGroupSettingsCxx() const
{
return m_settings;
}
std::vector<FilePath> SourceGroupCxxEmpty::getAllSourcePaths() const std::vector<FilePath> SourceGroupCxxEmpty::getAllSourcePaths() const
{ {
return m_settings->getSourcePathsExpandedAndAbsolute(); return m_settings->getSourcePathsExpandedAndAbsolute();
+5 -4
View File
@@ -13,13 +13,14 @@ public:
SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxxEmpty> settings); SourceGroupCxxEmpty(std::shared_ptr<SourceGroupSettingsCxxEmpty> settings);
virtual ~SourceGroupCxxEmpty(); virtual ~SourceGroupCxxEmpty();
virtual SourceGroupType getType() const; virtual SourceGroupType getType() const override;
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex); virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
private: private:
virtual std::shared_ptr<SourceGroupSettingsCxx> getSourceGroupSettingsCxx(); virtual std::shared_ptr<SourceGroupSettingsCxx> getSourceGroupSettingsCxx() override;
virtual std::vector<FilePath> getAllSourcePaths() const; virtual std::shared_ptr<const SourceGroupSettingsCxx> getSourceGroupSettingsCxx() const override;
virtual std::vector<FilePath> getAllSourcePaths() const override;
std::shared_ptr<SourceGroupSettingsCxxEmpty> m_settings; std::shared_ptr<SourceGroupSettingsCxxEmpty> m_settings;
}; };
+9 -4
View File
@@ -30,7 +30,7 @@ bool SourceGroupJava::prepareIndexing()
return true; return true;
} }
std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) std::vector<std::shared_ptr<IndexerCommand>> SourceGroupJava::getIndexerCommands(const std::set<FilePath>& filesToIndex) const
{ {
const std::string languageStandard = getSourceGroupSettingsJava()->getStandard(); const std::string languageStandard = getSourceGroupSettingsJava()->getStandard();
@@ -56,6 +56,11 @@ std::shared_ptr<SourceGroupSettings> SourceGroupJava::getSourceGroupSettings()
return getSourceGroupSettingsJava(); return getSourceGroupSettingsJava();
} }
std::shared_ptr<const SourceGroupSettings> SourceGroupJava::getSourceGroupSettings() const
{
return getSourceGroupSettingsJava();
}
bool SourceGroupJava::prepareJavaEnvironment() bool SourceGroupJava::prepareJavaEnvironment()
{ {
const std::string errorString = utility::prepareJavaEnvironment(); const std::string errorString = utility::prepareJavaEnvironment();
@@ -86,7 +91,7 @@ bool SourceGroupJava::prepareJavaEnvironment()
} }
std::vector<FilePath> SourceGroupJava::getClassPath() std::vector<FilePath> SourceGroupJava::getClassPath() const
{ {
LOG_INFO("Retrieving classpath for indexer commands"); LOG_INFO("Retrieving classpath for indexer commands");
std::vector<FilePath> classPath = doGetClassPath(); std::vector<FilePath> classPath = doGetClassPath();
@@ -94,7 +99,7 @@ std::vector<FilePath> SourceGroupJava::getClassPath()
return classPath; return classPath;
} }
std::vector<FilePath> SourceGroupJava::doGetClassPath() std::vector<FilePath> SourceGroupJava::doGetClassPath() const
{ {
std::vector<FilePath> classPath; std::vector<FilePath> classPath;
@@ -128,7 +133,7 @@ std::vector<FilePath> SourceGroupJava::doGetClassPath()
return classPath; return classPath;
} }
std::set<FilePath> SourceGroupJava::fetchRootDirectories() std::set<FilePath> SourceGroupJava::fetchRootDirectories() const
{ {
std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView(); std::shared_ptr<DialogView> dialogView = Application::getInstance()->getDialogView();
dialogView->showUnknownProgressDialog("Preparing Project", "Gathering Root\nDirectories"); dialogView->showUnknownProgressDialog("Preparing Project", "Gathering Root\nDirectories");
+8 -7
View File
@@ -15,21 +15,22 @@ public:
SourceGroupJava(); SourceGroupJava();
virtual ~SourceGroupJava(); virtual ~SourceGroupJava();
virtual bool prepareIndexing(); virtual bool prepareIndexing() override;
virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex); virtual std::vector<std::shared_ptr<IndexerCommand>> getIndexerCommands(const std::set<FilePath>& filesToIndex) const override;
protected: protected:
virtual std::vector<FilePath> doGetClassPath(); virtual std::vector<FilePath> doGetClassPath() const;
private: private:
virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava() = 0; virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava() = 0;
virtual std::shared_ptr<const SourceGroupSettingsJava> getSourceGroupSettingsJava() const = 0;
virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings(); virtual std::shared_ptr<SourceGroupSettings> getSourceGroupSettings() override;
virtual std::shared_ptr<const SourceGroupSettings> getSourceGroupSettings() const override;
bool prepareJavaEnvironment(); bool prepareJavaEnvironment();
std::vector<FilePath> getClassPath(); std::vector<FilePath> getClassPath() const;
std::set<FilePath> fetchRootDirectories(); std::set<FilePath> fetchRootDirectories() const;
}; };
#endif // SOURCE_GROUP_JAVA_H #endif // SOURCE_GROUP_JAVA_H
@@ -21,6 +21,11 @@ std::shared_ptr<SourceGroupSettingsJava> SourceGroupJavaEmpty::getSourceGroupSet
return m_settings; return m_settings;
} }
std::shared_ptr<const SourceGroupSettingsJava> SourceGroupJavaEmpty::getSourceGroupSettingsJava() const
{
return m_settings;
}
std::vector<FilePath> SourceGroupJavaEmpty::getAllSourcePaths() const std::vector<FilePath> SourceGroupJavaEmpty::getAllSourcePaths() const
{ {
return m_settings->getSourcePathsExpandedAndAbsolute(); return m_settings->getSourcePathsExpandedAndAbsolute();
+4 -3
View File
@@ -14,11 +14,12 @@ public:
SourceGroupJavaEmpty(std::shared_ptr<SourceGroupSettingsJavaEmpty> settings); SourceGroupJavaEmpty(std::shared_ptr<SourceGroupSettingsJavaEmpty> settings);
virtual ~SourceGroupJavaEmpty(); virtual ~SourceGroupJavaEmpty();
virtual SourceGroupType getType() const; virtual SourceGroupType getType() const override;
private: private:
virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava(); virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava() override;
virtual std::vector<FilePath> getAllSourcePaths() const; virtual std::shared_ptr<const SourceGroupSettingsJava> getSourceGroupSettingsJava() const override;
virtual std::vector<FilePath> getAllSourcePaths() const override;
std::shared_ptr<SourceGroupSettingsJavaEmpty> m_settings; std::shared_ptr<SourceGroupSettingsJavaEmpty> m_settings;
}; };
@@ -38,7 +38,7 @@ bool SourceGroupJavaGradle::prepareIndexing()
return true; return true;
} }
std::vector<FilePath> SourceGroupJavaGradle::doGetClassPath() std::vector<FilePath> SourceGroupJavaGradle::doGetClassPath() const
{ {
std::vector<FilePath> classPath = SourceGroupJava::doGetClassPath(); std::vector<FilePath> classPath = SourceGroupJava::doGetClassPath();
@@ -65,6 +65,11 @@ std::shared_ptr<SourceGroupSettingsJava> SourceGroupJavaGradle::getSourceGroupSe
return m_settings; return m_settings;
} }
std::shared_ptr<const SourceGroupSettingsJava> SourceGroupJavaGradle::getSourceGroupSettingsJava() const
{
return m_settings;
}
std::vector<FilePath> SourceGroupJavaGradle::getAllSourcePaths() const std::vector<FilePath> SourceGroupJavaGradle::getAllSourcePaths() const
{ {
std::vector<FilePath> sourcePaths; std::vector<FilePath> sourcePaths;
+6 -5
View File
@@ -12,15 +12,16 @@ class SourceGroupJavaGradle : public SourceGroupJava
public: public:
SourceGroupJavaGradle(std::shared_ptr<SourceGroupSettingsJavaGradle> settings); SourceGroupJavaGradle(std::shared_ptr<SourceGroupSettingsJavaGradle> settings);
virtual ~SourceGroupJavaGradle(); virtual ~SourceGroupJavaGradle();
virtual SourceGroupType getType() const; virtual SourceGroupType getType() const override;
virtual bool prepareIndexing(); virtual bool prepareIndexing() override;
protected: protected:
virtual std::vector<FilePath> doGetClassPath(); virtual std::vector<FilePath> doGetClassPath() const override;
private: private:
virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava(); virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava() override;
virtual std::vector<FilePath> getAllSourcePaths() const; virtual std::shared_ptr<const SourceGroupSettingsJava> getSourceGroupSettingsJava() const override;
virtual std::vector<FilePath> getAllSourcePaths() const override;
bool prepareGradleData(); bool prepareGradleData();
std::shared_ptr<SourceGroupSettingsJavaGradle> m_settings; std::shared_ptr<SourceGroupSettingsJavaGradle> m_settings;
@@ -38,7 +38,7 @@ bool SourceGroupJavaMaven::prepareIndexing()
return true; return true;
} }
std::vector<FilePath> SourceGroupJavaMaven::doGetClassPath() std::vector<FilePath> SourceGroupJavaMaven::doGetClassPath() const
{ {
std::vector<FilePath> classPath = SourceGroupJava::doGetClassPath(); std::vector<FilePath> classPath = SourceGroupJava::doGetClassPath();
@@ -65,6 +65,11 @@ std::shared_ptr<SourceGroupSettingsJava> SourceGroupJavaMaven::getSourceGroupSet
return m_settings; return m_settings;
} }
std::shared_ptr<const SourceGroupSettingsJava> SourceGroupJavaMaven::getSourceGroupSettingsJava() const
{
return m_settings;
}
std::vector<FilePath> SourceGroupJavaMaven::getAllSourcePaths() const std::vector<FilePath> SourceGroupJavaMaven::getAllSourcePaths() const
{ {
std::vector<FilePath> sourcePaths; std::vector<FilePath> sourcePaths;
+6 -5
View File
@@ -12,15 +12,16 @@ class SourceGroupJavaMaven: public SourceGroupJava
public: public:
SourceGroupJavaMaven(std::shared_ptr<SourceGroupSettingsJavaMaven> settings); SourceGroupJavaMaven(std::shared_ptr<SourceGroupSettingsJavaMaven> settings);
virtual ~SourceGroupJavaMaven(); virtual ~SourceGroupJavaMaven();
virtual SourceGroupType getType() const; virtual SourceGroupType getType() const override;
virtual bool prepareIndexing(); virtual bool prepareIndexing() override;
protected: protected:
virtual std::vector<FilePath> doGetClassPath(); virtual std::vector<FilePath> doGetClassPath() const override;
private: private:
virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava(); virtual std::shared_ptr<SourceGroupSettingsJava> getSourceGroupSettingsJava() override;
virtual std::vector<FilePath> getAllSourcePaths() const; virtual std::shared_ptr<const SourceGroupSettingsJava> getSourceGroupSettingsJava() const override;
virtual std::vector<FilePath> getAllSourcePaths() const override;
bool prepareMavenData(); bool prepareMavenData();
std::shared_ptr<SourceGroupSettingsJavaMaven> m_settings; std::shared_ptr<SourceGroupSettingsJavaMaven> m_settings;