Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Static Public Attributes | Friends | List of all members
JEEP::JComment Struct Reference

Auxiliary class for comment. More...

#include <JComment.hh>

Inheritance diagram for JEEP::JComment:
std::vector< std::string >

Public Member Functions

 JComment ()
 Default constructor. More...
 
JCommentadd (const std::string &comment)
 Add comment. More...
 
JCommentadd (const JComment &comment)
 Add comment. More...
 

Static Public Attributes

static const char START_COMMENT = '#'
 start of comment More...
 
static const char CLOSE_COMMENT = '\n'
 close of comment More...
 
static const char QUOTE = '"'
 quote More...
 

Friends

std::istream & operator>> (std::istream &in, JComment &comment)
 Read comment from input. More...
 
std::ostream & operator<< (std::ostream &out, const JComment &comment)
 Write comment to output. More...
 

Detailed Description

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 29 of file JComment.hh.

Constructor & Destructor Documentation

JEEP::JComment::JComment ( )
inline

Default constructor.

Definition at line 41 of file JComment.hh.

42  {}

Member Function Documentation

JComment& JEEP::JComment::add ( const std::string &  comment)
inline

Add comment.

Parameters
commentcomment
Returns
this comment

Definition at line 51 of file JComment.hh.

52  {
53  this->push_back(comment);
54 
55  return *this;
56  }
JComment& JEEP::JComment::add ( const JComment comment)
inline

Add comment.

Parameters
commentcomment
Returns
this comment

Definition at line 65 of file JComment.hh.

66  {
67  for (const_iterator i = comment.begin(); i != comment.end(); ++i) {
68  this->push_back(*i);
69  }
70 
71  return *this;
72  }

Friends And Related Function Documentation

std::istream& operator>> ( std::istream &  in,
JComment comment 
)
friend

Read comment from input.

Parameters
ininput stream
commentcomment
Returns
input stream

Definition at line 82 of file JComment.hh.

83  {
84  using namespace std;
85 
86  while (in.peek() == (int) START_COMMENT) {
87 
88  in.get();
89 
90  if (in.peek() == (int) ' ') {
91  in.get();
92  }
93 
94  int c;
95  string buffer;
96 
97  while ((c = in.get()) != EOF && c != (int) CLOSE_COMMENT) {
98 
99  buffer.push_back((char) c);
100 
101  if (c == (int) QUOTE) {
102 
103  while ((c = in.get()) != EOF && c != (int) QUOTE) {
104  buffer.push_back((char) c);
105  }
106 
107  buffer.push_back(QUOTE);
108  }
109  }
110 
111  comment.push_back(buffer);
112  }
113 
114  return in;
115  }
static const char START_COMMENT
start of comment
Definition: JComment.hh:33
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
static const char CLOSE_COMMENT
close of comment
Definition: JComment.hh:34
static const char QUOTE
quote
Definition: JComment.hh:35
std::ostream& operator<< ( std::ostream &  out,
const JComment comment 
)
friend

Write comment to output.

Parameters
outoutput stream
commentcomment
Returns
output stream

Definition at line 125 of file JComment.hh.

126  {
127  using namespace std;
128 
129  for (JComment::const_iterator i = comment.begin(); i != comment.end(); ++i) {
130  out << START_COMMENT << ' ' << *i << CLOSE_COMMENT;
131  }
132 
133  return out << flush;
134  }
static const char START_COMMENT
start of comment
Definition: JComment.hh:33
static const char CLOSE_COMMENT
close of comment
Definition: JComment.hh:34

Member Data Documentation

const char JEEP::JComment::START_COMMENT = '#'
static

start of comment

Definition at line 33 of file JComment.hh.

const char JEEP::JComment::CLOSE_COMMENT = '\n'
static

close of comment

Definition at line 34 of file JComment.hh.

const char JEEP::JComment::QUOTE = '"'
static

quote

Definition at line 35 of file JComment.hh.


The documentation for this struct was generated from the following file: