本文整理汇总了C++中TLineReader::tell方法的典型用法代码示例。如果您正苦于以下问题:C++ TLineReader::tell方法的具体用法?C++ TLineReader::tell怎么用?C++ TLineReader::tell使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TLineReader
的用法示例。
在下文中一共展示了TLineReader::tell方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
long filesize = std::max(reader.size(), 1l);
operation.SetProgressRange(100);
TCHAR *line;
while ((line = reader.read()) != 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.push_back(filename);
} else if ((filename =
StringAfterPrefixCI(line, _T("file="))) != NULL) {
#ifdef ANDROID
files_external.push_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: while
/**
* Parses the data provided by the airfield details file handle
*/
static void
ParseAirfieldDetails(Waypoints &way_points, TLineReader &reader)
{
tstring Details;
TCHAR Name[201];
Name[0] = 0;
bool inDetails = false;
int i;
long filesize = std::max(reader.size(), 1l);
ProgressGlue::SetRange(100);
TCHAR *TempString;
while ((TempString = reader.read()) != NULL) {
if (TempString[0] == '[') { // Look for start
if (inDetails)
SetAirfieldDetails(way_points, Name, Details);
Details.clear();
// extract name
for (i = 1; i < 201; i++) {
if (TempString[i] == ']')
break;
Name[i - 1] = TempString[i];
}
Name[i - 1] = 0;
inDetails = true;
ProgressGlue::SetValue(reader.tell() * 100 / filesize);
} else {
// append text to details string
if (!string_is_empty(TempString)) {
Details += TempString;
Details += _T('\n');
}
}
}
if (inDetails) {
SetAirfieldDetails(way_points, Name, Details);
Details.clear();
}
}
示例3: ParseLine
void
WaypointReaderBase::Parse(Waypoints &way_points, TLineReader &reader,
OperationEnvironment &operation)
{
long filesize = std::max(reader.size(), 1l);
operation.SetProgressRange(100);
// Read through the lines of the file
TCHAR *line;
for (unsigned i = 0; (line = reader.read()) != NULL; i++) {
// and parse them
ParseLine(line, i, way_points);
if ((i & 0x3f) == 0)
operation.SetProgressPosition(reader.tell() * 100 / filesize);
}
}
示例4: while
bool
ReadAirspace(Airspaces &airspace_database, TLineReader &reader)
{
int LineCount = 0;
bool ignore = false;
// Create and init ProgressDialog
ProgressGlue::SetRange(1024);
long file_size = reader.size();
TempAirspaceType temp_area;
asFileType filetype = ftUnknown;
TCHAR *line;
TCHAR *comment;
// Iterate through the lines
while ((line = reader.read()) != NULL) {
// Increase line counter
LineCount++;
// Strip comments
comment = _tcschr(line, _T('*'));
if (comment != NULL)
*comment = _T('\0');
// Skip empty line
if (string_is_empty(line))
continue;
if (filetype == ftUnknown) {
filetype = DetectFileType(line);
if (filetype == ftUnknown)
continue;
}
// Parse the line
if (filetype == ftOpenAir)
if (!ParseLine(airspace_database, line, temp_area) &&
!ShowParseWarning(LineCount, line))
return false;
if (filetype == ftTNP)
if (!ParseLineTNP(airspace_database, line, temp_area, ignore) &&
!ShowParseWarning(LineCount, line))
return false;
// Update the ProgressDialog
if ((LineCount & 0xff) == 0)
ProgressGlue::SetValue(reader.tell() * 1024 / file_size);
}
if (LineCount == 0)
return false;
if (filetype == ftUnknown) {
MessageBoxX(_("Unknown Filetype."), _("Airspace"), MB_OK);
return false;
}
// Process final area (if any)
if (!temp_area.Waiting)
temp_area.AddPolygon(airspace_database);
return true;
}