本文整理汇总了C++中CNode::endPosOuter方法的典型用法代码示例。如果您正苦于以下问题:C++ CNode::endPosOuter方法的具体用法?C++ CNode::endPosOuter怎么用?C++ CNode::endPosOuter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CNode
的用法示例。
在下文中一共展示了CNode::endPosOuter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FindEDGAR_Tables
void EDGAR_FilingFile::FindEDGAR_Tables(RunMode run_mode)
{
// always start fresh
EDGAR_filing_tables_.clear();
CDocument the_filing;
the_filing.parse(EDGAR_filing_content_.c_str());
CSelection c = the_filing.find("table");
// ConvertMarkupToText is a time consuming function -- it actually calls out to
// an external process right now -- so let's do some async'ing !!
// keep track of our async processes here.
std::vector<std::future<std::string>> tasks;
for (int indx = 0 ; indx < c.nodeNum(); ++indx)
{
CNode pNode = c.nodeAt(indx);
// use the 'Outer' functions to include the table tags in the extracted content.
std::string content = EDGAR_filing_content_.substr(pNode.startPosOuter(), pNode.endPosOuter() - pNode.startPosOuter());
if (TableHasMarkup(content))
{
if (run_mode == RunMode::do_sync)
{
std::string plain_table = ConvertMarkupToText(content);
EDGAR_filing_tables_.push_back(plain_table);
}
else
tasks.push_back(std::async(&EDGAR_FilingFile::ConvertMarkupToText, this, content));
}
else
EDGAR_filing_tables_.push_back(content);
}
// now, let's go look for our output...
for (int count = tasks.size(); count; --count)
{
int i = wait_for_any(tasks, std::chrono::microseconds{100});
std::string converted_text;
try
{
converted_text = tasks[i].get();
}
catch (...)
{
// any problems, let's just ignore them.
poco_error(the_logger_, "Some problem with an async process");
continue;
}
if (! converted_text.empty())
EDGAR_filing_tables_.push_back(converted_text);
}
} // ----- end of method EDGAR_FilingFile::FindEDGAR_Tables -----