本文整理汇总了C++中Scanner::readCharsFix方法的典型用法代码示例。如果您正苦于以下问题:C++ Scanner::readCharsFix方法的具体用法?C++ Scanner::readCharsFix怎么用?C++ Scanner::readCharsFix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Scanner
的用法示例。
在下文中一共展示了Scanner::readCharsFix方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GZipScanner
SdfLoader::SdfLoader (Scanner &scanner) :
TL_CP_GET(data),
TL_CP_GET(properties),
TL_CP_GET(_offsets),
TL_CP_GET(_preread)
{
data.clear();
properties.clear();
// detect if input is gzipped
byte id[2];
int pos = scanner.tell();
scanner.readCharsFix(2, (char *)id);
scanner.seek(pos, SEEK_SET);
if (id[0] == 0x1f && id[1] == 0x8b)
{
_scanner = new GZipScanner(scanner);
_own_scanner = true;
}
else
{
_scanner = &scanner;
_own_scanner = false;
}
_current_number = 0;
_max_offset = 0;
_offsets.clear();
_preread.clear();
}
示例2: tell
SdfLoader::SdfLoader (Scanner &scanner) :
CP_INIT,
TL_CP_GET(data),
TL_CP_GET(properties),
TL_CP_GET(_offsets),
TL_CP_GET(_preread)
{
data.clear();
properties.clear();
// detect if input is gzipped
byte id[2];
int pos = scanner.tell();
scanner.readCharsFix(2, (char *)id);
scanner.seek(pos, SEEK_SET);
if (id[0] == 0x1f && id[1] == 0x8b)
{
_scanner = new GZipScanner(scanner);
_own_scanner = true;
}
else
{
_scanner = &scanner;
_own_scanner = false;
}
_current_number = 0;
_max_offset = 0;
_offsets.clear();
_preread.clear();
}
SdfLoader::~SdfLoader()
{
if (_own_scanner)
delete _scanner;
}
int SdfLoader::tell ()
{
return _scanner->tell();
}
int SdfLoader::currentNumber ()
{
return _current_number;
}
int SdfLoader::count ()
{
int offset = _scanner->tell();
int cn = _current_number;
if (offset != _max_offset)
{
_scanner->seek(_max_offset, SEEK_SET);
_preread.clear();
_current_number = _offsets.size();
}
while (!isEOF())
readNext();
int res = _current_number;
if (res != cn)
{
_scanner->seek(offset, SEEK_SET);
_preread.clear();
_current_number = cn;
}
return res;
}