diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:07:15 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:07:15 +0200 |
commit | 8318453bf9d4fd50b137ff6c6fc8d1fd22aa6395 (patch) | |
tree | 975c6e590c31e56007006a23e7b15d0245d75b08 /fileHierarchy.h | |
parent | 3.6 (diff) | |
download | FreeFileSync-8318453bf9d4fd50b137ff6c6fc8d1fd22aa6395.tar.gz FreeFileSync-8318453bf9d4fd50b137ff6c6fc8d1fd22aa6395.tar.bz2 FreeFileSync-8318453bf9d4fd50b137ff6c6fc8d1fd22aa6395.zip |
3.7
Diffstat (limited to 'fileHierarchy.h')
-rw-r--r-- | fileHierarchy.h | 45 |
1 files changed, 34 insertions, 11 deletions
diff --git a/fileHierarchy.h b/fileHierarchy.h index 5d97393a..ef439c29 100644 --- a/fileHierarchy.h +++ b/fileHierarchy.h @@ -49,9 +49,9 @@ enum SelectedSide class FileContainer; class FileMapping; class DirMapping; -class CompareProcess; class FileSystemObject; class BaseDirMapping; +class HierarchyObject; //------------------------------------------------------------------ /* DirContainer FileContainer @@ -160,25 +160,22 @@ public: const FileDescriptor& right); const Zstring& getRelativeNamePf() const; //get name relative to base sync dir with FILE_NAME_SEPARATOR postfix: "blah\" - template <SelectedSide side> const Zstring& getBaseDir() const //postfixed! - { - return side == LEFT_SIDE ? baseDirLeft : baseDirRight; - } + template <SelectedSide side> const Zstring& getBaseDir() const; //postfixed! - typedef std::vector<FileMapping> SubFileMapping; - typedef std::vector<DirMapping> SubDirMapping; + typedef std::vector<FileMapping> SubFileMapping; //MergeSides::execute() requires a structure that doesn't invalidate pointers after push_back() + typedef std::vector<DirMapping> SubDirMapping; //Note: deque<> has circular reference in VCPP! SubDirMapping& useSubDirs(); SubFileMapping& useSubFiles(); - const SubDirMapping& useSubDirs() const; + const SubDirMapping& useSubDirs() const; const SubFileMapping& useSubFiles() const; protected: //constructor used by DirMapping HierarchyObject(const HierarchyObject& parent, const Zstring& shortName) : relNamePf(parent.getRelativeNamePf() + shortName + globalFunctions::FILE_NAME_SEPARATOR), - baseDirLeft(parent.getBaseDir<LEFT_SIDE>()), - baseDirRight(parent.getBaseDir<RIGHT_SIDE>()) {} + baseDirLeft(parent.baseDirLeft), + baseDirRight(parent.baseDirRight) {} //constructor used by BaseDirMapping HierarchyObject(const Zstring& dirPostfixedLeft, @@ -198,6 +195,21 @@ private: Zstring baseDirRight; //directory name ending with FILE_NAME_SEPARATOR }; +template <> +inline +const Zstring& HierarchyObject::getBaseDir<LEFT_SIDE>() const //postfixed! +{ + return baseDirLeft; +} + + +template <> +inline +const Zstring& HierarchyObject::getBaseDir<RIGHT_SIDE>() const //postfixed! +{ + return baseDirRight; +} + //------------------------------------------------------------------ struct RelNamesBuffered @@ -248,7 +260,7 @@ public: void synchronizeSides(); //copy one side to the other (NOT recursive!!!) template <SelectedSide side> void removeObject(); //removes file or directory (recursively!): used by manual deletion bool isEmpty() const; //true, if both sides are empty - static void removeEmpty(BaseDirMapping& baseDir); //remove all invalid entries (where both sides are empty) recursively + static void removeEmpty(BaseDirMapping& baseDir); //remove all invalid entries (where both sides are empty) recursively static void removeEmptyNonRec(HierarchyObject& hierObj); //remove all invalid entries (where both sides are empty) non-recursively protected: @@ -428,6 +440,17 @@ bool isDirectoryMapping(const FileSystemObject& fsObj); + + + + + + + + + + + //---------------Inline Implementation--------------------------------------------------- inline FileSystemObject* HierarchyObject::retrieveById(ObjectID id) //returns NULL if object is not found |