Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages
StringList.h
Go to the documentation of this file.
1 // --------------------------------------------------------------------------
2 // OpenMS -- Open-Source Mass Spectrometry
3 // --------------------------------------------------------------------------
4 // Copyright The OpenMS Team -- Eberhard Karls University Tuebingen,
5 // ETH Zurich, and Freie Universitaet Berlin 2002-2013.
6 //
7 // This software is released under a three-clause BSD license:
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of any author or any participating institution
14 // may be used to endorse or promote products derived from this software
15 // without specific prior written permission.
16 // For a full list of authors, refer to the file AUTHORS.
17 // --------------------------------------------------------------------------
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 // ARE DISCLAIMED. IN NO EVENT SHALL ANY OF THE AUTHORS OR THE CONTRIBUTING
22 // INSTITUTIONS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25 // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28 // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 //
30 // --------------------------------------------------------------------------
31 // $Maintainer: Stephan Aiche$
32 // $Authors: Marc Sturm $
33 // --------------------------------------------------------------------------
34 
35 #ifndef OPENMS_DATASTRUCTURES_STRINGLIST_H
36 #define OPENMS_DATASTRUCTURES_STRINGLIST_H
37 
39 
40 #ifdef OPENMS_COMPILER_MSVC
41 #pragma warning( push )
42 #pragma warning( disable : 4251 ) // disable MSVC dll-interface warning
43 #endif
44 
45 class QStringList;
46 
47 namespace OpenMS
48 {
56  class OPENMS_DLLAPI StringList :
57  public std::vector<String>
58  {
59 public:
60 
64  typedef iterator Iterator;
67  typedef const_iterator ConstIterator;
69  typedef reverse_iterator ReverseIterator;
71  typedef const_reverse_iterator ConstReverseIterator;
73 
75 
76  StringList();
79  StringList(const StringList & rhs);
81  StringList(const std::vector<String> & rhs);
83  StringList(const std::vector<std::string> & rhs);
85  StringList(const QStringList & rhs);
87  StringList & operator=(const StringList & rhs);
89  StringList & operator=(const std::vector<String> & rhs);
91  StringList & operator=(const std::vector<std::string> & rhs);
93 
95 
96 
104  Iterator search(const Iterator & start, const String & text, bool trim = false);
105 
112  Iterator search(const String & text, bool trim = false);
113 
122  Iterator searchSuffix(const Iterator & start, const String & text, bool trim = false);
123 
131  Iterator searchSuffix(const String & text, bool trim = false);
132 
141  ConstIterator search(const ConstIterator & start, const String & text, bool trim = false) const;
142 
149  ConstIterator search(const String & text, bool trim = false) const;
150 
159  ConstIterator searchSuffix(const ConstIterator & start, const String & text, bool trim = false) const;
160 
168  ConstIterator searchSuffix(const String & text, bool trim = false) const;
170 
172  template <typename StringType>
173  StringList & operator<<(const StringType & string)
174  {
175  this->push_back(string);
176  return *this;
177  }
178 
180  static StringList create(const String & list, const char splitter = ',');
182  static StringList create(const char * const * list, UInt size);
184  bool contains(const String & s) const;
186  void toUpper();
188  void toLower();
189 
191  String concatenate(const String & glue = "") const;
192 
194  friend OPENMS_DLLAPI std::ostream & operator<<(std::ostream & os, const StringList & p);
195 
196  };
197 
198 } // namespace OPENMS
199 
200 #ifdef OPENMS_COMPILER_MSVC
201 #pragma warning( pop )
202 #endif
203 
204 #endif // OPENMS_DATASTRUCTURES_STRINGLIST_H
A more convenient string class.
Definition: String.h:56
reverse_iterator ReverseIterator
Mutable reverse iterator.
Definition: StringList.h:69
const_reverse_iterator ConstReverseIterator
Non-mutable reverse iterator.
Definition: StringList.h:71
std::ostream & operator<<(std::ostream &os, const ItraqQuantifier::ItraqQuantifierStats &stats)
const_iterator ConstIterator
Non-mutable iterator.
Definition: StringList.h:67
StringList & operator<<(const StringType &string)
Operator for appending entries with less code.
Definition: StringList.h:173
iterator Iterator
Mutable iterator.
Definition: StringList.h:65
String list.
Definition: StringList.h:56

OpenMS / TOPP release 1.11.1 Documentation generated on Thu Nov 14 2013 11:19:21 using doxygen 1.8.5