]> git.ipfire.org Git - thirdparty/snapper.git/commitdiff
- added output operator for File
authorArvin Schnell <aschnell@suse.de>
Fri, 4 Feb 2011 15:53:03 +0000 (16:53 +0100)
committerArvin Schnell <aschnell@suse.de>
Fri, 4 Feb 2011 15:53:03 +0000 (16:53 +0100)
snapper/File.cc
snapper/File.h
snapper/Snapper.h
snapper/Snapshot.cc

index 847405415a822e78ed2af4324b8949b2bf874c32..2b66505ac3aa547345b9a5f856a460e9f3018e61 100644 (file)
@@ -44,11 +44,27 @@ namespace snapper
     inline Snapshots::const_iterator getSnapshot2() { return getSnapper()->getSnapshot2(); }
 
 
+    std::ostream& operator<<(std::ostream& s, const File& file)
+    {
+       s << "name:\"" << file.name << "\"";
+
+       s << " pre_to_post_status:\"" << statusToString(file.pre_to_post_status) << "\"";
+
+       if (file.pre_to_system_status != (unsigned int)(-1))
+           s << " pre_to_post_status:\"" << statusToString(file.pre_to_system_status) << "\"";
+
+       if (file.post_to_system_status != (unsigned int)(-1))
+           s << " post_to_post_status:\"" << statusToString(file.post_to_system_status) << "\n";
+
+       return s;
+    }
+
+
     void
     append_helper(const string& name, unsigned int status)
     {
        // TODO
-       getSnapper()->files.entries.push_back(File(name, status));
+       getSnapper()->getFiles().entries.push_back(File(name, status));
     }
 
 
index 5c0d3e98c594c64afa7f29a709313bd4d3d2943e..15a548a2ecc202442a60bd156be3b5cee65193f4 100644 (file)
@@ -75,6 +75,8 @@ namespace snapper
 
        bool doRollback();
 
+       friend std::ostream& operator<<(std::ostream& s, const File& file);
+
     private:
 
        string name;
index bfa2603f001cdba722efc361df66a375c9e19cf9..5dba9c44a1c5133bcc8491dc7dccb3e641b7b5f8 100644 (file)
@@ -82,8 +82,6 @@ namespace snapper
 
        CompareCallback* compare_callback;
 
-       friend void append_helper(const string& name, unsigned int status);
-
     };
 
 };
index 0fac43075a11c3c8d48a647a9d218441c4e7ea94..6c8fb8c0350e57ab0080bdb526a95803d9368fce 100644 (file)
@@ -46,10 +46,10 @@ namespace snapper
        if (snapshot.pre_num != 0)
            s << " pre-num:" << snapshot.pre_num;
 
-       s << " date:" << snapshot.date;
+       s << " date:\"" << snapshot.date << "\"";
 
        if (!snapshot.description.empty())
-           s << " description:" << snapshot.description;
+           s << " description:\"" << snapshot.description << "\"";
 
        return s;
     }