27 #include "YStringTree.h"
68 std::string::size_type start = 0;
69 std::string::size_type end = 0;
71 while ( start < content.length() )
75 while ( start < content.length() &&
76 content[ start ] == delimiter )
86 while ( end < content.length() &&
87 content[ end ] != delimiter )
97 std::string path_component = content.substr( start, end - start );
101 node = findDirectChild( parent, path_component_trans);
120 std::string trans( dgettext( _textdomain.c_str(), orig.c_str() ) );
130 bool startWithDelimiter )
136 path = translated ? item->
value().trans() : item->
value().orig();
140 std::string parentPath = translated ?
141 item->
parent()->value().translation() :
142 item->
parent()->value().orig();
144 path = parentPath + delimiter +
path;
150 if ( startWithDelimiter )
151 path = delimiter +
path;
160 bool startWithDelimiter )
175 if ( startWithDelimiter )
199 printf(
"%s%s (%s)\n", indentation.c_str(),
200 branch->
value().translation().c_str(),
201 branch->
value().orig().c_str() );
209 child = child->next();
214 printf(
"%s<NULL>\n", indentation.c_str() );
SortedTreeItem< PAYLOAD > * parent() const
void setTextdomain(const char *domain)
SortedTreeItem< PAYLOAD > * firstChild() const
YStringTree(const char *textdomain)
std::string translate(const std::string &orig)
const PAYLOAD & value() const
YTransText path(const YStringTreeItem *item, char delimiter, bool startWithDelimiter=true)
void setTranslation(const std::string &newTrans)
const std::string & orig() const
YStringTreeItem * addBranch(const std::string &content, char delimiter=0, YStringTreeItem *parent=0)
void setOrig(const std::string &newOrig)
const std::string & translation() const
const std::string & trans() const
std::string completePath(const YStringTreeItem *item, bool translated, char delimiter, bool startWithDelimiter)
void logBranch(YStringTreeItem *branch, std::string indentation)