~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxGraphics/IniFile.h

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-02 03:28:11 UTC
  • Revision ID: neil.patel@canonical.com-20100902032811-i2m18tfb6pkasnvt
Remove Win EOL chars

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 */
21
21
 
22
22
 
23
 
#ifndef INIFILE_H
24
 
#define INIFILE_H
25
 
 
26
 
NAMESPACE_BEGIN_OGL
27
 
 
28
 
class CIniFile
29
 
{
30
 
public:
31
 
        struct Record
32
 
        {
33
 
                std::string Comments;
34
 
                char Commented;
35
 
                std::string Section;
36
 
                std::string Key;
37
 
                std::string Value;
38
 
        };
39
 
 
40
 
        enum CommentChar
41
 
        {
42
 
                Pound = '#',
43
 
                SemiColon = ';'
44
 
        };
45
 
 
46
 
        CIniFile(void);
47
 
        virtual ~CIniFile(void);
48
 
 
49
 
        static bool AddSection(std::string SectionName, std::string FileName);
50
 
        static bool CommentRecord(CommentChar cc, std::string KeyName,std::string SectionName,std::string FileName);
51
 
        static bool CommentSection(char CommentChar, std::string SectionName, std::string FileName);
52
 
        static std::string Content(std::string FileName);
53
 
        static bool Create(std::string FileName);
54
 
        static bool DeleteRecord(std::string KeyName, std::string SectionName, std::string FileName);
55
 
        static bool DeleteSection(std::string SectionName, std::string FileName);
56
 
        static std::vector<Record> GetRecord(std::string KeyName, std::string SectionName, std::string FileName);
57
 
        static std::vector<Record> GetSection(std::string SectionName, std::string FileName);
58
 
        static std::vector<std::string> GetSectionNames(std::string FileName);
59
 
        static std::string GetValue(std::string KeyName, std::string SectionName, std::string FileName);
60
 
        static bool RecordExists(std::string KeyName, std::string SectionName, std::string FileName);
61
 
        static bool RenameSection(std::string OldSectionName, std::string NewSectionName, std::string FileName);
62
 
        static bool SectionExists(std::string SectionName, std::string FileName);
63
 
        static bool SetRecordComments(std::string Comments, std::string KeyName, std::string SectionName, std::string FileName);
64
 
        static bool SetSectionComments(std::string Comments, std::string SectionName, std::string FileName);
65
 
        static bool SetValue(std::string KeyName, std::string Value, std::string SectionName, std::string FileName);
66
 
        static bool Sort(std::string FileName, bool Descending);
67
 
        static bool UnCommentRecord(std::string KeyName,std::string SectionName,std::string FileName);
68
 
        static bool UnCommentSection(std::string SectionName, std::string FileName);
69
 
 
70
 
private:
71
 
        static std::vector<Record> GetSections(std::string FileName);
72
 
        static bool Load(std::string FileName, std::vector<Record>& content);   
73
 
        static bool Save(std::string FileName, std::vector<Record>& content);
74
 
};
75
 
 
76
 
NAMESPACE_END_OGL
77
 
 
 
23
#ifndef INIFILE_H
 
24
#define INIFILE_H
 
25
 
 
26
NAMESPACE_BEGIN_OGL
 
27
 
 
28
class CIniFile
 
29
{
 
30
public:
 
31
        struct Record
 
32
        {
 
33
                std::string Comments;
 
34
                char Commented;
 
35
                std::string Section;
 
36
                std::string Key;
 
37
                std::string Value;
 
38
        };
 
39
 
 
40
        enum CommentChar
 
41
        {
 
42
                Pound = '#',
 
43
                SemiColon = ';'
 
44
        };
 
45
 
 
46
        CIniFile(void);
 
47
        virtual ~CIniFile(void);
 
48
 
 
49
        static bool AddSection(std::string SectionName, std::string FileName);
 
50
        static bool CommentRecord(CommentChar cc, std::string KeyName,std::string SectionName,std::string FileName);
 
51
        static bool CommentSection(char CommentChar, std::string SectionName, std::string FileName);
 
52
        static std::string Content(std::string FileName);
 
53
        static bool Create(std::string FileName);
 
54
        static bool DeleteRecord(std::string KeyName, std::string SectionName, std::string FileName);
 
55
        static bool DeleteSection(std::string SectionName, std::string FileName);
 
56
        static std::vector<Record> GetRecord(std::string KeyName, std::string SectionName, std::string FileName);
 
57
        static std::vector<Record> GetSection(std::string SectionName, std::string FileName);
 
58
        static std::vector<std::string> GetSectionNames(std::string FileName);
 
59
        static std::string GetValue(std::string KeyName, std::string SectionName, std::string FileName);
 
60
        static bool RecordExists(std::string KeyName, std::string SectionName, std::string FileName);
 
61
        static bool RenameSection(std::string OldSectionName, std::string NewSectionName, std::string FileName);
 
62
        static bool SectionExists(std::string SectionName, std::string FileName);
 
63
        static bool SetRecordComments(std::string Comments, std::string KeyName, std::string SectionName, std::string FileName);
 
64
        static bool SetSectionComments(std::string Comments, std::string SectionName, std::string FileName);
 
65
        static bool SetValue(std::string KeyName, std::string Value, std::string SectionName, std::string FileName);
 
66
        static bool Sort(std::string FileName, bool Descending);
 
67
        static bool UnCommentRecord(std::string KeyName,std::string SectionName,std::string FileName);
 
68
        static bool UnCommentSection(std::string SectionName, std::string FileName);
 
69
 
 
70
private:
 
71
        static std::vector<Record> GetSections(std::string FileName);
 
72
        static bool Load(std::string FileName, std::vector<Record>& content);   
 
73
        static bool Save(std::string FileName, std::vector<Record>& content);
 
74
};
 
75
 
 
76
NAMESPACE_END_OGL
 
77
 
78
78
#endif // INIFILE_H
 
 
b'\\ No newline at end of file'