Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JToken.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JTOKEN__
2 #define __JLANG__JTOKEN__
3 
4 #include <string>
5 #include <ostream>
6 
7 
8 /**
9  * \author mdejong
10  */
11 
12 namespace JLANG {}
13 namespace JPP { using namespace JLANG; }
14 
15 namespace JLANG {
16 
17  /**
18  * Wrapper class around string.
19  *
20  * The redirect operator <tt>istream::operator>>()</tt> will read until given template character
21  * instead of the standard white space.
22  */
23  template<char sep>
24  class JToken :
25  public std::string
26  {
27  public:
28  /**
29  * Separator.
30  */
31  const static char SEPARATOR = sep;
32 
33 
34  /**
35  * Default constructor.
36  */
37  JToken() :
38  std::string()
39  {}
40 
41 
42  /**
43  * Read token from input stream.
44  *
45  * \param in input stream
46  * \param token token
47  * \return input stream
48  */
49  friend inline std::istream& operator>>(std::istream& in, JToken& token)
50  {
51  token.clear();
52 
53  return getline(in, token, SEPARATOR);
54  }
55 
56 
57  /**
58  * Write token to output stream.
59  *
60  * \param out output stream
61  * \param token token
62  * \return output stream
63  */
64  friend inline std::ostream& operator<<(std::ostream& out, const JToken& token)
65  {
66  return out << static_cast<const std::string&>(token) << SEPARATOR;
67  }
68  };
69 }
70 
71 #endif
static const char SEPARATOR
Separator.
Definition: JToken.hh:31
friend std::ostream & operator<<(std::ostream &out, const JToken &token)
Write token to output stream.
Definition: JToken.hh:64
JToken()
Default constructor.
Definition: JToken.hh:37
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
Wrapper class around string.
Definition: JToken.hh:24
friend std::istream & operator>>(std::istream &in, JToken &token)
Read token from input stream.
Definition: JToken.hh:49