laura is hosted by Hepforge, IPPP Durham
Laura++  v3r4
A maximum likelihood fitting package for performing Dalitz-plot analysis.
LauString.hh
Go to the documentation of this file.
1 
2 /*
3 Copyright 2008 University of Warwick
4 
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8 
9  http://www.apache.org/licenses/LICENSE-2.0
10 
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16 */
17 
18 /*
19 Laura++ package authors:
20 John Back
21 Paul Harrison
22 Thomas Latham
23 */
24 
33 #ifndef LAU_STRING_HH
34 #define LAU_STRING_HH
35 
36 #include <iostream>
37 #include <string>
38 #include <sstream>
39 #include <vector>
40 
41 #include "TString.h"
42 
43 class LauString {
44 
45  public:
46 
48  LauString();
49 
51 
54  LauString(const char* s);
55 
57 
60  LauString(const std::string& s);
61 
63 
66  LauString(const TString& s);
67 
69  LauString(const LauString& s);
70 
72  LauString& operator=(const LauString& s);
73 
75  virtual ~LauString();
76 
78 
81  void addInteger(int integer);
82 
84 
87  void addDouble(double value);
88 
90 
93  void addText(const char* text) {theString_ += text;}
94 
96 
99  void addText(const std::string& text) {theString_ += text;}
100 
102 
105  void addText(const TString& text) {theString_ += text.Data();}
106 
108 
111  LauString operator += (int integer);
112 
114 
117  LauString operator += (double value);
118 
120 
123  LauString operator += (const char* text);
124 
126 
129  LauString operator += (const std::string& text);
130 
132 
135  LauString operator += (const TString& text);
136 
138 
141  std::string getString() const {return theString_;}
142 
144 
147  const char* getData() const {return theString_.c_str();}
148 
150 
153  TString getTString() const {return TString(theString_.c_str());}
154 
156 
159  int size() const {return theString_.size();}
160 
162 
165  std::vector<std::string> split(const std::string& splitter) const;
166 
168 
171  std::vector<std::string> split(const LauString& splitter) const;
172 
173  protected:
174 
175  private:
177  std::string theString_;
178 
179 };
180 
181 #endif
void addText(const std::string &text)
Add some text from an STL string.
Definition: LauString.hh:99
Class for defining a string.
Definition: LauString.hh:43
const char * getData() const
Retrieve the string as an array of characters.
Definition: LauString.hh:147
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:120
LauString operator+=(int integer)
Add an integer to the string.
Definition: LauString.cc:83
void addText(const char *text)
Add some text from a character array.
Definition: LauString.hh:93
LauString & operator=(const LauString &s)
Copy assignment operator.
Definition: LauString.cc:57
int size() const
Retrieve the total size of the string.
Definition: LauString.hh:159
std::string theString_
The string.
Definition: LauString.hh:177
TString getTString() const
Retrieve the string as a TString.
Definition: LauString.hh:153
void addInteger(int integer)
Add an integer value to the string.
Definition: LauString.cc:69
std::string getString() const
Retrieve the string as an STL string.
Definition: LauString.hh:141
void addDouble(double value)
Add a double value to the string.
Definition: LauString.cc:76
void addText(const TString &text)
Add some text from a TString.
Definition: LauString.hh:105
virtual ~LauString()
Destructor.
Definition: LauString.cc:65
LauString()
Constructor for an empty string.
Definition: LauString.cc:37