本文整理汇总了C++中Scanner::setReader方法的典型用法代码示例。如果您正苦于以下问题:C++ Scanner::setReader方法的具体用法?C++ Scanner::setReader怎么用?C++ Scanner::setReader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scanner
的用法示例。
在下文中一共展示了Scanner::setReader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
// --- Main ---------------------------------------------------------
int main(int argc, char* argv[]) {
textFileReader *pReader(NULL);
HtmlWritter *pWritter(NULL);
// --- Init -----------------------------------------------------
if(argc != 2) {
cout << "Usage: command filename.ini\n";
return 0;
}
pReader = new textFileReader;
if(!pReader->openFile(argv[1])) {
cout << "File not found\n";
delete pReader;
return 0;
}
pWritter = new HtmlWritter;
string outfilename(argv[1]);
outfilename.append(".html");
if(!pWritter->openFile(outfilename.c_str())) {
cout << "Can't open output file\n";
delete pReader;
delete pWritter;
return 0;
}
pWritter->writeHeader();
// --- Scanning -------------------------------------------------
Scanner* pScanner = new iniScanner;
pScanner->setReader(pReader);
pScanner->setWritter(pWritter);
pScanner->Start();
// --- Cleaning -------------------------------------------------
pWritter->writeFooter();
delete pScanner;
cout << "end.\n";
return 0;
}