00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef YStringTree_h
00020 #define YStringTree_h
00021
00022 #include <string>
00023 #include <y2util/YTransText.h>
00024 #include <y2util/TreeItem.h>
00025
00026
00027 typedef SortedTreeItem<YTransText> YStringTreeItem;
00028
00029 using std::string;
00030
00031
00036 class YStringTree
00037 {
00038 public:
00039
00051 YStringTree( const char * textdomain );
00052
00056 virtual ~YStringTree();
00057
00082 YStringTreeItem * addBranch( const string & content,
00083 char delimiter = 0,
00084 YStringTreeItem * parent = 0 );
00085
00086
00092 string origPath( const YStringTreeItem * item,
00093 char delimiter,
00094 bool startWithDelimiter = true )
00095 { return completePath( item, false, delimiter, startWithDelimiter ); }
00096
00097
00103 string translatedPath( const YStringTreeItem * item,
00104 char delimiter,
00105 bool startWithDelimiter = true )
00106 { return completePath( item, true, delimiter, startWithDelimiter ); }
00107
00108
00117 YTransText path( const YStringTreeItem *item,
00118 char delimiter,
00119 bool startWithDelimiter = true );
00120
00121
00125 void logTree();
00126
00127
00134 YStringTreeItem * root() const { return _root; }
00135
00136
00141 const char * textdomain() const { return _textdomain.c_str(); }
00142
00143
00152 void setTextdomain( const char * domain ) { _textdomain = domain; }
00153
00158 string translate( const string & orig );
00159
00160
00161 protected:
00162
00168 string completePath( const YStringTreeItem * item,
00169 bool translated,
00170 char delimiter,
00171 bool startWithDelimiter );
00172
00176 void logBranch( YStringTreeItem * branch, string indentation );
00177
00178
00179
00180
00181 YStringTreeItem * _root;
00182 string _textdomain;
00183 };
00184
00185
00186
00187
00188 #endif // YStringTree_h