50 bool p_GetLine(QString &line,
bool chkComment);
57 TextFile(
const QString &filename,
const char *openmode =
"input",
58 const char *extension =
"");
61 TextFile(
const char *filename,
const char *openmode,
62 std::vector<QString> &lines,
63 const int &maxLinesToReadWrite = 0,
64 const bool skipComments =
true);
66 const char *openmode, std::vector<QString> &lines,
67 const int &maxLinesToReadWrite = 0,
68 const bool skipComments =
true);
70 const char *openmode, QString *lines,
71 const int &maxLinesToReadWrite,
const bool skipComments =
true);
73 const char *openmode, QString *lines,
74 const int &maxLinesToReadWrite,
const bool skipComments =
true);
78 void Open(
const QString &filename,
const char *openmode =
"input",
79 const char *extension =
"");
80 void Open(
const char *filename,
const char *openmode =
"input",
81 const char *extension =
"");
83 bool OpenChk(
bool bailIfNotOpen =
false);
88 void GetFile(std::vector<QString> &lines,
89 const int &maxLinesToRead = 0,
90 const bool skipComments =
true);
91 void GetFile(QString *lines,
const int &maxLinesToRead,
92 const bool skipComments =
true);
94 void PutFile(std::vector<QString> &lines,
95 const int &maxLinesToWrite = 0);
96 void PutFile(
const QString *lines,
const int &maxLinesToWrite);
98 bool GetLine(QString &line,
const bool skipComments =
true);
101 bool GetLine(
const bool skipComments =
true);
104 void PutLine(
const QString &line);
105 void PutLine(
const char *line =
"");
113 void SetComment(
const char *commentString =
"#");
114 void SetNewLine(
const char *newLineString =
"\n");
116 int LineCount(
const int &maxLinesToRead = 0);
117 std::streamsize
Size();
Provides access to sequential ASCII stream I/O.
Definition TextFile.h:38
QString GetComment()
Definition TextFile.cpp:564
bool GetLine(QString &line, const bool skipComments=true)
Gets next line from file.
Definition TextFile.cpp:411
TextFile()
Constructs an empty TextFile object.
Definition TextFile.cpp:22
void GetFile(std::vector< QString > &lines, const int &maxLinesToRead=0, const bool skipComments=true)
Definition TextFile.cpp:334
void Open(const QString &filename, const char *openmode="input", const char *extension="")
Opens a text file.
Definition TextFile.cpp:217
QString p_newLineString
'newline' string used by PutLine and PutLineComment
Definition TextFile.h:47
void SetComment(const char *commentString="#")
Sets the 'comment' string.
Definition TextFile.cpp:577
QString p_commentString
'comment' string used by GetLine and PutLineComment
Definition TextFile.h:45
std::fstream p_stream
File stream handle.
Definition TextFile.h:41
int LineCount(const int &maxLinesToRead=0)
Counts number of lines in file.
Definition TextFile.cpp:607
bool OpenChk(bool bailIfNotOpen=false)
Definition TextFile.cpp:301
int p_openmode
openmode of file: Input, Output, Overwrite, Append
Definition TextFile.h:42
void PutLine(const QString &line)
Writes string to file and appends a 'newline' string.
Definition TextFile.cpp:508
std::streamsize Size()
Counts number of bytes in file.
Definition TextFile.cpp:652
bool GetLineNoFilter()
Gets next NON-COMMENT line from file.
Definition TextFile.cpp:447
~TextFile()
Closes file (if still open). Destroys the TextFile object.
Definition TextFile.cpp:186
void PutFile(std::vector< QString > &lines, const int &maxLinesToWrite=0)
Definition TextFile.cpp:370
void Open(const char *filename, const char *openmode="input", const char *extension="")
void Close()
Closes file. Called automatically by TextFile destructor.
Definition TextFile.cpp:326
void Rewind()
Sets Read / Write pointer to begining of opened file.
Definition TextFile.cpp:317
QString GetNewLine()
Definition TextFile.cpp:582
QString p_filename
FileName of the opened file.
Definition TextFile.h:44
bool p_GetLine(QString &line, bool chkComment)
Gets next line from file.
Definition TextFile.cpp:463
void PutLineComment(const QString &line)
Writes string to file, prepends a 'comment' string and appends a 'newline' string.
Definition TextFile.cpp:549
void SetNewLine(const char *newLineString="\n")
Sets the 'newline' string.
Definition TextFile.cpp:593
This is free and unencumbered software released into the public domain.
Definition Apollo.h:16