Gazebo Common

API Reference

6.0.0
CSVStreams.hh
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 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#ifndef GZ_COMMON_CSVSTREAMS_HH_
18#define GZ_COMMON_CSVSTREAMS_HH_
19
20#include <istream>
21#include <string>
22#include <vector>
23
24#include <gz/common/io/Export.hh>
25
26#include <gz/utils/ImplPtr.hh>
27
28namespace gz
29{
30 namespace common
31 {
33 struct GZ_COMMON_IO_VISIBLE CSVDialect
34 {
37
40
42 char quote;
43
45 static const CSVDialect Unix;
46 };
47
52 bool GZ_COMMON_IO_VISIBLE operator==(const CSVDialect &_lhs,
53 const CSVDialect &_rhs);
54
58 struct CSVToken
59 {
61 enum {
62 TEXT = 0,
67
70 };
71
80 GZ_COMMON_IO_VISIBLE std::istream &ExtractCSVToken(
81 std::istream &_stream, CSVToken &_token,
82 const CSVDialect &_dialect = CSVDialect::Unix);
83
92 GZ_COMMON_IO_VISIBLE std::istream &ParseCSVRow(
94 const CSVDialect &_dialect = CSVDialect::Unix);
95
100 class GZ_COMMON_IO_VISIBLE CSVIStreamIterator
101 {
105 public: using pointer = const value_type*;
106 public: using reference = const value_type&;
107
110
119 public: explicit CSVIStreamIterator(
120 std::istream &_stream,
121 const CSVDialect &_dialect = CSVDialect::Unix);
122
132
144
150 public: bool operator==(const CSVIStreamIterator &_other) const;
151
155 public: bool operator!=(const CSVIStreamIterator &_other) const;
156
162 public: reference operator*() const;
163
169 public: pointer operator->() const;
170
172 private: GZ_UTILS_IMPL_PTR(dataPtr)
173 };
174 }
175}
176
177#endif