static void TestDeclarationTurnpoint() { IGCDeclarationTurnpoint tp; ok1(!IGCParseDeclarationTurnpoint("", tp)); ok1(IGCParseDeclarationTurnpoint("C5000633N01015083ESchweinfurtsued", tp)); ok1(equals(tp.location, 50.01055, 10.251383333)); ok1(tp.name == "Schweinfurtsued"); ok1(IGCParseDeclarationTurnpoint("C5100633S00015083W", tp)); ok1(equals(tp.location, -51.01055, -0.251383333)); ok1(tp.name.empty()); }
static bool ReadIGCDeclaration(const TCHAR *path, IGCDeclarationHeader &header, std::list<IGCDeclarationTurnpoint> &turnpoints) { // Create FileReader for reading the task FileLineReaderA reader(path); if (reader.error()) return false; // Read IGC file char *line; bool header_found = false; while ((line = reader.read()) != NULL) { // Skip lines which are not declaration records if (*line != _T('C')) continue; if (!header_found) { if (!IGCParseDeclarationHeader(line, header)) return false; header_found = true; continue; } IGCDeclarationTurnpoint tp; if (IGCParseDeclarationTurnpoint(line, tp)) turnpoints.push_back(tp); } return header_found; }