00001 /************************************************************************ 00002 filename: CEGUITextUtils.h 00003 created: 30/5/2004 00004 author: Paul D Turner 00005 00006 purpose: Interface to a static class containing some utility 00007 functions for text / string operations 00008 *************************************************************************/ 00009 /************************************************************************* 00010 Crazy Eddie's GUI System (http://www.cegui.org.uk) 00011 Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk) 00012 00013 This library is free software; you can redistribute it and/or 00014 modify it under the terms of the GNU Lesser General Public 00015 License as published by the Free Software Foundation; either 00016 version 2.1 of the License, or (at your option) any later version. 00017 00018 This library is distributed in the hope that it will be useful, 00019 but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 Lesser General Public License for more details. 00022 00023 You should have received a copy of the GNU Lesser General Public 00024 License along with this library; if not, write to the Free Software 00025 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00026 *************************************************************************/ 00027 #ifndef _CEGUITextUtils_h_ 00028 #define _CEGUITextUtils_h_ 00029 00030 #include "CEGUIBase.h" 00031 #include "CEGUIString.h" 00032 00033 // Start of CEGUI namespace section 00034 namespace CEGUI 00035 { 00040 class CEGUIEXPORT TextUtils 00041 { 00042 public: 00043 /************************************************************************* 00044 Constants 00045 *************************************************************************/ 00046 static const String DefaultWhitespace; 00047 static const String DefaultAlphanumerical; 00048 static const String DefaultWrapDelimiters; 00049 00050 00051 /************************************************************************* 00052 Methods 00053 *************************************************************************/ 00074 static String getNextWord(const String& str, String::size_type start_idx = 0, const String& delimiters = DefaultWhitespace); 00075 00076 00093 static String::size_type getWordStartIdx(const String& str, String::size_type idx); 00094 00095 00113 static String::size_type getNextWordStartIdx(const String& str, String::size_type idx); 00114 00115 00126 static void trimLeadingChars(String& str, const String& chars); 00127 00128 00139 static void trimTrailingChars(String& str, const String& chars); 00140 00141 00142 private: 00143 /************************************************************************* 00144 Data 00145 *************************************************************************/ 00146 static String d_delimiters; 00147 static String d_whitespace; 00148 00149 00150 /************************************************************************* 00151 Construction / Destruction 00152 *************************************************************************/ 00157 TextUtils(void); 00158 ~TextUtils(void); 00159 }; 00160 00161 } // End of CEGUI namespace section 00162 00163 00164 #endif // end of guard _CEGUITextUtils_h_