本文整理汇总了C++中TLineReader::GetSize方法的典型用法代码示例。如果您正苦于以下问题:C++ TLineReader::GetSize方法的具体用法?C++ TLineReader::GetSize怎么用?C++ TLineReader::GetSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLineReader
的用法示例。
在下文中一共展示了TLineReader::GetSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
/**
* Parses the data provided by the airfield details file handle
*/
static void
ParseAirfieldDetails(Waypoints &way_points, TLineReader &reader,
OperationEnvironment &operation)
{
tstring details;
std::vector<tstring> files_external, files_embed;
TCHAR name[201];
const TCHAR *filename;
name[0] = 0;
bool in_details = false;
int i;
const long filesize = std::max(reader.GetSize(), 1l);
operation.SetProgressRange(100);
TCHAR *line;
while ((line = reader.ReadLine()) != NULL) {
if (line[0] == _T('[')) { // Look for start
if (in_details)
SetAirfieldDetails(way_points, name, details, files_external,
files_embed);
details.clear();
files_external.clear();
files_embed.clear();
// extract name
for (i = 1; i < 201; i++) {
if (line[i] == _T(']'))
break;
name[i - 1] = line[i];
}
name[i - 1] = 0;
in_details = true;
operation.SetProgressPosition(reader.Tell() * 100 / filesize);
} else if ((filename =
StringAfterPrefixCI(line, _T("image="))) != NULL) {
files_embed.emplace_back(filename);
} else if ((filename =
StringAfterPrefixCI(line, _T("file="))) != NULL) {
#ifdef ANDROID
files_external.emplace_back(filename);
#endif
} else {
// append text to details string
if (!StringIsEmpty(line)) {
details += line;
details += _T('\n');
}
}
}
if (in_details)
SetAirfieldDetails(way_points, name, details, files_external, files_embed);
}
示例2: DetectFileType
bool
AirspaceParser::Parse(TLineReader &reader, OperationEnvironment &operation)
{
bool ignore = false;
// Create and init ProgressDialog
operation.SetProgressRange(1024);
const long file_size = reader.GetSize();
TempAirspaceType temp_area;
AirspaceFileType filetype = AFT_UNKNOWN;
TCHAR *line;
// Iterate through the lines
for (unsigned line_num = 1; (line = reader.ReadLine()) != NULL; line_num++) {
// Skip empty line
if (StringIsEmpty(line))
continue;
if (filetype == AFT_UNKNOWN) {
filetype = DetectFileType(line);
if (filetype == AFT_UNKNOWN)
continue;
}
// Parse the line
if (filetype == AFT_OPENAIR)
if (!ParseLine(airspaces, line, temp_area) &&
!ShowParseWarning(line_num, line, operation))
return false;
if (filetype == AFT_TNP)
if (!ParseLineTNP(airspaces, line, temp_area, ignore) &&
!ShowParseWarning(line_num, line, operation))
return false;
// Update the ProgressDialog
if ((line_num & 0xff) == 0)
operation.SetProgressPosition(reader.Tell() * 1024 / file_size);
}
if (filetype == AFT_UNKNOWN) {
operation.SetErrorMessage(_("Unknown airspace filetype"));
return false;
}
// Process final area (if any)
if (!temp_area.points.empty())
temp_area.AddPolygon(airspaces);
return true;
}
示例3: ParseLine
void
WaypointReaderBase::Parse(Waypoints &way_points, TLineReader &reader,
OperationEnvironment &operation)
{
const long filesize = std::max(reader.GetSize(), 1l);
operation.SetProgressRange(100);
// Read through the lines of the file
TCHAR *line;
for (unsigned i = 0; (line = reader.ReadLine()) != nullptr; i++) {
// and parse them
ParseLine(line, i, way_points);
if ((i & 0x3f) == 0)
operation.SetProgressPosition(reader.Tell() * 100 / filesize);
}
}