laura is hosted by Hepforge, IPPP Durham
Laura++  v3r2
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  LauString(const LauString& s);
56 
58  LauString& operator=(const LauString& s);
59 
61  virtual ~LauString();
62 
64 
67  void addInteger(int integer);
68 
70 
73  void addDouble(double value);
74 
76 
79  void addText(const char* text) {theString_ += text;}
80 
82 
85  void addText(const std::string& text) {theString_ += text;}
86 
88 
91  void addText(const TString& text) {theString_ += text.Data();}
92 
94 
97  LauString operator += (int integer);
98 
100 
103  LauString operator += (double value);
104 
106 
109  LauString operator += (const char* text);
110 
112 
115  LauString operator += (const std::string& text);
116 
118 
121  LauString operator += (const TString& text);
122 
124 
127  std::string getString() const {return theString_;}
128 
130 
133  const char* getData() const {return theString_.c_str();}
134 
136 
139  TString getTString() const {return TString(theString_.c_str());}
140 
142 
145  int size() const {return theString_.size();}
146 
148 
151  std::vector<std::string> split(const std::string& splitter) const;
152 
154 
157  std::vector<std::string> split(const LauString& splitter) const;
158 
159  protected:
160 
161  private:
163  std::string theString_;
164 
165 };
166 
167 #endif
void addText(const std::string &text)
Add some text from an STL string.
Definition: LauString.hh:85
Class for defining a string.
Definition: LauString.hh:29
const char * getData() const
Retrieve the string as an array of characters.
Definition: LauString.hh:133
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:106
LauString operator+=(int integer)
Add an integer to the string.
Definition: LauString.cc:69
void addText(const char *text)
Add some text from a character array.
Definition: LauString.hh:79
LauString & operator=(const LauString &s)
Copy assignment operator.
Definition: LauString.cc:43
int size() const
Retrieve the total size of the string.
Definition: LauString.hh:145
std::string theString_
The string.
Definition: LauString.hh:163
TString getTString() const
Retrieve the string as a TString.
Definition: LauString.hh:139
void addInteger(int integer)
Add an integer value to the string.
Definition: LauString.cc:55
std::string getString() const
Retrieve the string as an STL string.
Definition: LauString.hh:127
void addDouble(double value)
Add a double value to the string.
Definition: LauString.cc:62
void addText(const TString &text)
Add some text from a TString.
Definition: LauString.hh:91
virtual ~LauString()
Destructor.
Definition: LauString.cc:51
LauString()
Constructor for an empty string.
Definition: LauString.cc:23