ARB
Main Page
Namespaces
Classes
Files
File List
File Members
CORE
FileContent.h
Go to the documentation of this file.
1
// ============================================================= //
2
// //
3
// File : FileContent.h //
4
// Purpose : //
5
// //
6
// Coded by Ralf Westram (coder@reallysoft.de) in April 2012 //
7
// Institute of Microbiology (Technical University Munich) //
8
// http://www.arb-home.de/ //
9
// //
10
// ============================================================= //
11
12
#ifndef FILECONTENT_H
13
#define FILECONTENT_H
14
15
#ifndef ARB_STRARRAY_H
16
#include "
arb_strarray.h
"
17
#endif
18
19
class
FileBuffer;
20
21
class
FileContent
:
virtual
Noncopyable
{
22
// provides simple load/modify/save for textfiles
23
// (accepts any LF-variant)
24
25
char
*path;
26
GB_ERROR
error;
27
StrArray Lines;
28
29
void
init();
30
31
public
:
32
FileContent
(
const
char
*path_) : path(
ARB_strdup
(path_)), error(
NULp
) { init(); }
33
~FileContent
() { free(path); }
34
35
GB_ERROR
has_error
()
const
{
return
error; }
36
37
StrArray&
lines
() {
// intended to be modified
38
arb_assert
(!
has_error
());
39
return
Lines;
40
}
41
42
GB_ERROR
save
();
43
GB_ERROR
saveAs
(
const
char
*path_) { freedup(path, path_);
return
save
(); }
44
};
45
46
47
#else
48
#error FileContent.h included twice
49
#endif // FILECONTENT_H
50
arb_assert
#define arb_assert(cond)
Definition:
arb_assert.h:245
GB_ERROR
const char * GB_ERROR
Definition:
arb_core.h:25
FileContent::~FileContent
~FileContent()
Definition:
FileContent.h:33
FileContent::lines
StrArray & lines()
Definition:
FileContent.h:37
FileContent::saveAs
GB_ERROR saveAs(const char *path_)
Definition:
FileContent.h:43
ARB_strdup
char * ARB_strdup(const char *str)
Definition:
arb_string.h:27
FileContent::save
GB_ERROR save()
Definition:
FileContent.cxx:35
FileContent::FileContent
FileContent(const char *path_)
Definition:
FileContent.h:32
FileContent::has_error
GB_ERROR has_error() const
Definition:
FileContent.h:35
FileContent
Definition:
FileContent.h:21
NULp
#define NULp
Definition:
cxxforward.h:116
char
arb_strarray.h
Noncopyable
Definition:
arbtools.h:39
Generated by
1.8.8