ui: added automatic include path detection for C/C++ Source Groups
This commit is contained in:
@@ -128,13 +128,17 @@ bool FilePath::isAbsolute() const
|
||||
FilePath FilePath::getParentDirectory() const
|
||||
{
|
||||
FilePath parentDirectory(m_path->parent_path());
|
||||
parentDirectory.m_checkedIsDirectory = true;
|
||||
parentDirectory.m_isDirectory = true;
|
||||
|
||||
if (m_checkedExists && m_exists)
|
||||
if (!parentDirectory.empty())
|
||||
{
|
||||
parentDirectory.m_checkedExists = true;
|
||||
parentDirectory.m_exists = true;
|
||||
parentDirectory.m_checkedIsDirectory = true;
|
||||
parentDirectory.m_isDirectory = true;
|
||||
|
||||
if (m_checkedExists && m_exists)
|
||||
{
|
||||
parentDirectory.m_checkedExists = true;
|
||||
parentDirectory.m_exists = true;
|
||||
}
|
||||
}
|
||||
|
||||
return parentDirectory;
|
||||
|
||||
@@ -30,7 +30,7 @@ std::vector<FilePath> FileSystem::getFilePathsFromDirectory(
|
||||
}
|
||||
}
|
||||
|
||||
if (boost::filesystem::is_regular_file(*it) && ext.find(it->path().extension().string()) != ext.end())
|
||||
if (boost::filesystem::is_regular_file(*it) && (ext.empty() || ext.find(it->path().extension().string()) != ext.end()))
|
||||
{
|
||||
files.push_back(FilePath(it->path().generic_string()));
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class FileSystem
|
||||
{
|
||||
public:
|
||||
static std::vector<FilePath> getFilePathsFromDirectory(
|
||||
const FilePath& path, const std::vector<std::string>& extensions);
|
||||
const FilePath& path, const std::vector<std::string>& extensions = {});
|
||||
|
||||
static FileInfo getFileInfoForPath(const FilePath& filePath);
|
||||
|
||||
|
||||
@@ -14,11 +14,12 @@ std::shared_ptr<TextAccess> TextAccess::createFromFile(const FilePath& filePath)
|
||||
return result;
|
||||
}
|
||||
|
||||
std::shared_ptr<TextAccess> TextAccess::createFromString(const std::string& text)
|
||||
std::shared_ptr<TextAccess> TextAccess::createFromString(const std::string& text, const FilePath& filePath)
|
||||
{
|
||||
std::shared_ptr<TextAccess> result(new TextAccess());
|
||||
|
||||
result->m_lines = splitStringByLines(text);
|
||||
result->m_filePath = filePath;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class TextAccess
|
||||
{
|
||||
public:
|
||||
static std::shared_ptr<TextAccess> createFromFile(const FilePath& filePath);
|
||||
static std::shared_ptr<TextAccess> createFromString(const std::string& text);
|
||||
static std::shared_ptr<TextAccess> createFromString(const std::string& text, const FilePath& filePath = FilePath());
|
||||
|
||||
virtual ~TextAccess();
|
||||
|
||||
|
||||
@@ -51,6 +51,9 @@ namespace utility
|
||||
template<typename T>
|
||||
std::vector<T> toVector(const std::set<T>& d);
|
||||
|
||||
template<typename T>
|
||||
std::set<T>toSet(const std::vector<T>& d);
|
||||
|
||||
template<typename T>
|
||||
void fillVectorWithElements(std::vector<T>& v, const T& arg);
|
||||
|
||||
@@ -191,6 +194,13 @@ std::vector<T> utility::toVector(const std::set<T>& d)
|
||||
return v;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
std::set<T> utility::toSet(const std::vector<T>& v)
|
||||
{
|
||||
std::set<T> s(v.begin(), v.end());
|
||||
return s;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
void utility::fillVectorWithElements(std::vector<T>& v, const T& arg)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user