89std::string
closeTag( std::vector<tags>& tagStack )
91 if( tagStack.empty() )
93 WAR <<
"closing tag before any opening" << endl;;
96 tags t = tagStack.back();
111std::string
openTag( std::vector<tags>& tagStack, std::string & tag )
114 std::map<std::string,tags>::const_iterator it =
_rtTagmap.find( tag );
118 if ( tag.size() > 3 && tag[0] ==
'!' && tag[1] ==
'-' && tag[2] ==
'-' )
120 WAR <<
"unknown rich text tag " << tag << endl;
127 tagStack.push_back( t );
132 return "--------------------";
149 std::ostringstream res;
181 std::string::size_type end =
str.find(
';' );
182 DBG <<
"val ampr is: " <<
str << endl;
186 std::istringstream sstr(
str.substr( 1, end ) );
191 return std::string( 1,(
char)res );
195 WAR <<
"unknown number " <<
str << endl;
200 DBG << end <<
" " <<
str.substr( 0, end ) << endl;
212 std::vector<tags> tagStack;
215 res.reserve(
text.size() );
216 std::string::size_type pos = 0;
226 res.push_back(
text[pos] );
229 if (
text[pos] ==
' ' )
230 res.push_back(
' ' );
234 if ( pos+1 ==
text.npos )
236 WAR <<
"ended with nonclosed tag."<< endl;
239 if (
text[pos+1] ==
'/' )
241 pos =
text.find(
'>', pos );
246 std::string::size_type tagEndPos =
text.find(
'>', pos );
247 if ( tagEndPos ==
text.npos )
249 WAR <<
"ended with non-closed tag " << endl;
252 std::string tagname(
text.substr( pos+1, tagEndPos-pos-1 ) );
254 res.append(
openTag( tagStack, tagname ) );
259 std::string::size_type semipos =
text.find(
';', pos );
261 DBG <<
"tmp is: " << tmp << endl;
267 res.push_back(
text[pos] );
271 }
while ( pos !=
text.size() );
String related utilities and Regular expression matching.
std::string getStringFromAmpr(const std::string &str)
std::string openTag(std::vector< tags > &tagStack, std::string &tag)
std::string processRichText(const std::string &text)
unsigned count_list_items
std::map< std::string, std::string > ampersmap
std::map< std::string, tags > _rtTagmap
std::string closeTag(std::vector< tags > &tagStack)
std::string trim(const std::string &s, const Trim trim_r)