ParserUtils.hh
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Open Source Robotics Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16 */
17 
18 #ifndef IGNITION_RNDF_PARSERUTILS_HH_
19 #define IGNITION_RNDF_PARSERUTILS_HH_
20 
21 #include <iosfwd>
22 #include <string>
23 #include <vector>
24 
25 #include "ignition/rndf/Helpers.hh"
26 
27 namespace ignition
28 {
29  namespace rndf
30  {
31  // Forward declarations.
32  class Checkpoint;
33  class Exit;
34  class UniqueId;
35  enum class Marking;
36 
41  void trimWhitespaces(std::string &_str);
42 
48  std::vector<std::string> split(const std::string &_str,
49  const std::string &_delim);
50 
60  void nextRealLine(std::ifstream &_rndfFile,
61  std::string &_line,
62  int &_lineNumber);
63 
80  bool parseString(std::ifstream &_rndfFile,
81  const std::string &_delimiter,
82  std::string &_value,
83  int &_lineNumber);
84 
98  bool parseDelimiter(std::ifstream &_rndfFile,
99  const std::string &_delimiter,
100  int &_lineNumber);
101 
117  bool parsePositive(std::ifstream &_rndfFile,
118  const std::string &_delimiter,
119  int &_value,
120  int &_lineNumber);
121 
137  bool parseNonNegative(std::ifstream &_rndfFile,
138  const std::string &_delimiter,
139  int &_value,
140  int &_lineNumber);
141 
154  bool parseNonNegative(const std::string &_input,
155  const std::string &_delimiter,
156  int &_value);
157 
170  bool parseBoundary(const std::string &_input,
171  Marking &_boundary);
172 
188  bool parseCheckpoint(const std::string &_input,
189  const int _segmentId,
190  const int _laneId,
191  Checkpoint &_checkpoint);
192 
206  bool parseStop(const std::string &_input,
207  const int _segmentId,
208  const int _laneId,
209  UniqueId &_stop);
210 
228  bool parseExit(const std::string &_input,
229  const int _segmentId,
230  const int _laneId,
231  Exit &_exit);
232  }
233 }
234 #endif
#define IGNITION_RNDF_VISIBLE
Use to represent "symbol visible" if supported.
Definition: Helpers.hh:55
Marking
Definition: Lane.hh:39
Definition: Checkpoint.hh:25