| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | //  Boost string_algo library case_conv.hpp header file  ---------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-07-27 10:27:37 +00:00
										 |  |  | //  Copyright Pavol Droba 2002-2003.
 | 
					
						
							|  |  |  | //
 | 
					
						
							|  |  |  | // Distributed under the Boost Software License, Version 1.0.
 | 
					
						
							|  |  |  | //    (See accompanying file LICENSE_1_0.txt or copy at
 | 
					
						
							|  |  |  | //          http://www.boost.org/LICENSE_1_0.txt)
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-07-27 10:27:37 +00:00
										 |  |  | //  See http://www.boost.org/ for updates, documentation, and revision history.
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef BOOST_STRING_CASE_CONV_HPP
 | 
					
						
							|  |  |  | #define BOOST_STRING_CASE_CONV_HPP
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <boost/algorithm/string/config.hpp>
 | 
					
						
							|  |  |  | #include <algorithm>
 | 
					
						
							|  |  |  | #include <locale>
 | 
					
						
							|  |  |  | #include <boost/iterator/transform_iterator.hpp>
 | 
					
						
							| 
									
										
										
										
											2005-01-21 16:45:29 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-01 13:12:57 +00:00
										 |  |  | #include <boost/range/as_literal.hpp>
 | 
					
						
							| 
									
										
										
										
											2005-01-21 16:45:29 +00:00
										 |  |  | #include <boost/range/begin.hpp>
 | 
					
						
							|  |  |  | #include <boost/range/end.hpp>
 | 
					
						
							|  |  |  | #include <boost/range/value_type.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | #include <boost/algorithm/string/detail/case_conv.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*! \file
 | 
					
						
							|  |  |  |     Defines sequence case-conversion algorithms. | 
					
						
							|  |  |  |     Algorithms convert each element in the input sequence to the | 
					
						
							|  |  |  |     desired case using provided locales. | 
					
						
							|  |  |  | */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace boost { | 
					
						
							|  |  |  |     namespace algorithm { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //  to_lower  -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //! Convert to lower case
 | 
					
						
							|  |  |  |         /*!
 | 
					
						
							|  |  |  |             Each element of the input sequence is converted to lower | 
					
						
							| 
									
										
										
										
											2004-07-06 21:28:01 +00:00
										 |  |  |             case. The result is a copy of the input converted to lower case. | 
					
						
							| 
									
										
										
										
											2004-07-15 21:48:25 +00:00
										 |  |  |             It is returned as a sequence or copied to the output iterator. | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-15 21:48:25 +00:00
										 |  |  |             \param Output An output iterator to which the result will be copied | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |             \param Input An input range | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             \param Loc A locale used for conversion | 
					
						
							| 
									
										
										
										
											2004-07-06 21:28:01 +00:00
										 |  |  |             \return  | 
					
						
							| 
									
										
										
										
											2004-07-15 21:48:25 +00:00
										 |  |  |                 An output iterator pointing just after the last inserted character or | 
					
						
							| 
									
										
										
										
											2004-07-11 22:07:00 +00:00
										 |  |  |                 a copy of the input | 
					
						
							| 
									
										
										
										
											2004-07-14 21:28:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-15 21:48:25 +00:00
										 |  |  |             \note The second variant of this function provides the strong exception-safety guarantee | 
					
						
							|  |  |  |                  | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         */ | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |         template<typename OutputIteratorT, typename RangeT> | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         inline OutputIteratorT  | 
					
						
							|  |  |  |         to_lower_copy( | 
					
						
							|  |  |  |             OutputIteratorT Output, | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |             const RangeT& Input, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             const std::locale& Loc=std::locale()) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2007-07-01 13:12:57 +00:00
										 |  |  |             return ::boost::algorithm::detail::transform_range_copy(  | 
					
						
							|  |  |  |                Output, | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                ::boost::as_literal(Input), | 
					
						
							| 
									
										
										
										
											2007-07-01 13:12:57 +00:00
										 |  |  |                ::boost::algorithm::detail::to_lowerF< | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |                     typename range_value<RangeT>::type >(Loc)); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //! Convert to lower case
 | 
					
						
							|  |  |  |         /*!
 | 
					
						
							| 
									
										
										
										
											2004-07-11 22:07:00 +00:00
										 |  |  |             \overload | 
					
						
							|  |  |  |         */ | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         template<typename SequenceT> | 
					
						
							|  |  |  |         inline SequenceT to_lower_copy(  | 
					
						
							|  |  |  |             const SequenceT& Input,  | 
					
						
							|  |  |  |             const std::locale& Loc=std::locale()) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2007-07-01 22:23:55 +00:00
										 |  |  |             return ::boost::algorithm::detail::transform_range_copy<SequenceT>( | 
					
						
							|  |  |  |                 Input, | 
					
						
							| 
									
										
										
										
											2007-07-01 13:12:57 +00:00
										 |  |  |                 ::boost::algorithm::detail::to_lowerF< | 
					
						
							| 
									
										
										
										
											2007-07-01 22:23:55 +00:00
										 |  |  |                     typename range_value<SequenceT>::type >(Loc)); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //! Convert to lower case
 | 
					
						
							|  |  |  |         /*!
 | 
					
						
							|  |  |  |             Each element of the input sequence is converted to lower | 
					
						
							|  |  |  |             case. The input sequence is modified in-place. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |             \param Input A range | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             \param Loc a locale used for conversion | 
					
						
							|  |  |  |         */ | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |         template<typename WritableRangeT> | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         inline void to_lower(  | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |             WritableRangeT& Input,  | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             const std::locale& Loc=std::locale()) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2007-07-01 22:23:55 +00:00
										 |  |  |             ::boost::algorithm::detail::transform_range( | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                 ::boost::as_literal(Input), | 
					
						
							| 
									
										
										
										
											2005-06-06 20:03:18 +00:00
										 |  |  |                 ::boost::algorithm::detail::to_lowerF< | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |                     typename range_value<WritableRangeT>::type >(Loc)); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         } | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  | //  to_upper  -----------------------------------------------//
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //! Convert to upper case
 | 
					
						
							|  |  |  |         /*!
 | 
					
						
							|  |  |  |             Each element of the input sequence is converted to upper | 
					
						
							| 
									
										
										
										
											2004-07-06 21:28:01 +00:00
										 |  |  |             case. The result is a copy of the input converted to upper case. | 
					
						
							| 
									
										
										
										
											2004-07-15 21:48:25 +00:00
										 |  |  |             It is returned as a sequence or copied to the output iterator | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-15 21:48:25 +00:00
										 |  |  |             \param Output An output iterator to which the result will be copied | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |             \param Input An input range | 
					
						
							| 
									
										
										
										
											2004-07-06 21:28:01 +00:00
										 |  |  |             \param Loc A locale used for conversion | 
					
						
							|  |  |  |             \return  | 
					
						
							| 
									
										
										
										
											2004-07-15 21:48:25 +00:00
										 |  |  |                 An output iterator pointing just after the last inserted character or | 
					
						
							| 
									
										
										
										
											2004-07-11 22:07:00 +00:00
										 |  |  |                 a copy of the input | 
					
						
							| 
									
										
										
										
											2004-07-14 21:28:31 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-16 09:06:39 +00:00
										 |  |  |             \note The second variant of this function provides the strong exception-safety guarantee | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         */ | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |         template<typename OutputIteratorT, typename RangeT> | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         inline OutputIteratorT  | 
					
						
							|  |  |  |         to_upper_copy( | 
					
						
							|  |  |  |             OutputIteratorT Output, | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |             const RangeT& Input, | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             const std::locale& Loc=std::locale()) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2007-07-01 13:12:57 +00:00
										 |  |  |             return ::boost::algorithm::detail::transform_range_copy(  | 
					
						
							|  |  |  |                Output, | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                ::boost::as_literal(Input), | 
					
						
							| 
									
										
										
										
											2007-07-01 13:12:57 +00:00
										 |  |  |                ::boost::algorithm::detail::to_upperF< | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |                     typename range_value<RangeT>::type >(Loc)); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //! Convert to upper case
 | 
					
						
							|  |  |  |         /*!
 | 
					
						
							| 
									
										
										
										
											2004-07-11 22:07:00 +00:00
										 |  |  |             \overload | 
					
						
							|  |  |  |         */ | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         template<typename SequenceT> | 
					
						
							|  |  |  |         inline SequenceT to_upper_copy(  | 
					
						
							|  |  |  |             const SequenceT& Input,  | 
					
						
							|  |  |  |             const std::locale& Loc=std::locale()) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2007-07-01 22:23:55 +00:00
										 |  |  |             return ::boost::algorithm::detail::transform_range_copy<SequenceT>( | 
					
						
							|  |  |  |                 Input, | 
					
						
							| 
									
										
										
										
											2007-07-01 13:12:57 +00:00
										 |  |  |                 ::boost::algorithm::detail::to_upperF< | 
					
						
							| 
									
										
										
										
											2007-07-01 22:23:55 +00:00
										 |  |  |                     typename range_value<SequenceT>::type >(Loc)); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         //! Convert to upper case
 | 
					
						
							|  |  |  |         /*!
 | 
					
						
							|  |  |  |             Each element of the input sequence is converted to upper | 
					
						
							|  |  |  |             case. The input sequence is modified in-place. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |             \param Input An input range | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             \param Loc a locale used for conversion | 
					
						
							|  |  |  |         */ | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |         template<typename WritableRangeT> | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         inline void to_upper(  | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |             WritableRangeT& Input,  | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             const std::locale& Loc=std::locale()) | 
					
						
							|  |  |  |         { | 
					
						
							| 
									
										
										
										
											2007-07-01 22:23:55 +00:00
										 |  |  |             ::boost::algorithm::detail::transform_range( | 
					
						
							| 
									
										
										
										
											2009-08-05 20:01:10 +00:00
										 |  |  |                 ::boost::as_literal(Input), | 
					
						
							| 
									
										
										
										
											2005-06-06 20:03:18 +00:00
										 |  |  |                 ::boost::algorithm::detail::to_upperF< | 
					
						
							| 
									
										
										
										
											2005-04-12 16:50:42 +00:00
										 |  |  |                     typename range_value<WritableRangeT>::type >(Loc)); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     } // namespace algorithm
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     // pull names to the boost namespace
 | 
					
						
							|  |  |  |     using algorithm::to_lower; | 
					
						
							|  |  |  |     using algorithm::to_lower_copy; | 
					
						
							|  |  |  |     using algorithm::to_upper; | 
					
						
							|  |  |  |     using algorithm::to_upper_copy; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } // namespace boost
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif  // BOOST_STRING_CASE_CONV_HPP
 |