本文整理汇总了C++中DocumentPtr::isNotNull方法的典型用法代码示例。如果您正苦于以下问题:C++ DocumentPtr::isNotNull方法的具体用法?C++ DocumentPtr::isNotNull怎么用?C++ DocumentPtr::isNotNull使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DocumentPtr
的用法示例。
在下文中一共展示了DocumentPtr::isNotNull方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testProcessWithEmptyField
void StandardDocumentProcessorTestCase::testProcessWithEmptyField()
{
String sPath = writeTestFile("file_with_empty_field.txt", TEST_FILE_WITH_EMPTY_FIELD);
StandardDocumentProcessor processor;
processor.init(m_pDocSchema.get());
DocumentSource docSource(m_pDocSchema.get());
RawDocumentPtr pRawDoc = new RawDocument();
pRawDoc->setPath(sPath);
docSource.setRawDocument(pRawDoc);
processor.process(docSource);
DocumentPtr pDoc = docSource.stealLastDocument();
CPPUNIT_ASSERT(pDoc.isNotNull());
Answer ans;
makeAnswer(TEST_FILE_WITH_EMPTY_FIELD, ans);
Document::Iterator it = pDoc->iterator();
CPPUNIT_ASSERT_EQUAL(ans.size(), it.size());
size_t i = 0;
while (it.hasNext())
{
const Field* pField = it.next();
// cout << ans[i].first << " : " << ans[i].second << endl;
CPPUNIT_ASSERT_EQUAL(ans[i].first, pField->getFieldSchema()->getName());
CPPUNIT_ASSERT_EQUAL(ans[i].second, std::string(pField->getValue().c_str()));
++i;
}
}
示例2: testProcessMultiFile
void StandardDocumentProcessorTestCase::testProcessMultiFile()
{
string sPath = writeTestFile("file2.txt", TEST_FILE2);
StandardDocumentProcessor processor;
processor.init(m_pDocSchema.get());
DocumentSource docSource(m_pDocSchema.get());
Answer ans;
makeAnswer(TEST_FILE2, ans);
RawDocumentPtr pRawDoc = new RawDocument();
pRawDoc->setPath(sPath);
docSource.setRawDocument(pRawDoc);
size_t i = 0;
do
{
processor.process(docSource);
DocumentPtr pDoc = docSource.stealLastDocument();
CPPUNIT_ASSERT(pDoc.isNotNull());
Document::Iterator it = pDoc->iterator();
while (it.hasNext())
{
const Field* pField = it.next();
CPPUNIT_ASSERT_EQUAL(ans[i].first, pField->getFieldSchema()->getName());
CPPUNIT_ASSERT_EQUAL(ans[i].second, std::string(pField->getValue().c_str()));
++i;
}
} while(docSource.toBeContinued());
CPPUNIT_ASSERT_EQUAL(ans.size(), i);
}