From: Arvin Schnell Date: Wed, 2 Feb 2011 16:25:57 +0000 (+0100) Subject: - mark some variables private X-Git-Tag: v0.1.3~523 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e01eaa5a1c3489d4d833211ce5c13d2f40ff518;p=thirdparty%2Fsnapper.git - mark some variables private --- diff --git a/snapper/File.cc b/snapper/File.cc index e3015708..9b8a2a5b 100644 --- a/snapper/File.cc +++ b/snapper/File.cc @@ -51,7 +51,7 @@ namespace snapper void Files::create() { - y2mil("num1:" << snapshot1->num << " num2:" << snapshot2->num); + y2mil("num1:" << snapshot1->getNum() << " num2:" << snapshot2->getNum()); if (compare_callback) compare_callback->start(); @@ -112,9 +112,10 @@ namespace snapper bool Files::save() { - y2mil("num1:" << snapshot1->num << " num2:" << snapshot2->num); + y2mil("num1:" << snapshot1->getNum() << " num2:" << snapshot2->getNum()); - string output = snapshot2->baseDir() + "/filelist-" + decString(snapshot1->num) + ".txt"; + string output = snapshot2->baseDir() + "/filelist-" + decString(snapshot1->getNum()) + + ".txt"; char* tmp_name = (char*) malloc(output.length() + 12); strcpy(tmp_name, output.c_str()); diff --git a/snapper/Snapshot.cc b/snapper/Snapshot.cc index 9cef3dd6..bbb7e33a 100644 --- a/snapper/Snapshot.cc +++ b/snapper/Snapshot.cc @@ -252,7 +252,7 @@ namespace snapper inline bool snapshot_num_less(const Snapshot& snapshot, unsigned int num) { - return snapshot.num < num; + return snapshot.getNum() < num; } diff --git a/snapper/Snapshot.h b/snapper/Snapshot.h index 9848acf2..2bf08278 100644 --- a/snapper/Snapshot.h +++ b/snapper/Snapshot.h @@ -39,8 +39,29 @@ namespace snapper { public: + friend class Snapshots; + Snapshot() : type(SINGLE), num(0), pre_num(0) {} + SnapshotType getType() const { return type; } + + unsigned int getNum() const { return num; } + + string getDate() const { return date; } + + string getDescription() const { return description; } + + unsigned int getPreNum() const { return pre_num; } + + string baseDir() const; + string snapshotDir() const; + + friend std::ostream& operator<<(std::ostream& s, const Snapshot& x); + + friend bool operator<(const Snapshot& a, const Snapshot& b); + + private: + SnapshotType type; unsigned int num; @@ -51,18 +72,12 @@ namespace snapper unsigned int pre_num; // valid only for type=POST - string baseDir() const; - string snapshotDir() const; - bool writeInfo() const; bool createFilesystemSnapshot() const; }; - std::ostream& operator<<(std::ostream& s, const Snapshot& x); - - inline bool operator<(const Snapshot& a, const Snapshot& b) { return a.num < b.num;