Auxiliary class for comment.
More...
#include <JComment.hh>
|
static bool | is_special (const std::string &buffer) |
| Check if given string is special. More...
|
|
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.
71 if ((
int) this->size() <=
UUID_t)
74 this->insert(this->begin() +
UUID_t, value_type());
#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.
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.
102 this->push_back(comment);
◆ add() [2/2]
Add comment block.
- Parameters
-
- Returns
- this comment
Definition at line 114 of file JComment.hh.
116 for (const_iterator i = comment.begin(); i != comment.end(); ++i) {
◆ 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.
144 const std::string& buffer = (*this)[
UUID_t];
150 THROW(JNoValue,
"No UUID in comment.");
#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.
225 const int N = buffer.size();
◆ 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.
170 if (in.peek() == (
int)
' ') {
179 buffer.push_back((
char) c);
181 if (c == (
int)
QUOTE) {
183 while ((c = in.get()) != EOF && c != (
int)
QUOTE) {
184 buffer.push_back((
char) c);
187 buffer.push_back(
QUOTE);
191 comment.push_back(buffer);
◆ 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.
209 for (JComment::const_iterator i = comment.begin(); i != comment.end(); ++i) {
◆ START_COMMENT
constexpr char JEEP::JComment::START_COMMENT = '#' |
|
staticconstexpr |
◆ CLOSE_COMMENT
constexpr char JEEP::JComment::CLOSE_COMMENT = '\n' |
|
staticconstexpr |
◆ START_SPECIAL
constexpr char JEEP::JComment::START_SPECIAL = '$' |
|
staticconstexpr |
◆ CLOSE_SPECIAL
constexpr char JEEP::JComment::CLOSE_SPECIAL = '$' |
|
staticconstexpr |
◆ QUOTE
constexpr char JEEP::JComment::QUOTE = '"' |
|
staticconstexpr |
The documentation for this struct was generated from the following file: