BALL
1.4.2
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
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>
line_buffer_
;
182
184
vector<char>
col_buffer_
;
185
186
//_@}
187
};
188
189
190
# ifndef BALL_NO_INLINE_FUNCTIONS
191
# include <BALL/FORMAT/lineBasedFile.iC>
192
# endif
193
}
// namespace BALL
194
195
#endif // BALL_FORMAT_LINEBASEDFILE_H
Generated by
1.8.3.1