BALL
1.5.0
include
BALL
FORMAT
lineBasedFile.h
Go to the documentation of this file.
1
// -*- Mode: C++; tab-width: 2; -*-
2
// vi: set ts=2:
3
//
4
5
#ifndef BALL_FORMAT_LINEBASEDFILE_H
6
#define BALL_FORMAT_LINEBASEDFILE_H
7
8
#ifndef BALL_SYSTEM_FILE_H
9
# include <
BALL/SYSTEM/file.h
>
10
#endif
11
12
#include <vector>
13
14
namespace
BALL
15
{
20
class
BALL_EXPORT
LineBasedFile
21
:
public
File
22
{
23
public
:
24
28
30
LineBasedFile
();
31
38
LineBasedFile
(
const
String
& filename,
File::OpenMode
open_mode = std::ios::in,
bool
trim_whitespaces =
false
);
39
42
void
clear();
43
45
48
51
bool
operator ==
(
const
LineBasedFile
& f);
52
55
bool
operator !=
(
const
LineBasedFile
& f);
57
61
66
const
LineBasedFile
& operator = (
const
LineBasedFile
& file);
67
69
72
74
Position
getLineNumber()
const
;
75
77
const
String
& getLine()
const
;
78
80
String
& getLine();
81
83
86
91
bool
readLine();
92
97
bool
skipLines(
Size
number = 1);
98
105
bool
search(
const
String
& text,
bool
return_to_start =
false
);
106
107
/* Search for a line starting with a given string, abort at a stop tag.
108
* @throw Exception::ParseError if a syntax error was encountered
109
*/
110
bool
search(
const
String
& text,
const
String
& stop,
bool
return_to_start =
false
);
111
116
bool
gotoLine(
Position
line_number);
117
121
void
rewind();
122
135
void
test
(
const
char
* file,
int
line,
bool
condition,
const
String
& msg)
const
;
136
141
String
getField(
Index
pos = 0,
const
String
& quotes =
""
,
142
const
String
& delimiters =
String::CHARACTER_CLASS__WHITESPACE
)
const
;
143
145
bool
startsWith(
const
String
& text)
const
;
146
148
bool
has(
const
String
& text)
const
;
149
153
Index
switchString(
const
std::vector<String>& data)
const
;
154
159
bool
parseColumnFormat(
const
char
* format,
Position
index,
Size
length,
void
* arg);
160
162
void
enableTrimWhitespaces(
bool
state);
163
165
bool
trimWhiteSpacesEnabled()
const
;
166
167
protected
:
169
/* @name Protected Attributes
170
*/
171
//_@{
173
String
line_
;
174
176
Position
line_number_
;
177
178
bool
trim_whitespaces_
;
179
181
vector<char>
col_buffer_
;
182
183
//_@}
184
};
185
186
187
# ifndef BALL_NO_INLINE_FUNCTIONS
188
# include <BALL/FORMAT/lineBasedFile.iC>
189
# endif
190
}
// namespace BALL
191
192
#endif // BALL_FORMAT_LINEBASEDFILE_H
BALL_INDEX_TYPE
BALL_EXPORT
#define BALL_EXPORT
Definition:
COMMON/global.h:50
BALL::LineBasedFile
Definition:
lineBasedFile.h:20
BALL::operator!=
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
BALL_SIZE_TYPE
BALL::LineBasedFile::line_number_
Position line_number_
line number in the file
Definition:
lineBasedFile.h:176
file.h
TEST::test
bool test
Definition:
classTest.h:20
BALL
Definition:
constants.h:12
BALL::String
Definition:
string.h:56
BALL::String::CHARACTER_CLASS__WHITESPACE
static const char * CHARACTER_CLASS__WHITESPACE
Definition:
string.h:137
BALL::File::OpenMode
std::ios::openmode OpenMode
Definition:
file.h:165
BALL::LineBasedFile::line_
String line_
buffer for the line in use
Definition:
lineBasedFile.h:173
BALL::LineBasedFile::trim_whitespaces_
bool trim_whitespaces_
Definition:
lineBasedFile.h:178
BALL::operator==
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL::File
Definition:
file.h:134
BALL::LineBasedFile::col_buffer_
vector< char > col_buffer_
buffer for column parsing
Definition:
lineBasedFile.h:181
Generated by
1.8.16