00001
00020 #ifndef __LILOSECTION
00021 #define __LILOSECTION
00022
00023 #include <string>
00024 #include <vector>
00025 #include <map>
00026
00027 #include <Y2.h>
00028
00029 #include <stdio.h>
00030 #include <iostream>
00031 #include <fstream>
00032
00033 #include "OptTypes.h"
00034
00035 using namespace std;
00036
00037
00038
00039
00040
00041
00042 string strip(string str);
00043 string indentString(string str, string indent);
00044 class liloSection;
00045
00052 class inputLine {
00053 public:
00054
00055
00056
00058 string option;
00060 string value;
00062 string comment;
00064 string type;
00065
00067 string src;
00068
00069 inputLine(const string& line, const string& init_type);
00070 void dump();
00071 };
00072
00079 class liloOption {
00080 public:
00081
00082 string optname;
00084 string value;
00086 string comment;
00087 liloOption(string optn, string val, string com="");
00088 void dump();
00089 liloOption() {};
00090 };
00091
00098 class liloOrderedOptions
00099 {
00100 public:
00102 vector<liloOption*> order;
00103
00105 liloOrderedOptions(const string & type);
00107 bool processLine(inputLine* li);
00109 YCPValue Read(const YCPPath& path);
00111 YCPBoolean Write(const YCPPath& path, const YCPValue& val, const YCPValue& _pos);
00113 YCPList Dir();
00115 void dump(FILE* f);
00116
00117
00119 int saveToFile(ostream* f, string indent="");
00121 string type;
00123 OptTypes o;
00124 };
00125
00126
00127 enum {
00128 SECT_IMAGE = 0,
00129 SECT_OTHER
00130 };
00131
00138 class liloSection {
00139 public:
00141 liloOrderedOptions *options;
00142
00144 string sectName;
00146 string sectComment;
00147
00149 int sectType;
00150
00152 liloSection(const string& init_type);
00153
00154 virtual ~liloSection();
00155
00157 virtual bool processLine(inputLine* line);
00158
00160 string getSectName();
00161
00162
00164 int saveToFile(ostream* f, string indent="");
00165
00167 virtual YCPValue Read(const YCPPath& path);
00168
00170 virtual YCPBoolean Write(const YCPPath& path, const YCPValue& val, const YCPValue& pos);
00171
00172
00174 virtual YCPList Dir();
00175
00176 string type;
00177
00178 };
00179
00183 string replaceBlanks (const string &s, char r);
00184
00185 #endif