Auxiliary class for comment.
More...
#include <JComment.hh>
|
static bool | is_special (const std::string &buffer) |
| Check if given string is special.
|
|
|
std::istream & | operator>> (std::istream &in, JComment &comment) |
| Read comment from input.
|
|
std::ostream & | operator<< (std::ostream &out, const JComment &comment) |
| Write comment to output.
|
|
Auxiliary class for comment.
A comment starts with a JComment::START_COMMENT and ends with a JComment::CLOSE_COMMENT.
The text between the quotes JComment::QUOTE is considered as one block which may cross newlines, etc.
The comments are appended.
Definition at line 41 of file JComment.hh.
◆ anonymous enum
Enumerator |
---|
UUID_t | index of UUID
|
Definition at line 44 of file JComment.hh.
◆ JComment()
JEEP::JComment::JComment |
( |
| ) |
|
|
inline |
◆ update() [1/2]
Update this comment with given UUID.
- Parameters
-
- Returns
- this comment
Definition at line 68 of file JComment.hh.
69 {
71 if ((
int) this->size() <=
UUID_t)
73 else
74 this->insert(this->begin() +
UUID_t, value_type());
75 }
76
78
79 return *this;
80 }
#define MAKE_STRING(A)
Make string.
◆ update() [2/2]
Update this comment with random UUID.
- Returns
- this comment
Definition at line 88 of file JComment.hh.
89 {
91 }
static const JUUID & rndm()
Generate random UUID.
◆ add() [1/2]
JComment & JEEP::JComment::add |
( |
const std::string & | comment | ) |
|
|
inline |
Add comment.
- Parameters
-
- Returns
- this comment
Definition at line 100 of file JComment.hh.
101 {
102 this->push_back(comment);
103
105 }
◆ add() [2/2]
Add comment block.
- Parameters
-
- Returns
- this comment
Definition at line 114 of file JComment.hh.
115 {
116 for (const_iterator i = comment.begin(); i != comment.end(); ++i) {
117 this->push_back(*i);
118 }
119
121 }
◆ hasUUID()
bool JEEP::JComment::hasUUID |
( |
| ) |
const |
|
inline |
Check if this comment has UUID.
- Returns
- true if UUID present; else false
Definition at line 129 of file JComment.hh.
◆ getUUID()
JUUID JEEP::JComment::getUUID |
( |
| ) |
const |
|
inline |
Get UUID.
- Returns
- UUID
Definition at line 140 of file JComment.hh.
141 {
143
144 const std::string& buffer = (*this)[
UUID_t];
145
147
148 } else {
149
150 THROW(JNoValue,
"No UUID in comment.");
151 }
152 }
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
static JUUID valueOf(const std::string &buffer)
Extract UUID.
◆ is_special()
static bool JEEP::JComment::is_special |
( |
const std::string & | buffer | ) |
|
|
inlinestatic |
Check if given string is special.
- Parameters
-
- Returns
- true if special; else false
Definition at line 223 of file JComment.hh.
224 {
225 const int N = buffer.size();
226
227 return (N > 2 &&
230 }
◆ operator>>
std::istream & operator>> |
( |
std::istream & | in, |
|
|
JComment & | comment ) |
|
friend |
Read comment from input.
- Parameters
-
in | input stream |
comment | comment |
- Returns
- input stream
Definition at line 162 of file JComment.hh.
163 {
165
167
168 in.get();
169
170 if (in.peek() == (int) ' ') {
171 in.get();
172 }
173
174 int c;
175 string buffer;
176
178
179 buffer.push_back((char) c);
180
181 if (c == (
int)
QUOTE) {
182
183 while ((c = in.get()) != EOF && c != (
int)
QUOTE) {
184 buffer.push_back((char) c);
185 }
186
187 buffer.push_back(
QUOTE);
188 }
189 }
190
191 comment.push_back(buffer);
192 }
193
194 return in;
195 }
◆ operator<<
std::ostream & operator<< |
( |
std::ostream & | out, |
|
|
const JComment & | comment ) |
|
friend |
Write comment to output.
- Parameters
-
out | output stream |
comment | comment |
- Returns
- output stream
Definition at line 205 of file JComment.hh.
206 {
208
209 for (JComment::const_iterator i = comment.begin(); i != comment.end(); ++i) {
211 }
212
213 return out << flush;
214 }
◆ START_COMMENT
char JEEP::JComment::START_COMMENT = '#' |
|
staticconstexpr |
◆ CLOSE_COMMENT
char JEEP::JComment::CLOSE_COMMENT = '\n' |
|
staticconstexpr |
◆ START_SPECIAL
char JEEP::JComment::START_SPECIAL = '$' |
|
staticconstexpr |
◆ CLOSE_SPECIAL
char JEEP::JComment::CLOSE_SPECIAL = '$' |
|
staticconstexpr |
◆ QUOTE
char JEEP::JComment::QUOTE = '"' |
|
staticconstexpr |
The documentation for this struct was generated from the following file: