本文整理汇总了C++中Paragraph::getText方法的典型用法代码示例。如果您正苦于以下问题:C++ Paragraph::getText方法的具体用法?C++ Paragraph::getText怎么用?C++ Paragraph::getText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Paragraph
的用法示例。
在下文中一共展示了Paragraph::getText方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: exportPwi
istream* XhtmlPwiExporter::exportPwi () {
string* resstr = new string();
string& res = *resstr;
res += "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
res += "<html>";
res += "<head>\n<meta http-equiv=\"content-type\" content=\"text/html; utf-8\"/>\n</head>\n";
res += "<body>";
vector<Paragraph*>& paragraphs = this->doc->getParagraphs();
for (int i = 0; i < paragraphs.size(); i++) {
Paragraph* crtPara = paragraphs[i];
string paragraphText = crtPara->getText();
// TODO: here I get inside the guts of Paragraph from outside. This is not good but for now I'm not sure how inline markup should be properly implemented.
map<int, int>& markup = crtPara -> getMarkup(); // position => markup type
res += "\n<p>";
map<int, int>::iterator i = markup.begin();
int strIndex = 0;
while (i != markup.end()) {
pair<const int, int>& elem = *i;
int pos = elem.first;
int whatMarkup = elem.second;
res += string(paragraphText.substr(strIndex, pos - strIndex));
res += this->getMarkup(whatMarkup);
strIndex = pos;
i++;
}
res += paragraphText.substr(strIndex, paragraphText.length());
// close formatting tags if not already closed. FIXME:
/* if (crtPara->isBoldON())
res += this->getMarkup(Paragraph::MARKUP_BOLD_END);
if (crtPara->isItalicON())
res += this->getMarkup(Paragraph::MARKUP_ITALIC_END);*/
res += "</p>";
}
res += "\n</body>\n</html>";
return new istringstream(res);
}