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 * Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team 00011 * 00012 * Permission is hereby granted, free of charge, to any person obtaining 00013 * a copy of this software and associated documentation files (the 00014 * "Software"), to deal in the Software without restriction, including 00015 * without limitation the rights to use, copy, modify, merge, publish, 00016 * distribute, sublicense, and/or sell copies of the Software, and to 00017 * permit persons to whom the Software is furnished to do so, subject to 00018 * the following conditions: 00019 * 00020 * The above copyright notice and this permission notice shall be 00021 * included in all copies or substantial portions of the Software. 00022 * 00023 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00024 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00025 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 00026 * IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 00027 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 00028 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 00029 * OTHER DEALINGS IN THE SOFTWARE. 00030 ***************************************************************************/ 00031 #ifndef _CEGUITextUtils_h_ 00032 #define _CEGUITextUtils_h_ 00033 00034 #include "CEGUIBase.h" 00035 #include "CEGUIString.h" 00036 00037 // Start of CEGUI namespace section 00038 namespace CEGUI 00039 { 00044 class CEGUIEXPORT TextUtils 00045 { 00046 public: 00047 /************************************************************************* 00048 Constants 00049 *************************************************************************/ 00050 static const String DefaultWhitespace; 00051 static const String DefaultAlphanumerical; 00052 static const String DefaultWrapDelimiters; 00053 00054 00055 /************************************************************************* 00056 Methods 00057 *************************************************************************/ 00078 static String getNextWord(const String& str, String::size_type start_idx = 0, const String& delimiters = DefaultWhitespace); 00079 00080 00097 static String::size_type getWordStartIdx(const String& str, String::size_type idx); 00098 00099 00117 static String::size_type getNextWordStartIdx(const String& str, String::size_type idx); 00118 00119 00130 static void trimLeadingChars(String& str, const String& chars); 00131 00132 00143 static void trimTrailingChars(String& str, const String& chars); 00144 00145 00146 private: 00147 /************************************************************************* 00148 Data 00149 *************************************************************************/ 00150 static String d_delimiters; 00151 static String d_whitespace; 00152 00153 00154 /************************************************************************* 00155 Construction / Destruction 00156 *************************************************************************/ 00161 TextUtils(void); 00162 ~TextUtils(void); 00163 }; 00164 00165 } // End of CEGUI namespace section 00166 00167 00168 #endif // end of guard _CEGUITextUtils_h_