00001 #ifndef _OPTION_FILE_H_
00002 #define _OPTION_FILE_H_
00003
00004 #include "GVariant.h"
00005 #include "GXmlTree.h"
00006 #include "GSemaphore.h"
00007
00008 class LgiClass GOptionsFile : public GXmlTag, public GSemaphore
00009 {
00010 char *File;
00011 char *Error;
00012 bool Dirty;
00013
00014 char *LockFile;
00015 int LockLine;
00016
00017 bool _OnAccess(bool Start);
00018
00019
00020 char *GetAttr(char *Name) { return GXmlTag::GetAttr(Name); }
00021 int GetAsInt(char *Name) { return GXmlTag::GetAsInt(Name); }
00022 bool SetAttr(char *Name, char *Value) { return GXmlTag::SetAttr(Name, Value); }
00023 bool SetAttr(char *Name, int Value) { return GXmlTag::SetAttr(Name, Value); }
00024 bool DelAttr(char *Name) { return GXmlTag::DelAttr(Name); }
00025 void InsertTag(GXmlTag *t) { GXmlTag::InsertTag(t); }
00026 void RemoveTag() { GXmlTag::RemoveTag(); }
00027 GXmlTag *GetTag(char *Name, bool Create = false) { return GXmlTag::GetTag(Name, Create); }
00028
00029 protected:
00030 virtual void _Defaults() {}
00031
00032 public:
00033 GOptionsFile(char *BaseName = 0, char *FileName = 0);
00034 ~GOptionsFile();
00035
00036 bool IsValid();
00037 char *GetFile() { return File; }
00038 char *GetError() { return Error; }
00039 void SetFile(char *f);
00040 bool Serialize(bool Write);
00041 bool DeleteValue(char *Name);
00042
00043 bool CreateTag(char *Name);
00044 bool DeleteTag(char *Name);
00045 GXmlTag *LockTag(char *Name, char *File, int Line);
00046 };
00047
00048 #endif