Crazy Eddie's GUI System  0.8.1
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
TextUtils.h
1 /***********************************************************************
2  filename: CEGUITextUtils.h
3  created: 30/5/2004
4  author: Paul D Turner
5 
6  purpose: Interface to a static class containing some utility
7  functions for text / string operations
8 *************************************************************************/
9 /***************************************************************************
10  * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
11  *
12  * Permission is hereby granted, free of charge, to any person obtaining
13  * a copy of this software and associated documentation files (the
14  * "Software"), to deal in the Software without restriction, including
15  * without limitation the rights to use, copy, modify, merge, publish,
16  * distribute, sublicense, and/or sell copies of the Software, and to
17  * permit persons to whom the Software is furnished to do so, subject to
18  * the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be
21  * included in all copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
26  * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
27  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
29  * OTHER DEALINGS IN THE SOFTWARE.
30  ***************************************************************************/
31 #ifndef _CEGUITextUtils_h_
32 #define _CEGUITextUtils_h_
33 
34 #include "CEGUI/Base.h"
35 #include "CEGUI/String.h"
36 #include <vector>
37 
38 // Start of CEGUI namespace section
39 namespace CEGUI
40 {
45 class CEGUIEXPORT TextUtils
46 {
47 public:
48  /*************************************************************************
49  Constants
50  *************************************************************************/
51  static const String DefaultWhitespace;
54 
55 
56  /*************************************************************************
57  Methods
58  *************************************************************************/
79  static String getNextWord(const String& str, String::size_type start_idx = 0, const String& delimiters = DefaultWhitespace);
80 
81 
98  static String::size_type getWordStartIdx(const String& str, String::size_type idx);
99 
100 
118  static String::size_type getNextWordStartIdx(const String& str, String::size_type idx);
119 
120 
131  static void trimLeadingChars(String& str, const String& chars);
132 
133 
144  static void trimTrailingChars(String& str, const String& chars);
145 
146 private:
147  /*************************************************************************
148  Data
149  *************************************************************************/
150  static String d_delimiters;
151  static String d_whitespace;
152 
153 
154  /*************************************************************************
155  Construction / Destruction
156  *************************************************************************/
161  TextUtils(void);
162  ~TextUtils(void);
163 };
164 
165 } // End of CEGUI namespace section
166 
167 
168 #endif // end of guard _CEGUITextUtils_h_