00001 // 00002 // aegis - project change supervisor 00003 // Copyright (C) 2004-2006, 2008 Peter Miller 00004 // 00005 // This program is free software; you can redistribute it and/or modify 00006 // it under the terms of the GNU General Public License as published by 00007 // the Free Software Foundation; either version 3 of the License, or 00008 // (at your option) any later version. 00009 // 00010 // This program is distributed in the hope that it will be useful, 00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00013 // GNU General Public License for more details. 00014 // 00015 // You should have received a copy of the GNU General Public License 00016 // along with this program. If not, see 00017 // <http://www.gnu.org/licenses/>. 00018 // 00019 00020 #ifndef LIBAEGIS_FILE_REVISION_H 00021 #define LIBAEGIS_FILE_REVISION_H 00022 00023 #include <common/nstring.h> 00024 00030 class file_revision 00031 { 00032 public: 00037 ~file_revision(); 00038 00042 file_revision(const nstring &filename, bool need_to_unlink); 00043 00047 file_revision(const file_revision &); 00048 00052 file_revision &operator=(const file_revision &); 00053 00058 nstring get_path() const { return ref->get_path(); } 00059 00060 private: 00061 class inner 00062 { 00063 public: 00072 ~inner(); 00073 00077 inner(const nstring &filename, bool need_to_unlink); 00078 00083 nstring get_path() const { return filename; } 00084 00090 void one_fewer(); 00091 00096 void one_more() { ++reference_count; } 00097 00098 private: 00103 long reference_count; 00104 00109 nstring filename; 00110 00115 bool need_to_unlink; 00116 00120 inner(); 00121 00125 inner(const inner &); 00126 00130 inner &operator=(const inner &); 00131 }; 00132 00137 inner *ref; 00138 00142 file_revision(); 00143 }; 00144 00145 #endif // LIBAEGIS_FILE_REVISION_H