4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25 #ifndef WAYPOINTFILE_HPP
26 #define WAYPOINTFILE_HPP
35 class OperationEnvironment
;
37 class WaypointReaderBase
41 const RasterTerrain
* terrain
;
45 WaypointReaderBase(const int _file_num
,
46 bool _compressed
= false);
49 virtual ~WaypointReaderBase() {}
52 * Parses a waypoint file into the given waypoint list
53 * @param way_points The waypoint list to fill
54 * @param terrain RasterTerrain (for automatic waypoint height)
55 * @return True if the waypoint file parsing was okay, False otherwise
57 void Parse(Waypoints
&way_points
, TLineReader
&reader
,
58 OperationEnvironment
&operation
);
60 void SetTerrain(const RasterTerrain
* _terrain
) {
65 static bool CheckAltitude(Waypoint
&new_waypoint
, const RasterTerrain
*terrain
);
66 bool CheckAltitude(Waypoint
&new_waypoint
) const;
70 * @param line The line to parse
71 * @param linenum The line number in the file
72 * @param way_points The waypoint list to fill
73 * @param terrain RasterTerrain (for automatic waypoint height)
74 * @return True if the line was parsed correctly or ignored, False if
75 * parsing error occured
77 virtual bool ParseLine(const TCHAR
* line
, unsigned linenum
,
78 Waypoints
&way_points
) = 0;
84 * Split line (comma separated fields) in individual fields.
85 * @param src The source line of comma separated fields
86 * @param dst Destination buffer containing processed '\0' separated fields.
87 * @param arr Array of pointers pointing to individual fields of dst
88 * @param trim Optional flag to request space character removal at beginning
90 * @param quote_char Optional character used for quoting of individual fields.
91 * Allows handling of quoted strings (e.g. fields containing leading or
92 * trailing space or "," characters). Only considers the quote character
93 * at the beginning or end of fields e.g. 6°10'22"E would be returned as is.
94 * @return number of fields returned. Note: an empty src returns 1 for
95 * for consistency (i.e. "" -> 1, "," -> 2)
97 static size_t ExtractParameters(const TCHAR
*src
, TCHAR
*dst
,
98 const TCHAR
**arr
, size_t sz
,
99 const bool trim
= false,
100 const TCHAR quote_char
= _T('\0'));