interreality.org [VOS]
[Home] [About]
[Screenshots]
[Download]
[News]
[Community]
[Documentation] [Manual]
[Bugs & Requests] [Wiki]

/home/tetron/hack/vos/libs/vos/extensions/revcontrol/changelog.hh

Go to the documentation of this file.
00001 #ifndef _CHANGELOG_HH_
00002 #define _CHANGELOG_HH_
00003 
00004 #include <vos/vutil/log.hh>
00005 
00006 #include <stdio.h>
00007 #include <time.h>
00008 
00009 #include <string>
00010 #include <map>
00011 #include <deque>
00012 
00013 namespace VOS {
00014     struct LogEntry
00015     {
00016         struct tm timestamp;
00017         typedef enum {ObjCreate = 0, ObjRename, ObjDelete,
00018                       AddType, RmType,
00019                       SetDefaultPolicy,
00020                       AddToACL, RmFromACL, DeleteACL,
00021                       InsertChild, SetChild, RmChild,
00022                       CommitBlock, Comment, Tag, Noop, LastMethod} MethodEnum;
00023         MethodEnum method;
00024         static const char* methodNames[LastMethod];
00025 
00026         std::string object;
00027 
00028         std::map<std::string, std::string> args;
00029     };
00030 
00031     class ChangeLog
00032     {
00033     private:
00034         FILE* logfile;
00035         void readChangeLog(const std::string& data);
00036 
00037     public:
00038         std::deque<LogEntry> log;
00039 
00040         ChangeLog(const std::string& filename, bool isFilename);
00041         ~ChangeLog();
00042 
00043         void logChange(LogEntry& le);
00044         void pushChange(LogEntry& le);
00045         std::string logToString();
00046     };
00047 };
00048 
00049 
00050 #endif