Jpp  15.0.3
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 
6 
7 /**
8  * \author mdejong
9  */
10 
11 namespace JLANG {}
12 namespace JPP { using namespace JLANG; }
13 
14 namespace JLANG {
15 
16  /**
17  * Wrapper class around string.
18  *
19  * The redirect operator <tt>istream::operator>>()</tt> will read until given template character
20  * instead of the standard white space.
21  */
22  template<char sep>
23  class JToken :
24  public std::string
25  {
26  public:
27  /**
28  * Separator.
29  */
30  const static char SEPARATOR = sep;
31 
32 
33  /**
34  * Default constructor.
35  */
36  JToken() :
37  std::string()
38  {}
39 
40 
41  /**
42  * Read token from input stream.
43  *
44  * \param in input stream
45  * \param token token
46  * \return input stream
47  */
48  friend inline std::istream& operator>>(std::istream& in, JToken& token)
49  {
50  token.clear();
51 
52  return getline(in, token, SEPARATOR);
53  }
54 
55 
56  /**
57  * Write token to output stream.
58  *
59  * \param out output stream
60  * \param token token
61  * \return output stream
62  */
63  friend inline std::ostream& operator<<(std::ostream& out, const JToken& token)
64  {
65  return out << static_cast<const std::string&>(token) << SEPARATOR;
66  }
67  };
68 }
69 
70 #endif
static const char SEPARATOR
Separator.
Definition: JToken.hh:30
friend std::ostream & operator<<(std::ostream &out, const JToken &token)
Write token to output stream.
Definition: JToken.hh:63
JToken()
Default constructor.
Definition: JToken.hh:36
std::istream & getline(std::istream &in, JString &object)
Read string from input stream until end of line.
Definition: JString.hh:478
Wrapper class around string.
Definition: JToken.hh:23
friend std::istream & operator>>(std::istream &in, JToken &token)
Read token from input stream.
Definition: JToken.hh:48
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:42