From: Takashi Sawanaka Date: Sun, 16 Jun 2019 15:43:50 +0000 (+0900) Subject: Allow multiple in project file X-Git-Tag: 2.16.5~263 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=06f11587a6a4bd2e84dd03944e3fa04b333a8b15;p=winmerge-jp%2Fwinmerge-jp.git Allow multiple in project file --- diff --git a/Src/Merge.cpp b/Src/Merge.cpp index 00971d5bc..649c16628 100644 --- a/Src/Merge.cpp +++ b/Src/Merge.cpp @@ -1124,47 +1124,51 @@ bool CMergeApp::LoadAndOpenProjectFile(const String& sProject, const String& sRe bool bMiddleReadOnly = false; bool bRightReadOnly = false; bool bRecursive = false; - project.GetPaths(tFiles, bRecursive); - for (int i = 0; i < tFiles.size(); ++i) + bool rtn = true; + for (auto& projItem : project.Items()) { - if (!paths::IsPathAbsolute(tFiles[i])) - tFiles[i] = paths::ConcatPath(paths::GetParentPath(sProject), tFiles[i]); - } - bLeftReadOnly = project.GetLeftReadOnly(); - bMiddleReadOnly = project.GetMiddleReadOnly(); - bRightReadOnly = project.GetRightReadOnly(); - if (project.HasFilter()) - { - String filter = project.GetFilter(); - filter = strutils::trim_ws(filter); - m_pGlobalFileFilter->SetFilter(filter); - } - if (project.HasSubfolders()) - bRecursive = project.GetSubfolders() > 0; - - DWORD dwFlags[3] = { - static_cast(tFiles.GetPath(0).empty() ? FFILEOPEN_NONE : FFILEOPEN_PROJECT), - static_cast(tFiles.GetPath(1).empty() ? FFILEOPEN_NONE : FFILEOPEN_PROJECT), - static_cast(tFiles.GetPath(2).empty() ? FFILEOPEN_NONE : FFILEOPEN_PROJECT) - }; - if (bLeftReadOnly) - dwFlags[0] |= FFILEOPEN_READONLY; - if (tFiles.GetSize() == 2) - { - if (bRightReadOnly) - dwFlags[1] |= FFILEOPEN_READONLY; - } - else - { - if (bMiddleReadOnly) - dwFlags[1] |= FFILEOPEN_READONLY; - if (bRightReadOnly) - dwFlags[2] |= FFILEOPEN_READONLY; - } + projItem.GetPaths(tFiles, bRecursive); + for (int i = 0; i < tFiles.size(); ++i) + { + if (!paths::IsPathAbsolute(tFiles[i])) + tFiles[i] = paths::ConcatPath(paths::GetParentPath(sProject), tFiles[i]); + } + bLeftReadOnly = projItem.GetLeftReadOnly(); + bMiddleReadOnly = projItem.GetMiddleReadOnly(); + bRightReadOnly = projItem.GetRightReadOnly(); + if (projItem.HasFilter()) + { + String filter = projItem.GetFilter(); + filter = strutils::trim_ws(filter); + m_pGlobalFileFilter->SetFilter(filter); + } + if (projItem.HasSubfolders()) + bRecursive = projItem.GetSubfolders() > 0; + + DWORD dwFlags[3] = { + static_cast(tFiles.GetPath(0).empty() ? FFILEOPEN_NONE : FFILEOPEN_PROJECT), + static_cast(tFiles.GetPath(1).empty() ? FFILEOPEN_NONE : FFILEOPEN_PROJECT), + static_cast(tFiles.GetPath(2).empty() ? FFILEOPEN_NONE : FFILEOPEN_PROJECT) + }; + if (bLeftReadOnly) + dwFlags[0] |= FFILEOPEN_READONLY; + if (tFiles.GetSize() == 2) + { + if (bRightReadOnly) + dwFlags[1] |= FFILEOPEN_READONLY; + } + else + { + if (bMiddleReadOnly) + dwFlags[1] |= FFILEOPEN_READONLY; + if (bRightReadOnly) + dwFlags[2] |= FFILEOPEN_READONLY; + } - GetOptionsMgr()->SaveOption(OPT_CMP_INCLUDE_SUBDIRS, bRecursive); - - bool rtn = GetMainFrame()->DoFileOpen(&tFiles, dwFlags, nullptr, sReportFile, bRecursive); + GetOptionsMgr()->SaveOption(OPT_CMP_INCLUDE_SUBDIRS, bRecursive); + + rtn &= GetMainFrame()->DoFileOpen(&tFiles, dwFlags, nullptr, sReportFile, bRecursive); + } AddToRecentProjectsMRU(sProject.c_str()); return rtn; diff --git a/Src/OpenView.cpp b/Src/OpenView.cpp index 843f93567..13d4ded42 100644 --- a/Src/OpenView.cpp +++ b/Src/OpenView.cpp @@ -681,17 +681,19 @@ void COpenView::OnLoadProject() ProjectFile project; if (!theApp.LoadProjectFile(fileName, project)) return; - + if (project.Items().size() == 0) + return; PathContext paths; - project.GetPaths(paths, m_bRecurse); - project.GetLeftReadOnly(); + ProjectFileItem& projItem = *project.Items().begin(); + projItem.GetPaths(paths, m_bRecurse); + projItem.GetLeftReadOnly(); if (paths.size() < 3) { m_strPath[0] = paths[0]; m_strPath[1] = paths[1]; m_strPath[2] = _T(""); - m_bReadOnly[0] = project.GetLeftReadOnly(); - m_bReadOnly[1] = project.GetRightReadOnly(); + m_bReadOnly[0] = projItem.GetLeftReadOnly(); + m_bReadOnly[1] = projItem.GetRightReadOnly(); m_bReadOnly[2] = false; } else @@ -699,11 +701,11 @@ void COpenView::OnLoadProject() m_strPath[0] = paths[0]; m_strPath[1] = paths[1]; m_strPath[2] = paths[2]; - m_bReadOnly[0] = project.GetLeftReadOnly(); - m_bReadOnly[1] = project.GetMiddleReadOnly(); - m_bReadOnly[2] = project.GetRightReadOnly(); + m_bReadOnly[0] = projItem.GetLeftReadOnly(); + m_bReadOnly[1] = projItem.GetMiddleReadOnly(); + m_bReadOnly[2] = projItem.GetRightReadOnly(); } - m_strExt = project.GetFilter(); + m_strExt = projItem.GetFilter(); UpdateData(FALSE); LangMessageBox(IDS_PROJFILE_LOAD_SUCCESS, MB_ICONINFORMATION); @@ -721,20 +723,21 @@ void COpenView::OnSaveProject() return; ProjectFile project; + ProjectFileItem projItem; if (!m_strPath[0].empty()) - project.SetLeft(m_strPath[0], &m_bReadOnly[0]); + projItem.SetLeft(m_strPath[0], &m_bReadOnly[0]); if (m_strPath[2].empty()) { if (!m_strPath[1].empty()) - project.SetRight(m_strPath[1], &m_bReadOnly[1]); + projItem.SetRight(m_strPath[1], &m_bReadOnly[1]); } else { if (!m_strPath[1].empty()) - project.SetMiddle(m_strPath[1], &m_bReadOnly[1]); + projItem.SetMiddle(m_strPath[1], &m_bReadOnly[1]); if (!m_strPath[2].empty()) - project.SetRight(m_strPath[2], &m_bReadOnly[2]); + projItem.SetRight(m_strPath[2], &m_bReadOnly[2]); } if (!m_strExt.empty()) { @@ -747,9 +750,10 @@ void COpenView::OnSaveProject() strExt.erase(0, prefix.length()); } strExt = strutils::trim_ws_begin(strExt); - project.SetFilter(strExt); + projItem.SetFilter(strExt); } - project.SetSubfolders(m_bRecurse); + projItem.SetSubfolders(m_bRecurse); + project.Items().push_back(projItem); if (!theApp.SaveProjectFile(fileName, project)) return; @@ -1214,27 +1218,29 @@ bool COpenView::LoadProjectFile(const String &path) if (!theApp.LoadProjectFile(path, prj)) return false; - + if (prj.Items().size() == 0) + return false; bool recurse; - prj.GetPaths(m_files, recurse); + ProjectFileItem& projItem = *prj.Items().begin(); + projItem.GetPaths(m_files, recurse); m_bRecurse = recurse; m_dwFlags[0] &= ~FFILEOPEN_READONLY; - m_dwFlags[0] |= prj.GetLeftReadOnly() ? FFILEOPEN_READONLY : 0; + m_dwFlags[0] |= projItem.GetLeftReadOnly() ? FFILEOPEN_READONLY : 0; if (m_files.GetSize() < 3) { m_dwFlags[1] &= ~FFILEOPEN_READONLY; - m_dwFlags[1] |= prj.GetRightReadOnly() ? FFILEOPEN_READONLY : 0; + m_dwFlags[1] |= projItem.GetRightReadOnly() ? FFILEOPEN_READONLY : 0; } else { m_dwFlags[1] &= ~FFILEOPEN_READONLY; - m_dwFlags[1] |= prj.GetMiddleReadOnly() ? FFILEOPEN_READONLY : 0; + m_dwFlags[1] |= projItem.GetMiddleReadOnly() ? FFILEOPEN_READONLY : 0; m_dwFlags[2] &= ~FFILEOPEN_READONLY; - m_dwFlags[2] |= prj.GetRightReadOnly() ? FFILEOPEN_READONLY : 0; + m_dwFlags[2] |= projItem.GetRightReadOnly() ? FFILEOPEN_READONLY : 0; } - if (prj.HasFilter()) + if (projItem.HasFilter()) { - m_strExt = strutils::trim_ws(prj.GetFilter()); + m_strExt = strutils::trim_ws(projItem.GetFilter()); if (m_strExt[0] != '*') m_strExt.insert(0, filterPrefix); } diff --git a/Src/ProjectFile.cpp b/Src/ProjectFile.cpp index 8955bba42..8beff244f 100755 --- a/Src/ProjectFile.cpp +++ b/Src/ProjectFile.cpp @@ -76,13 +76,15 @@ void writeElement(XMLWriter& writer, const std::string& tagname, const std::stri class ProjectFileHandler: public ContentHandler { public: - explicit ProjectFileHandler(ProjectFile *pProject) : m_pProject(pProject) {} + explicit ProjectFileHandler(std::list *pProject) : m_pProject(pProject) {} void setDocumentLocator(const Locator* loc) {} void startDocument() {} void endDocument() {} void startElement(const XMLString& uri, const XMLString& localName, const XMLString& qname, const Attributes& attributes) { + if (localName == Paths_element_name) + m_pProject->push_back(ProjectFileItem{}); m_stack.push(localName); } void endElement(const XMLString& uri, const XMLString& localName, const XMLString& qname) @@ -91,46 +93,48 @@ public: } void characters(const XMLChar ch[], int start, int length) { - if (m_stack.size() != 3) + if (m_stack.size() != 3 && m_pProject->size() == 0) return; + ProjectFileItem& currentItem = m_pProject->back(); + const std::string& nodename = m_stack.top(); if (nodename == Left_element_name) { - m_pProject->m_paths.SetLeft(m_pProject->m_paths.GetLeft() + xmlch2tstr(ch + start, length), false); - m_pProject->m_bHasLeft = true; + currentItem.m_paths.SetLeft(currentItem.m_paths.GetLeft() + xmlch2tstr(ch + start, length), false); + currentItem.m_bHasLeft = true; } else if (nodename == Middle_element_name) { - m_pProject->m_paths.SetMiddle(m_pProject->m_paths.GetMiddle() + xmlch2tstr(ch + start, length), false); - m_pProject->m_bHasMiddle = true; + currentItem.m_paths.SetMiddle(currentItem.m_paths.GetMiddle() + xmlch2tstr(ch + start, length), false); + currentItem.m_bHasMiddle = true; } else if (nodename == Right_element_name) { - m_pProject->m_paths.SetRight(m_pProject->m_paths.GetRight() + xmlch2tstr(ch + start, length), false); - m_pProject->m_bHasRight = true; + currentItem.m_paths.SetRight(currentItem.m_paths.GetRight() + xmlch2tstr(ch + start, length), false); + currentItem.m_bHasRight = true; } else if (nodename == Filter_element_name) { - m_pProject->m_filter += xmlch2tstr(ch + start, length); - m_pProject->m_bHasFilter = true; + currentItem.m_filter += xmlch2tstr(ch + start, length); + currentItem.m_bHasFilter = true; } else if (nodename == Subfolders_element_name) { - m_pProject->m_subfolders = atoi(std::string(ch + start, length).c_str()); - m_pProject->m_bHasSubfolders = true; + currentItem.m_subfolders = atoi(std::string(ch + start, length).c_str()); + currentItem.m_bHasSubfolders = true; } else if (nodename == Left_ro_element_name) { - m_pProject->m_bLeftReadOnly = atoi(std::string(ch + start, length).c_str()) != 0; + currentItem.m_bLeftReadOnly = atoi(std::string(ch + start, length).c_str()) != 0; } else if (nodename == Middle_ro_element_name) { - m_pProject->m_bMiddleReadOnly = atoi(std::string(ch + start, length).c_str()) != 0; + currentItem.m_bMiddleReadOnly = atoi(std::string(ch + start, length).c_str()) != 0; } else if (nodename == Right_ro_element_name) { - m_pProject->m_bRightReadOnly = atoi(std::string(ch + start, length).c_str()) != 0; + currentItem.m_bRightReadOnly = atoi(std::string(ch + start, length).c_str()) != 0; } } void ignorableWhitespace(const XMLChar ch[], int start, int length) {} @@ -140,7 +144,7 @@ public: void skippedEntity(const XMLString& name) {} private: - ProjectFile *m_pProject; + std::list *m_pProject = nullptr; std::stack m_stack; }; @@ -150,7 +154,7 @@ const String ProjectFile::PROJECTFILE_EXT = toTString("WinMerge"); /** * @brief Standard constructor. */ - ProjectFile::ProjectFile() + ProjectFileItem::ProjectFileItem() : m_bHasLeft(false) , m_bHasMiddle(false) , m_bHasRight(false) @@ -164,61 +168,10 @@ const String ProjectFile::PROJECTFILE_EXT = toTString("WinMerge"); } /** - * @brief Open given path-file and read data from it to member variables. - * @param [in] path Path to project file. - * @param [out] sError Error string if error happened. - * @return true if reading succeeded, false if error happened. - */ -bool ProjectFile::Read(const String& path) -{ - ProjectFileHandler handler(this); - SAXParser parser; - parser.setContentHandler(&handler); - parser.parse(toUTF8(path)); - return true; -} - -/** - * @brief Save data from member variables to path-file. - * @param [in] path Path to project file. - * @param [out] sError Error string if error happened. - * @return true if saving succeeded, false if error happened. - */ -bool ProjectFile::Save(const String& path) const -{ - FileStream out(toUTF8(path), FileStream::trunc); - XMLWriter writer(out, XMLWriter::WRITE_XML_DECLARATION | XMLWriter::PRETTY_PRINT); - writer.startDocument(); - writer.startElement("", "", Root_element_name); - { - writer.startElement("", "", Paths_element_name); - { - if (!m_paths.GetLeft().empty()) - writeElement(writer, Left_element_name, toUTF8(m_paths.GetLeft())); - if (!m_paths.GetMiddle().empty()) - writeElement(writer, Middle_element_name, toUTF8(m_paths.GetMiddle())); - if (!m_paths.GetRight().empty()) - writeElement(writer, Right_element_name, toUTF8(m_paths.GetRight())); - if (!m_filter.empty()) - writeElement(writer, Filter_element_name, toUTF8(m_filter)); - writeElement(writer, Subfolders_element_name, m_subfolders != 0 ? "1" : "0"); - writeElement(writer, Left_ro_element_name, m_bLeftReadOnly ? "1" : "0"); - if (!m_paths.GetMiddle().empty()) - writeElement(writer, Middle_ro_element_name, m_bMiddleReadOnly ? "1" : "0"); - writeElement(writer, Right_ro_element_name, m_bRightReadOnly ? "1" : "0"); - } - writer.endElement("", "", Paths_element_name); - } - writer.endElement("", "", Root_element_name); - writer.endDocument(); - return true; -} - -/** * @brief Returns if left path is defined in project file. * @return true if project file has left path. */ -bool ProjectFile::HasLeft() const +bool ProjectFileItem::HasLeft() const { return m_bHasLeft; } @@ -226,7 +179,7 @@ bool ProjectFile::HasLeft() const /** * @brief Returns if middle path is defined. */ -bool ProjectFile::HasMiddle() const +bool ProjectFileItem::HasMiddle() const { return m_bHasMiddle; } @@ -235,7 +188,7 @@ bool ProjectFile::HasMiddle() const * @brief Returns if right path is defined in project file. * @return true if project file has right path. */ -bool ProjectFile::HasRight() const +bool ProjectFileItem::HasRight() const { return m_bHasRight; } @@ -244,7 +197,7 @@ bool ProjectFile::HasRight() const * @brief Returns if filter is defined in project file. * @return true if project file has filter. */ -bool ProjectFile::HasFilter() const +bool ProjectFileItem::HasFilter() const { return m_bHasFilter; } @@ -253,7 +206,7 @@ bool ProjectFile::HasFilter() const * @brief Returns if subfolder is defined in projectfile. * @return true if project file has subfolder definition. */ -bool ProjectFile::HasSubfolders() const +bool ProjectFileItem::HasSubfolders() const { return m_bHasSubfolders; } @@ -263,7 +216,7 @@ bool ProjectFile::HasSubfolders() const * @param [out] pReadOnly true if readonly was specified for path. * @return Left path. */ -String ProjectFile::GetLeft(bool * pReadOnly /*= nullptr*/) const +String ProjectFileItem::GetLeft(bool * pReadOnly /*= nullptr*/) const { if (pReadOnly != nullptr) *pReadOnly = m_bLeftReadOnly; @@ -274,7 +227,7 @@ String ProjectFile::GetLeft(bool * pReadOnly /*= nullptr*/) const * @brief Returns if left path is specified read-only. * @return true if left path is read-only, false otherwise. */ -bool ProjectFile::GetLeftReadOnly() const +bool ProjectFileItem::GetLeftReadOnly() const { return m_bLeftReadOnly; } @@ -284,7 +237,7 @@ bool ProjectFile::GetLeftReadOnly() const * @param [in] sLeft Left path. * @param [in] bReadOnly Will path be recorded read-only? */ -void ProjectFile::SetLeft(const String& sLeft, const bool * pReadOnly /*= nullptr*/) +void ProjectFileItem::SetLeft(const String& sLeft, const bool * pReadOnly /*= nullptr*/) { m_paths.SetLeft(sLeft, false); if (pReadOnly != nullptr) @@ -295,7 +248,7 @@ void ProjectFile::SetLeft(const String& sLeft, const bool * pReadOnly /*= nullpt * @brief Returns middle path. * @param [out] pReadOnly true if readonly was specified for path. */ -String ProjectFile::GetMiddle(bool * pReadOnly /*= nullptr*/) const +String ProjectFileItem::GetMiddle(bool * pReadOnly /*= nullptr*/) const { if (pReadOnly != nullptr) *pReadOnly = m_bMiddleReadOnly; @@ -305,7 +258,7 @@ String ProjectFile::GetMiddle(bool * pReadOnly /*= nullptr*/) const /** * @brief Returns if middle path is specified read-only. */ -bool ProjectFile::GetMiddleReadOnly() const +bool ProjectFileItem::GetMiddleReadOnly() const { return m_bMiddleReadOnly; } @@ -315,7 +268,7 @@ bool ProjectFile::GetMiddleReadOnly() const * @param [in] sMiddle Middle path. * @param [in] bReadOnly Will path be recorded read-only? */ -void ProjectFile::SetMiddle(const String& sMiddle, const bool * pReadOnly /*= nullptr*/) +void ProjectFileItem::SetMiddle(const String& sMiddle, const bool * pReadOnly /*= nullptr*/) { m_paths.SetMiddle(sMiddle, false); if (pReadOnly != nullptr) @@ -329,7 +282,7 @@ void ProjectFile::SetMiddle(const String& sMiddle, const bool * pReadOnly /*= nu * @param [out] pReadOnly true if readonly was specified for path. * @return Right path. */ -String ProjectFile::GetRight(bool * pReadOnly /*= nullptr*/) const +String ProjectFileItem::GetRight(bool * pReadOnly /*= nullptr*/) const { if (pReadOnly != nullptr) *pReadOnly = m_bRightReadOnly; @@ -340,7 +293,7 @@ String ProjectFile::GetRight(bool * pReadOnly /*= nullptr*/) const * @brief Returns if right path is specified read-only. * @return true if right path is read-only, false otherwise. */ -bool ProjectFile::GetRightReadOnly() const +bool ProjectFileItem::GetRightReadOnly() const { return m_bRightReadOnly; } @@ -350,7 +303,7 @@ bool ProjectFile::GetRightReadOnly() const * @param [in] sRight Right path. * @param [in] bReadOnly Will path be recorded read-only? */ -void ProjectFile::SetRight(const String& sRight, const bool * pReadOnly /*= nullptr*/) +void ProjectFileItem::SetRight(const String& sRight, const bool * pReadOnly /*= nullptr*/) { m_paths.SetRight(sRight, false); if (pReadOnly != nullptr) @@ -361,7 +314,7 @@ void ProjectFile::SetRight(const String& sRight, const bool * pReadOnly /*= null * @brief Returns filter. * @return Filter string. */ -String ProjectFile::GetFilter() const +String ProjectFileItem::GetFilter() const { return m_filter; } @@ -370,7 +323,7 @@ String ProjectFile::GetFilter() const * @brief Set filter. * @param [in] sFilter New filter string to set. */ -void ProjectFile::SetFilter(const String& sFilter) +void ProjectFileItem::SetFilter(const String& sFilter) { m_filter = sFilter; } @@ -379,7 +332,7 @@ void ProjectFile::SetFilter(const String& sFilter) * @brief Returns subfolder included -setting. * @return != 0 if subfolders are included. */ -int ProjectFile::GetSubfolders() const +int ProjectFileItem::GetSubfolders() const { return m_subfolders; } @@ -388,7 +341,7 @@ int ProjectFile::GetSubfolders() const * @brief set subfolder. * @param [in] iSubfolder New value for subfolder inclusion. */ -void ProjectFile::SetSubfolders(bool bSubfolder) +void ProjectFileItem::SetSubfolders(bool bSubfolder) { m_subfolders = bSubfolder ? 1 : 0; } @@ -399,7 +352,7 @@ void ProjectFile::SetSubfolders(bool bSubfolder) * @param [in] files Files in project * @param [in] bSubFolders If true subfolders included (recursive compare) */ -void ProjectFile::SetPaths(const PathContext& files, bool bSubfolders) +void ProjectFileItem::SetPaths(const PathContext& files, bool bSubfolders) { m_paths = files; m_subfolders = bSubfolders; @@ -411,9 +364,64 @@ void ProjectFile::SetPaths(const PathContext& files, bool bSubfolders) * @param [out] files Files in project * @param [out] bSubFolders If true subfolders included (recursive compare) */ -void ProjectFile::GetPaths(PathContext& files, bool & bSubfolders) const +void ProjectFileItem::GetPaths(PathContext& files, bool & bSubfolders) const { files = m_paths; if (HasSubfolders()) bSubfolders = (GetSubfolders() == 1); } + +/** + * @brief Open given path-file and read data from it to member variables. + * @param [in] path Path to project file. + * @param [out] sError Error string if error happened. + * @return true if reading succeeded, false if error happened. + */ +bool ProjectFile::Read(const String& path) +{ + ProjectFileHandler handler(&m_items); + SAXParser parser; + parser.setContentHandler(&handler); + parser.parse(toUTF8(path)); + return true; +} + +/** + * @brief Save data from member variables to path-file. + * @param [in] path Path to project file. + * @param [out] sError Error string if error happened. + * @return true if saving succeeded, false if error happened. + */ +bool ProjectFile::Save(const String& path) const +{ + FileStream out(toUTF8(path), FileStream::trunc); + XMLWriter writer(out, XMLWriter::WRITE_XML_DECLARATION | XMLWriter::PRETTY_PRINT); + writer.startDocument(); + writer.startElement("", "", Root_element_name); + { + for (auto& item : m_items) + { + writer.startElement("", "", Paths_element_name); + { + if (!item.m_paths.GetLeft().empty()) + writeElement(writer, Left_element_name, toUTF8(item.m_paths.GetLeft())); + if (!item.m_paths.GetMiddle().empty()) + writeElement(writer, Middle_element_name, toUTF8(item.m_paths.GetMiddle())); + if (!item.m_paths.GetRight().empty()) + writeElement(writer, Right_element_name, toUTF8(item.m_paths.GetRight())); + if (!item.m_filter.empty()) + writeElement(writer, Filter_element_name, toUTF8(item.m_filter)); + writeElement(writer, Subfolders_element_name, item.m_subfolders != 0 ? "1" : "0"); + writeElement(writer, Left_ro_element_name, item.m_bLeftReadOnly ? "1" : "0"); + if (!item.m_paths.GetMiddle().empty()) + writeElement(writer, Middle_ro_element_name, item.m_bMiddleReadOnly ? "1" : "0"); + writeElement(writer, Right_ro_element_name, item.m_bRightReadOnly ? "1" : "0"); + } + writer.endElement("", "", Paths_element_name); + } + } + writer.endElement("", "", Root_element_name); + writer.endDocument(); + return true; +} + diff --git a/Src/ProjectFile.h b/Src/ProjectFile.h index 38745265e..73b5b1551 100755 --- a/Src/ProjectFile.h +++ b/Src/ProjectFile.h @@ -24,21 +24,12 @@ #include "UnicodeString.h" #include "PathContext.h" -/** - * @brief Class for handling project files. - * - * This class loads and saves project files. Expat parser and SCEW wrapper for - * expat are used for XML parsing. We use UTF-8 encoding so Unicode paths are - * supported. - */ -class ProjectFile +class ProjectFileItem { + friend class ProjectFile; friend class ProjectFileHandler; public: - ProjectFile(); - bool Read(const String& path); - bool Save(const String& path) const; - + ProjectFileItem(); bool HasLeft() const; bool HasMiddle() const; bool HasRight() const; @@ -63,8 +54,6 @@ public: void GetPaths(PathContext& files, bool & bSubFolders) const; void SetPaths(const PathContext& files, bool bSubFolders = false); - static const String PROJECTFILE_EXT; - private: PathContext m_paths; bool m_bHasLeft; /**< Has left path? */ @@ -78,3 +67,22 @@ private: bool m_bMiddleReadOnly; /**< Is middle path opened as read-only */ bool m_bRightReadOnly; /**< Is right path opened as read-only */ }; + +/** + * @brief Class for handling project files. + * + * This class loads and saves project files. Expat parser and SCEW wrapper for + * expat are used for XML parsing. We use UTF-8 encoding so Unicode paths are + * supported. + */ +class ProjectFile +{ +public: + bool Read(const String& path); + bool Save(const String& path) const; + const std::list& Items() const { return m_items; }; + std::list& Items() { return m_items; } + static const String PROJECTFILE_EXT; +private: + std::list m_items; +}; diff --git a/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRight.cpp b/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRight.cpp index a7a586748..94e6ce9f2 100644 --- a/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRight.cpp +++ b/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRight.cpp @@ -22,7 +22,7 @@ namespace class LeftAndRightTest : public testing::Test { protected: - LeftAndRightTest() : m_pProjectFile(nullptr) + LeftAndRightTest() : m_pProjectFile(nullptr), m_pProjectFileItem(nullptr) { // You can do set-up work for each test here. } @@ -54,6 +54,7 @@ protected: // Objects declared here can be used by all tests in the test case for Foo. ProjectFile *m_pProjectFile; + ProjectFileItem *m_pProjectFileItem; }; /** @@ -80,16 +81,16 @@ TEST_F(LeftAndRightTest, Load) TEST_F(LeftAndRightTest, GetLeftPath) { // Has left path - bool bIsLeft = m_pProjectFile->HasLeft(); + bool bIsLeft = m_pProjectFileItem->HasLeft(); ASSERT_TRUE(bIsLeft == true); // Get left path without read-only info - String left = m_pProjectFile->GetLeft(); + String left = m_pProjectFileItem->GetLeft(); ASSERT_TRUE(left.compare(LeftPath) == 0); // Get left path with read-only info bool bReadOnly; - left = m_pProjectFile->GetLeft(&bReadOnly); + left = m_pProjectFileItem->GetLeft(&bReadOnly); ASSERT_TRUE(left.compare(LeftPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -100,16 +101,16 @@ TEST_F(LeftAndRightTest, GetLeftPath) TEST_F(LeftAndRightTest, GetRightPath) { // Has right path - bool bIsRight = m_pProjectFile->HasRight(); + bool bIsRight = m_pProjectFileItem->HasRight(); ASSERT_TRUE(bIsRight == true); // Get right path without read-only info - String right = m_pProjectFile->GetRight(); + String right = m_pProjectFileItem->GetRight(); ASSERT_TRUE(right.compare(RightPath) == 0); // Get right path with read-only info bool bReadOnly; - right = m_pProjectFile->GetRight(&bReadOnly); + right = m_pProjectFileItem->GetRight(&bReadOnly); ASSERT_TRUE(right.compare(RightPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -120,11 +121,11 @@ TEST_F(LeftAndRightTest, GetRightPath) TEST_F(LeftAndRightTest, GetSubfolders) { // We don't have a subfolders - bool bHasSubfolders = m_pProjectFile->HasSubfolders(); + bool bHasSubfolders = m_pProjectFileItem->HasSubfolders(); ASSERT_TRUE(bHasSubfolders == false); // Returns -1 if not set - int subfolders = m_pProjectFile->GetSubfolders(); + int subfolders = m_pProjectFileItem->GetSubfolders(); ASSERT_TRUE(subfolders == -1); } @@ -134,10 +135,10 @@ TEST_F(LeftAndRightTest, GetSubfolders) TEST_F(LeftAndRightTest, GetFilter) { // We don't have a filter - bool bHasFilter = m_pProjectFile->HasFilter(); + bool bHasFilter = m_pProjectFileItem->HasFilter(); ASSERT_TRUE(bHasFilter == false); - String filter = m_pProjectFile->GetFilter(); + String filter = m_pProjectFileItem->GetFilter(); ASSERT_TRUE(filter.empty()); } diff --git a/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRightNonRecursive.cpp b/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRightNonRecursive.cpp index a4255cc5b..d8837f338 100644 --- a/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRightNonRecursive.cpp +++ b/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRightNonRecursive.cpp @@ -22,7 +22,7 @@ namespace class LeftAndRightNonRecursiveTest : public testing::Test { protected: - LeftAndRightNonRecursiveTest() : m_pProjectFile(nullptr) + LeftAndRightNonRecursiveTest() : m_pProjectFile(nullptr), m_pProjectFileItem(nullptr) { // You can do set-up work for each test here. } @@ -43,6 +43,8 @@ protected: m_pProjectFile = new ProjectFile; bool success = m_pProjectFile->Read(FileName); + m_pProjectFileItem = &*m_pProjectFile->Items().begin(); + } virtual void TearDown() @@ -54,6 +56,7 @@ protected: // Objects declared here can be used by all tests in the test case for Foo. ProjectFile *m_pProjectFile; + ProjectFileItem *m_pProjectFileItem; }; /** @@ -80,16 +83,16 @@ TEST_F(LeftAndRightNonRecursiveTest, Load) TEST_F(LeftAndRightNonRecursiveTest, GetLeftPath) { // Has left path - bool bIsLeft = m_pProjectFile->HasLeft(); + bool bIsLeft = m_pProjectFileItem->HasLeft(); ASSERT_TRUE(bIsLeft == true); // Get left path without read-only info - String left = m_pProjectFile->GetLeft(); + String left = m_pProjectFileItem->GetLeft(); ASSERT_TRUE(left.compare(LeftPath) == 0); // Get left path with read-only info bool bReadOnly; - left = m_pProjectFile->GetLeft(&bReadOnly); + left = m_pProjectFileItem->GetLeft(&bReadOnly); ASSERT_TRUE(left.compare(LeftPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -100,16 +103,16 @@ TEST_F(LeftAndRightNonRecursiveTest, GetLeftPath) TEST_F(LeftAndRightNonRecursiveTest, GetRightPath) { // Has right path - bool bIsRight = m_pProjectFile->HasRight(); + bool bIsRight = m_pProjectFileItem->HasRight(); ASSERT_TRUE(bIsRight == true); // Get right path without read-only info - String right = m_pProjectFile->GetRight(); + String right = m_pProjectFileItem->GetRight(); ASSERT_TRUE(right.compare(RightPath) == 0); // Get right path with read-only info bool bReadOnly; - right = m_pProjectFile->GetRight(&bReadOnly); + right = m_pProjectFileItem->GetRight(&bReadOnly); ASSERT_TRUE(right.compare(RightPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -120,11 +123,11 @@ TEST_F(LeftAndRightNonRecursiveTest, GetRightPath) TEST_F(LeftAndRightNonRecursiveTest, GetSubfolders) { // Now we have subfolders - bool bHasSubfolders = m_pProjectFile->HasSubfolders(); + bool bHasSubfolders = m_pProjectFileItem->HasSubfolders(); ASSERT_TRUE(bHasSubfolders == true); // But the setting says we don't want recursive compare - int subfolders = m_pProjectFile->GetSubfolders(); + int subfolders = m_pProjectFileItem->GetSubfolders(); ASSERT_TRUE(subfolders == 0); } @@ -134,10 +137,10 @@ TEST_F(LeftAndRightNonRecursiveTest, GetSubfolders) TEST_F(LeftAndRightNonRecursiveTest, GetFilter) { // We don't have a filter - bool bHasFilter = m_pProjectFile->HasFilter(); + bool bHasFilter = m_pProjectFileItem->HasFilter(); ASSERT_TRUE(bHasFilter == false); - String filter = m_pProjectFile->GetFilter(); + String filter = m_pProjectFileItem->GetFilter(); ASSERT_TRUE(filter.empty()); } diff --git a/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRightRecursive.cpp b/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRightRecursive.cpp index 88b5d7166..2c7c88e29 100644 --- a/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRightRecursive.cpp +++ b/Testing/GoogleTest/ProjectFile/ProjectFile_test_LeftAndRightRecursive.cpp @@ -22,7 +22,7 @@ namespace class LeftAndRightRecursiveTest : public testing::Test { protected: - LeftAndRightRecursiveTest() : m_pProjectFile(nullptr) + LeftAndRightRecursiveTest() : m_pProjectFile(nullptr),m_pProjectFileItem(nullptr) { // You can do set-up work for each test here. } @@ -43,6 +43,8 @@ protected: m_pProjectFile = new ProjectFile; bool success = m_pProjectFile->Read(FileName); + m_pProjectFileItem = &*m_pProjectFile->Items().begin(); + } virtual void TearDown() @@ -54,6 +56,7 @@ protected: // Objects declared here can be used by all tests in the test case for Foo. ProjectFile *m_pProjectFile; + ProjectFileItem *m_pProjectFileItem; }; /** @@ -80,16 +83,16 @@ TEST_F(LeftAndRightRecursiveTest, Load) TEST_F(LeftAndRightRecursiveTest, GetLeftPath) { // Has left path - bool bIsLeft = m_pProjectFile->HasLeft(); + bool bIsLeft = m_pProjectFileItem->HasLeft(); ASSERT_TRUE(bIsLeft == true); // Get left path without read-only info - String left = m_pProjectFile->GetLeft(); + String left = m_pProjectFileItem->GetLeft(); ASSERT_TRUE(left.compare(LeftPath) == 0); // Get left path with read-only info bool bReadOnly; - left = m_pProjectFile->GetLeft(&bReadOnly); + left = m_pProjectFileItem->GetLeft(&bReadOnly); ASSERT_TRUE(left.compare(LeftPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -100,16 +103,16 @@ TEST_F(LeftAndRightRecursiveTest, GetLeftPath) TEST_F(LeftAndRightRecursiveTest, GetRightPath) { // Has right path - bool bIsRight = m_pProjectFile->HasRight(); + bool bIsRight = m_pProjectFileItem->HasRight(); ASSERT_TRUE(bIsRight == true); // Get right path without read-only info - String right = m_pProjectFile->GetRight(); + String right = m_pProjectFileItem->GetRight(); ASSERT_TRUE(right.compare(RightPath) == 0); // Get right path with read-only info bool bReadOnly; - right = m_pProjectFile->GetRight(&bReadOnly); + right = m_pProjectFileItem->GetRight(&bReadOnly); ASSERT_TRUE(right.compare(RightPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -120,10 +123,10 @@ TEST_F(LeftAndRightRecursiveTest, GetRightPath) TEST_F(LeftAndRightRecursiveTest, GetSubfolders) { // Now we have subfolders - bool bHasSubfolders = m_pProjectFile->HasSubfolders(); + bool bHasSubfolders = m_pProjectFileItem->HasSubfolders(); ASSERT_TRUE(bHasSubfolders == true); - int subfolders = m_pProjectFile->GetSubfolders(); + int subfolders = m_pProjectFileItem->GetSubfolders(); ASSERT_TRUE(subfolders == 1); } @@ -133,10 +136,10 @@ TEST_F(LeftAndRightRecursiveTest, GetSubfolders) TEST_F(LeftAndRightRecursiveTest, GetFilter) { // We don't have a filter - bool bHasFilter = m_pProjectFile->HasFilter(); + bool bHasFilter = m_pProjectFileItem->HasFilter(); ASSERT_TRUE(bHasFilter == false); - String filter = m_pProjectFile->GetFilter(); + String filter = m_pProjectFileItem->GetFilter(); ASSERT_TRUE(filter.empty()); } diff --git a/Testing/GoogleTest/ProjectFile/ProjectFile_test_PathsAndFilter.cpp b/Testing/GoogleTest/ProjectFile/ProjectFile_test_PathsAndFilter.cpp index 772158f26..f4f1ddde4 100644 --- a/Testing/GoogleTest/ProjectFile/ProjectFile_test_PathsAndFilter.cpp +++ b/Testing/GoogleTest/ProjectFile/ProjectFile_test_PathsAndFilter.cpp @@ -24,7 +24,7 @@ namespace class PathAndFilterTest : public testing::Test { protected: - PathAndFilterTest() : m_pProjectFile(nullptr) + PathAndFilterTest() : m_pProjectFile(nullptr), m_pProjectFileItem(nullptr) { // You can do set-up work for each test here. } @@ -45,6 +45,7 @@ protected: m_pProjectFile = new ProjectFile; bool success = m_pProjectFile->Read(FileName); + m_pProjectFileItem = &*m_pProjectFile->Items().begin(); } virtual void TearDown() @@ -56,6 +57,7 @@ protected: // Objects declared here can be used by all tests in the test case for Foo. ProjectFile *m_pProjectFile; + ProjectFileItem *m_pProjectFileItem; }; /** @@ -82,16 +84,16 @@ TEST_F(PathAndFilterTest, Load) TEST_F(PathAndFilterTest, GetLeftPath) { // Has left path - bool bIsLeft = m_pProjectFile->HasLeft(); + bool bIsLeft = m_pProjectFileItem->HasLeft(); ASSERT_TRUE(bIsLeft == true); // Get left path without read-only info - String left = m_pProjectFile->GetLeft(); + String left = m_pProjectFileItem->GetLeft(); ASSERT_TRUE(left.compare(LeftPath) == 0); // Get left path with read-only info bool bReadOnly; - left = m_pProjectFile->GetLeft(&bReadOnly); + left = m_pProjectFileItem->GetLeft(&bReadOnly); ASSERT_TRUE(left.compare(LeftPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -102,16 +104,16 @@ TEST_F(PathAndFilterTest, GetLeftPath) TEST_F(PathAndFilterTest, GetRightPath) { // Has right path - bool bIsRight = m_pProjectFile->HasRight(); + bool bIsRight = m_pProjectFileItem->HasRight(); ASSERT_TRUE(bIsRight == true); // Get right path without read-only info - String right = m_pProjectFile->GetRight(); + String right = m_pProjectFileItem->GetRight(); ASSERT_TRUE(right.compare(RightPath) == 0); // Get right path with read-only info bool bReadOnly; - right = m_pProjectFile->GetRight(&bReadOnly); + right = m_pProjectFileItem->GetRight(&bReadOnly); ASSERT_TRUE(right.compare(RightPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -122,11 +124,11 @@ TEST_F(PathAndFilterTest, GetRightPath) TEST_F(PathAndFilterTest, GetSubfolders) { // We don't have a subfolders - bool bHasSubfolders = m_pProjectFile->HasSubfolders(); + bool bHasSubfolders = m_pProjectFileItem->HasSubfolders(); ASSERT_TRUE(bHasSubfolders == false); // Returns -1 if not set - int subfolders = m_pProjectFile->GetSubfolders(); + int subfolders = m_pProjectFileItem->GetSubfolders(); ASSERT_TRUE(subfolders == -1); } @@ -136,10 +138,10 @@ TEST_F(PathAndFilterTest, GetSubfolders) TEST_F(PathAndFilterTest, GetFilter) { // Now we have a filter - bool bHasFilter = m_pProjectFile->HasFilter(); + bool bHasFilter = m_pProjectFileItem->HasFilter(); ASSERT_TRUE(bHasFilter == true); - String filter = m_pProjectFile->GetFilter(); + String filter = m_pProjectFileItem->GetFilter(); ASSERT_TRUE(filter.compare(Filter) == 0); } diff --git a/Testing/GoogleTest/ProjectFile/ProjectFile_test_SimpleLeft.cpp b/Testing/GoogleTest/ProjectFile/ProjectFile_test_SimpleLeft.cpp index 20ea4b594..6b138472c 100644 --- a/Testing/GoogleTest/ProjectFile/ProjectFile_test_SimpleLeft.cpp +++ b/Testing/GoogleTest/ProjectFile/ProjectFile_test_SimpleLeft.cpp @@ -20,7 +20,7 @@ namespace class SimpleLeftTest : public testing::Test { protected: - SimpleLeftTest() : m_pProjectFile(nullptr) + SimpleLeftTest() : m_pProjectFile(nullptr), m_pProjectFileItem(nullptr) { // You can do set-up work for each test here. } @@ -41,6 +41,7 @@ protected: m_pProjectFile = new ProjectFile; bool success = m_pProjectFile->Read(FileName); + m_pProjectFileItem = &*m_pProjectFile->Items().begin(); } virtual void TearDown() @@ -52,6 +53,7 @@ protected: // Objects declared here can be used by all tests in the test case for Foo. ProjectFile *m_pProjectFile; + ProjectFileItem *m_pProjectFileItem; }; /** @@ -78,16 +80,16 @@ TEST_F(SimpleLeftTest, Load) TEST_F(SimpleLeftTest, GetLeftPath) { // Has left path (only) - bool bIsLeft = m_pProjectFile->HasLeft(); + bool bIsLeft = m_pProjectFileItem->HasLeft(); ASSERT_TRUE(bIsLeft == true); // Get left path without read-only info - String left = m_pProjectFile->GetLeft(); + String left = m_pProjectFileItem->GetLeft(); ASSERT_TRUE(left.compare(LeftPath) == 0); // Get left path with read-only info bool bReadOnly; - left = m_pProjectFile->GetLeft(&bReadOnly); + left = m_pProjectFileItem->GetLeft(&bReadOnly); ASSERT_TRUE(left.compare(LeftPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -98,16 +100,16 @@ TEST_F(SimpleLeftTest, GetLeftPath) TEST_F(SimpleLeftTest, GetRightPath) { // We don't have right path - bool bIsRight = m_pProjectFile->HasRight(); + bool bIsRight = m_pProjectFileItem->HasRight(); ASSERT_TRUE(bIsRight == false); // Get right path without read-only info - String right = m_pProjectFile->GetRight(); + String right = m_pProjectFileItem->GetRight(); ASSERT_TRUE(right.empty()); // Get right path with read-only info bool bReadOnly; - right = m_pProjectFile->GetRight(&bReadOnly); + right = m_pProjectFileItem->GetRight(&bReadOnly); ASSERT_TRUE(right.empty()); ASSERT_TRUE(bReadOnly == false); } @@ -118,11 +120,11 @@ TEST_F(SimpleLeftTest, GetRightPath) TEST_F(SimpleLeftTest, GetSubfolders) { // We don't have a subfolders - bool bHasSubfolders = m_pProjectFile->HasSubfolders(); + bool bHasSubfolders = m_pProjectFileItem->HasSubfolders(); ASSERT_TRUE(bHasSubfolders == false); // Returns -1 if not set - int subfolders = m_pProjectFile->GetSubfolders(); + int subfolders = m_pProjectFileItem->GetSubfolders(); ASSERT_TRUE(subfolders == -1); } @@ -132,10 +134,10 @@ TEST_F(SimpleLeftTest, GetSubfolders) TEST_F(SimpleLeftTest, GetFilter) { // We don't have a filter - bool bHasFilter = m_pProjectFile->HasFilter(); + bool bHasFilter = m_pProjectFileItem->HasFilter(); ASSERT_TRUE(bHasFilter == false); - String filter = m_pProjectFile->GetFilter(); + String filter = m_pProjectFileItem->GetFilter(); ASSERT_TRUE(filter.empty()); } diff --git a/Testing/GoogleTest/ProjectFile/ProjectFile_test_SimpleRight.cpp b/Testing/GoogleTest/ProjectFile/ProjectFile_test_SimpleRight.cpp index 37a10cd1b..ded725c93 100644 --- a/Testing/GoogleTest/ProjectFile/ProjectFile_test_SimpleRight.cpp +++ b/Testing/GoogleTest/ProjectFile/ProjectFile_test_SimpleRight.cpp @@ -20,7 +20,7 @@ namespace class SimpleRightTest : public testing::Test { protected: - SimpleRightTest() : m_pProjectFile(nullptr) + SimpleRightTest() : m_pProjectFile(nullptr),m_pProjectFileItem(nullptr) { // You can do set-up work for each test here. } @@ -41,6 +41,8 @@ protected: m_pProjectFile = new ProjectFile; bool success = m_pProjectFile->Read(FileName); + m_pProjectFileItem = &*m_pProjectFile->Items().begin(); + } virtual void TearDown() @@ -52,6 +54,7 @@ protected: // Objects declared here can be used by all tests in the test case for Foo. ProjectFile *m_pProjectFile; + ProjectFileItem *m_pProjectFileItem; }; /** @@ -78,16 +81,16 @@ TEST_F(SimpleRightTest, Load) TEST_F(SimpleRightTest, GetRightPath) { // Has right path (only) - bool bIsRight = m_pProjectFile->HasRight(); + bool bIsRight = m_pProjectFileItem->HasRight(); ASSERT_TRUE(bIsRight == true); // Get right path without read-only info - String right = m_pProjectFile->GetRight(); + String right = m_pProjectFileItem->GetRight(); ASSERT_TRUE(right.compare(RightPath) == 0); // Get right path with read-only info bool bReadOnly; - right = m_pProjectFile->GetRight(&bReadOnly); + right = m_pProjectFileItem->GetRight(&bReadOnly); ASSERT_TRUE(right.compare(RightPath) == 0); ASSERT_TRUE(bReadOnly == false); } @@ -98,16 +101,16 @@ TEST_F(SimpleRightTest, GetRightPath) TEST_F(SimpleRightTest, GetLeftPath) { // We don't have left path - bool bIsLeft = m_pProjectFile->HasLeft(); + bool bIsLeft = m_pProjectFileItem->HasLeft(); ASSERT_TRUE(bIsLeft == false); // Get left path without read-only info - String left = m_pProjectFile->GetLeft(); + String left = m_pProjectFileItem->GetLeft(); ASSERT_TRUE(left.empty()); // Get left path with read-only info bool bReadOnly; - left = m_pProjectFile->GetLeft(&bReadOnly); + left = m_pProjectFileItem->GetLeft(&bReadOnly); ASSERT_TRUE(left.empty()); ASSERT_TRUE(bReadOnly == false); } @@ -118,11 +121,11 @@ TEST_F(SimpleRightTest, GetLeftPath) TEST_F(SimpleRightTest, GetSubfolders) { // We don't have a subfolders - bool bHasSubfolders = m_pProjectFile->HasSubfolders(); + bool bHasSubfolders = m_pProjectFileItem->HasSubfolders(); ASSERT_TRUE(bHasSubfolders == false); // Returns -1 if not set - int subfolders = m_pProjectFile->GetSubfolders(); + int subfolders = m_pProjectFileItem->GetSubfolders(); ASSERT_TRUE(subfolders == -1); } @@ -132,10 +135,10 @@ TEST_F(SimpleRightTest, GetSubfolders) TEST_F(SimpleRightTest, GetFilter) { // We don't have a filter - bool bHasFilter = m_pProjectFile->HasFilter(); + bool bHasFilter = m_pProjectFileItem->HasFilter(); ASSERT_TRUE(bHasFilter == false); - String filter = m_pProjectFile->GetFilter(); + String filter = m_pProjectFileItem->GetFilter(); ASSERT_TRUE(filter.empty()); }