laura is hosted by Hepforge, IPPP Durham
Laura++  v2r1p1
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauString.hh
Go to the documentation of this file.
1 
2 // Copyright University of Warwick 2008 - 2013.
3 // Distributed under the Boost Software License, Version 1.0.
4 // (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5 
6 // Authors:
7 // Thomas Latham
8 // John Back
9 // Paul Harrison
10 
19 #ifndef LAU_STRING_HH
20 #define LAU_STRING_HH
21 
22 #include <iostream>
23 #include <string>
24 #include <sstream>
25 #include <vector>
26 
27 #include "TString.h"
28 
29 class LauString {
30 
31  public:
32 
34  LauString();
35 
37 
40  LauString(const char* s);
41 
43 
46  LauString(const std::string& s);
47 
49 
52  LauString(const TString& s);
53 
55  virtual ~LauString();
56 
58 
61  void addInteger(int integer);
62 
64 
67  void addDouble(double value);
68 
70 
73  void addText(const char* text) {theString_ += text;}
74 
76 
79  void addText(const std::string& text) {theString_ += text;}
80 
82 
85  void addText(const TString& text) {theString_ += text.Data();}
86 
88 
91  LauString operator += (int integer);
92 
94 
97  LauString operator += (double value);
98 
100 
103  LauString operator += (const char* text);
104 
106 
109  LauString operator += (const std::string& text);
110 
112 
115  LauString operator += (const TString& text);
116 
118 
121  std::string getString() const {return theString_;}
122 
124 
127  const char* getData() const {return theString_.c_str();}
128 
130 
133  TString getTString() const {return TString(theString_.c_str());}
134 
136 
139  int size() const {return theString_.size();}
140 
142 
145  std::vector<std::string> split(const std::string& splitter) const;
146 
148 
151  std::vector<std::string> split(const LauString& splitter) const;
152 
153  protected:
154 
155  private:
157  std::string theString_;
158 
159 };
160 
161 #endif
void addText(const std::string &text)
Add some text from an STL string.
Definition: LauString.hh:79
Class for defining a string.
Definition: LauString.hh:29
const char * getData() const
Retrieve the string as an array of characters.
Definition: LauString.hh:127
std::vector< std::string > split(const std::string &splitter) const
Split up a string according to a split string (e.g. &quot;:&quot; or &quot; &quot;)
Definition: LauString.cc:94
LauString operator+=(int integer)
Add an integer to the string.
Definition: LauString.cc:57
void addText(const char *text)
Add some text from a character array.
Definition: LauString.hh:73
int size() const
Retrieve the total size of the string.
Definition: LauString.hh:139
std::string theString_
The string.
Definition: LauString.hh:157
TString getTString() const
Retrieve the string as a TString.
Definition: LauString.hh:133
void addInteger(int integer)
Add an integer value to the string.
Definition: LauString.cc:43
std::string getString() const
Retrieve the string as an STL string.
Definition: LauString.hh:121
void addDouble(double value)
Add a double value to the string.
Definition: LauString.cc:50
void addText(const TString &text)
Add some text from a TString.
Definition: LauString.hh:85
virtual ~LauString()
Destructor.
Definition: LauString.cc:39
LauString()
Constructor for an empty string.
Definition: LauString.cc:23