library of assembled shared sources

http://lass.cocamware.com

extended_string.h

Go to the documentation of this file.
00001 /** @file
00002  *  @author Bram de Greve (bramz@users.sourceforge.net)
00003  *  @author Tom De Muer (tomdemuer@users.sourceforge.net)
00004  *
00005  *  *** BEGIN LICENSE INFORMATION ***
00006  *  
00007  *  The contents of this file are subject to the Common Public Attribution License 
00008  *  Version 1.0 (the "License"); you may not use this file except in compliance with 
00009  *  the License. You may obtain a copy of the License at 
00010  *  http://lass.sourceforge.net/cpal-license. The License is based on the 
00011  *  Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover 
00012  *  use of software over a computer network and provide for limited attribution for 
00013  *  the Original Developer. In addition, Exhibit A has been modified to be consistent 
00014  *  with Exhibit B.
00015  *  
00016  *  Software distributed under the License is distributed on an "AS IS" basis, WITHOUT 
00017  *  WARRANTY OF ANY KIND, either express or implied. See the License for the specific 
00018  *  language governing rights and limitations under the License.
00019  *  
00020  *  The Original Code is LASS - Library of Assembled Shared Sources.
00021  *  
00022  *  The Initial Developer of the Original Code is Bram de Greve and Tom De Muer.
00023  *  The Original Developer is the Initial Developer.
00024  *  
00025  *  All portions of the code written by the Initial Developer are:
00026  *  Copyright (C) 2004-2007 the Initial Developer.
00027  *  All Rights Reserved.
00028  *  
00029  *  Contributor(s):
00030  *
00031  *  Alternatively, the contents of this file may be used under the terms of the 
00032  *  GNU General Public License Version 2 or later (the GPL), in which case the 
00033  *  provisions of GPL are applicable instead of those above.  If you wish to allow use
00034  *  of your version of this file only under the terms of the GPL and not to allow 
00035  *  others to use your version of this file under the CPAL, indicate your decision by 
00036  *  deleting the provisions above and replace them with the notice and other 
00037  *  provisions required by the GPL License. If you do not delete the provisions above,
00038  *  a recipient may use your version of this file under either the CPAL or the GPL.
00039  *  
00040  *  *** END LICENSE INFORMATION ***
00041  */
00042 
00043 
00044 
00045 /** @defgroup extended_string
00046  *  @brief extra std::string functionality
00047  *  @author Bram de Greve [BdG]
00048  *
00049  *  ExtendedString is not an extended std::string implementation as the name might suggest, but
00050  *  a set of functions that provide extra functionality on very standard std::string strings.
00051  *  Most of them are inspired by the string module of Python, as you will notice.
00052  *  Others are std::string implementations of C functions operating on char arrays
00053  */
00054 
00055 #ifndef LASS_GUARDIAN_OF_INCLUSION_STDE_EXTENDED_STRING_H
00056 #define LASS_GUARDIAN_OF_INCLUSION_STDE_EXTENDED_STRING_H
00057 
00058 #include "stde_common.h"
00059 
00060 #if LASS_PLATFORM_TYPE == LASS_PLATFORM_TYPE_BSD
00061 #   ifdef toupper
00062 #       undef toupper
00063 #   endif
00064 #   ifdef tolower
00065 #       undef tolower
00066 #   endif
00067 #endif
00068 
00069 namespace lass
00070 {
00071 namespace stde
00072 {
00073 
00074 template <typename Char, typename Traits, typename Alloc>
00075 std::basic_string<Char, Traits, Alloc>
00076 tolower(const std::basic_string<Char, Traits, Alloc>& input,
00077     const std::locale& locale = std::locale());
00078 
00079 template <typename Char, typename Traits, typename Alloc>
00080 std::basic_string<Char, Traits, Alloc>
00081 toupper(const std::basic_string<Char, Traits, Alloc>& input,
00082     const std::locale& locale = std::locale());
00083 
00084 template <typename Char, typename Traits, typename Alloc>
00085 std::basic_string<Char, Traits, Alloc>
00086 replace_all(const std::basic_string<Char, Traits, Alloc>& input,
00087     const std::basic_string<Char, Traits, Alloc>& to_be_replaced,
00088     const std::basic_string<Char, Traits, Alloc>& replacement);
00089 template <typename Char, typename Traits, typename Alloc>
00090 std::basic_string<Char, Traits, Alloc>
00091 replace_all(const std::basic_string<Char, Traits, Alloc>& input,
00092     const Char* to_be_replaced,
00093     const Char* replacement);
00094 
00095 template <typename Char, typename Traits, typename Alloc>
00096 bool begins_with(const std::basic_string<Char, Traits, Alloc>& input,
00097     const std::basic_string<Char, Traits, Alloc>& prefix);
00098 template <typename Char, typename Traits, typename Alloc>
00099 bool begins_with(const std::basic_string<Char, Traits, Alloc>& input,
00100     const Char* prefix);
00101 
00102 template <typename Char, typename Traits, typename Alloc>
00103 bool ends_with(const std::basic_string<Char, Traits, Alloc>& input,
00104     const std::basic_string<Char, Traits, Alloc>& suffix);
00105 template <typename Char, typename Traits, typename Alloc>
00106 bool ends_with(const std::basic_string<Char, Traits, Alloc>& input,
00107     const Char* suffix);
00108 
00109 template <typename Char, typename Traits, typename Alloc>
00110 std::vector< std::basic_string<Char, Traits, Alloc> >
00111 split(const std::basic_string<Char, Traits, Alloc>& to_be_split);
00112 
00113 template <typename Char, typename Traits, typename Alloc>
00114 std::vector< std::basic_string<Char, Traits, Alloc> >
00115 split(const std::basic_string<Char, Traits, Alloc>& to_be_split,
00116       const std::basic_string<Char, Traits, Alloc>& seperator,
00117       size_t max_split = 0);
00118 template <typename Char, typename Traits, typename Alloc>
00119 std::vector< std::basic_string<Char, Traits, Alloc> >
00120 split(const std::basic_string<Char, Traits, Alloc>& to_be_split,
00121       const Char* seperator,
00122       size_t max_split = 0);
00123 
00124 template <typename Char, typename Traits, typename Alloc, typename InputIterator>
00125 std::basic_string<Char, Traits, Alloc>
00126 join(const std::basic_string<Char, Traits, Alloc>& joiner, InputIterator first, InputIterator last);
00127 
00128 template <typename Char, typename Traits, typename Alloc, typename InputRange>
00129 std::basic_string<Char, Traits, Alloc>
00130 join_r(const std::basic_string<Char, Traits, Alloc>& joiner, const InputRange& range);
00131 
00132 template <typename Char, typename Traits, typename Alloc>
00133 std::basic_string<Char, Traits, Alloc>
00134 lstrip(const std::basic_string<Char, Traits, Alloc>& to_be_stripped,
00135        const std::basic_string<Char, Traits, Alloc>& to_be_removed);
00136 
00137 template <typename Char, typename Traits, typename Alloc>
00138 std::basic_string<Char, Traits, Alloc>
00139 lstrip(const std::basic_string<Char, Traits, Alloc>& to_be_stripped);
00140 
00141 template <typename Char, typename Traits, typename Alloc>
00142 std::basic_string<Char, Traits, Alloc>
00143 rstrip(const std::basic_string<Char, Traits, Alloc>& to_be_stripped,
00144        const std::basic_string<Char, Traits, Alloc>& to_be_removed);
00145 
00146 template <typename Char, typename Traits, typename Alloc>
00147 std::basic_string<Char, Traits, Alloc>
00148 rstrip(const std::basic_string<Char, Traits, Alloc>& to_be_stripped);
00149 
00150 template <typename Char, typename Traits, typename Alloc>
00151 std::basic_string<Char, Traits, Alloc>
00152 strip(const std::basic_string<Char, Traits, Alloc>& to_be_stripped,
00153       const std::basic_string<Char, Traits, Alloc>& to_be_removed);
00154 
00155 template <typename Char, typename Traits, typename Alloc>
00156 std::basic_string<Char, Traits, Alloc>
00157 strip(const std::basic_string<Char, Traits, Alloc>& to_be_stripped);
00158 
00159 }
00160 
00161 }
00162 
00163 #include "extended_string.inl"
00164 
00165 #endif
00166 
00167 // EOF

Generated on Mon Nov 10 14:20:04 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo