| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | //  Boost string_algo library classification.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_CLASSIFICATION_DETAIL_HPP
 | 
					
						
							|  |  |  | #define BOOST_STRING_CLASSIFICATION_DETAIL_HPP
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <boost/algorithm/string/config.hpp>
 | 
					
						
							|  |  |  | #include <algorithm>
 | 
					
						
							|  |  |  | #include <functional>
 | 
					
						
							|  |  |  | #include <locale>
 | 
					
						
							| 
									
										
										
										
											2005-01-21 16:45:29 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include <boost/range/begin.hpp>
 | 
					
						
							|  |  |  | #include <boost/range/end.hpp>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-07-06 19:52:18 +00:00
										 |  |  | #include <boost/algorithm/string/predicate_facade.hpp>
 | 
					
						
							| 
									
										
										
										
											2004-03-07 17:27:06 +00:00
										 |  |  | #include <boost/type_traits/remove_const.hpp>
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | namespace boost { | 
					
						
							|  |  |  |     namespace algorithm { | 
					
						
							|  |  |  |         namespace detail { | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | //  classification functors -----------------------------------------------//
 | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-18 18:32:51 +00:00
										 |  |  |    // is_classified functor
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             struct is_classifiedF : | 
					
						
							|  |  |  |                 public predicate_facade<is_classifiedF> | 
					
						
							|  |  |  |             { | 
					
						
							| 
									
										
										
										
											2010-06-09 20:16:21 +00:00
										 |  |  |                 // Boost.ResultOf support
 | 
					
						
							|  |  |  |                 typedef bool result_type; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |                 // Constructor from a locale
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 is_classifiedF(std::ctype_base::mask Type, std::locale const & Loc = std::locale()) : | 
					
						
							|  |  |  |                     m_Type(Type), m_Locale(Loc) {} | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template<typename CharT> | 
					
						
							|  |  |  |                 bool operator()( CharT Ch ) const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     return std::use_facet< std::ctype<CharT> >(m_Locale).is( m_Type, Ch ); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-04-16 09:46:34 +00:00
										 |  |  |                 #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x582) && !defined(_USE_OLD_RW_STL)
 | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |                     template<> | 
					
						
							|  |  |  |                     bool operator()( char const Ch ) const | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         return std::use_facet< std::ctype<char> >(m_Locale).is( m_Type, Ch ); | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                 #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             private: | 
					
						
							| 
									
										
										
										
											2008-08-18 18:32:51 +00:00
										 |  |  |                 std::ctype_base::mask m_Type; | 
					
						
							|  |  |  |                 std::locale m_Locale; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-17 21:21:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |             // is_any_of functor
 | 
					
						
							|  |  |  |             /*
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 returns true if the value is from the specified set | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             template<typename CharT> | 
					
						
							|  |  |  |             struct is_any_ofF : | 
					
						
							|  |  |  |                 public predicate_facade<is_any_ofF<CharT> > | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |             { | 
					
						
							|  |  |  |             private: | 
					
						
							|  |  |  |                 // set cannot operate on const value-type
 | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                 typedef typename ::boost::remove_const<CharT>::type set_value_type; | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             public:      | 
					
						
							| 
									
										
										
										
											2010-06-09 20:16:21 +00:00
										 |  |  |                 // Boost.ResultOf support
 | 
					
						
							|  |  |  |                 typedef bool result_type; | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 // Constructor
 | 
					
						
							|  |  |  |                 template<typename RangeT> | 
					
						
							|  |  |  |                 is_any_ofF( const RangeT& Range ) : m_Size(0) | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     // Prepare storage
 | 
					
						
							|  |  |  |                     m_Storage.m_dynSet=0; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     std::size_t Size=::boost::distance(Range); | 
					
						
							|  |  |  |                     m_Size=Size; | 
					
						
							|  |  |  |                     set_value_type* Storage=0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                     if(use_fixed_storage(m_Size)) | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                     { | 
					
						
							|  |  |  |                         // Use fixed storage
 | 
					
						
							|  |  |  |                         Storage=&m_Storage.m_fixSet[0]; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         // Use dynamic storage
 | 
					
						
							|  |  |  |                         m_Storage.m_dynSet=new set_value_type[m_Size]; | 
					
						
							|  |  |  |                         Storage=m_Storage.m_dynSet; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // Use fixed storage
 | 
					
						
							|  |  |  |                     ::std::copy(::boost::begin(Range), ::boost::end(Range), Storage); | 
					
						
							|  |  |  |                     ::std::sort(Storage, Storage+m_Size); | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Copy constructor
 | 
					
						
							|  |  |  |                 is_any_ofF(const is_any_ofF& Other) : m_Size(Other.m_Size) | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     // Prepare storage
 | 
					
						
							|  |  |  |                     m_Storage.m_dynSet=0;                | 
					
						
							|  |  |  |                     const set_value_type* SrcStorage=0; | 
					
						
							|  |  |  |                     set_value_type* DestStorage=0; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                     if(use_fixed_storage(m_Size)) | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                     { | 
					
						
							|  |  |  |                         // Use fixed storage
 | 
					
						
							|  |  |  |                         DestStorage=&m_Storage.m_fixSet[0]; | 
					
						
							|  |  |  |                         SrcStorage=&Other.m_Storage.m_fixSet[0]; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                     { | 
					
						
							|  |  |  |                         // Use dynamic storage
 | 
					
						
							|  |  |  |                         m_Storage.m_dynSet=new set_value_type[m_Size]; | 
					
						
							|  |  |  |                         DestStorage=m_Storage.m_dynSet; | 
					
						
							|  |  |  |                         SrcStorage=Other.m_Storage.m_dynSet; | 
					
						
							|  |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     // Use fixed storage
 | 
					
						
							| 
									
										
										
										
											2012-01-01 13:35:27 +00:00
										 |  |  |                     ::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Destructor
 | 
					
						
							|  |  |  |                 ~is_any_ofF() | 
					
						
							|  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                     if(!use_fixed_storage(m_Size) && m_Storage.m_dynSet!=0) | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                     { | 
					
						
							| 
									
										
										
										
											2008-08-18 18:32:51 +00:00
										 |  |  |                         delete [] m_Storage.m_dynSet; | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Assignment
 | 
					
						
							|  |  |  |                 is_any_ofF& operator=(const is_any_ofF& Other) | 
					
						
							|  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2008-08-21 14:46:15 +00:00
										 |  |  |                     // Handle self assignment
 | 
					
						
							|  |  |  |                     if(this==&Other) return *this; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-18 18:32:51 +00:00
										 |  |  |                     // Prepare storage             
 | 
					
						
							| 
									
										
										
										
											2008-08-21 14:46:15 +00:00
										 |  |  |                     const set_value_type* SrcStorage; | 
					
						
							|  |  |  |                     set_value_type* DestStorage; | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                     if(use_fixed_storage(Other.m_Size)) | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                     { | 
					
						
							|  |  |  |                         // Use fixed storage
 | 
					
						
							|  |  |  |                         DestStorage=&m_Storage.m_fixSet[0]; | 
					
						
							|  |  |  |                         SrcStorage=&Other.m_Storage.m_fixSet[0]; | 
					
						
							| 
									
										
										
										
											2008-08-18 18:32:51 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                         // Delete old storage if was present
 | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                         if(!use_fixed_storage(m_Size) && m_Storage.m_dynSet!=0) | 
					
						
							| 
									
										
										
										
											2008-08-18 18:32:51 +00:00
										 |  |  |                         { | 
					
						
							|  |  |  |                             delete [] m_Storage.m_dynSet; | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                         // Set new size
 | 
					
						
							|  |  |  |                         m_Size=Other.m_Size; | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  |                     else | 
					
						
							|  |  |  |                     { | 
					
						
							| 
									
										
										
										
											2008-08-21 14:46:15 +00:00
										 |  |  |                         // Other uses dynamic storage
 | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                         SrcStorage=Other.m_Storage.m_dynSet; | 
					
						
							| 
									
										
										
										
											2008-08-21 14:46:15 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                         // Check what kind of storage are we using right now
 | 
					
						
							|  |  |  |                         if(use_fixed_storage(m_Size)) | 
					
						
							| 
									
										
										
										
											2008-08-18 18:32:51 +00:00
										 |  |  |                         { | 
					
						
							| 
									
										
										
										
											2009-05-20 19:19:00 +00:00
										 |  |  |                             // Using fixed storage, allocate new
 | 
					
						
							| 
									
										
										
										
											2008-08-21 14:46:15 +00:00
										 |  |  |                             set_value_type* pTemp=new set_value_type[Other.m_Size]; | 
					
						
							|  |  |  |                             DestStorage=pTemp; | 
					
						
							|  |  |  |                             m_Storage.m_dynSet=pTemp; | 
					
						
							|  |  |  |                             m_Size=Other.m_Size; | 
					
						
							|  |  |  |                         } | 
					
						
							|  |  |  |                         else | 
					
						
							|  |  |  |                         { | 
					
						
							|  |  |  |                             // Using dynamic storage, check if can reuse
 | 
					
						
							|  |  |  |                             if(m_Storage.m_dynSet!=0 && m_Size>=Other.m_Size && m_Size<Other.m_Size*2) | 
					
						
							|  |  |  |                             { | 
					
						
							|  |  |  |                                 // Reuse the current storage
 | 
					
						
							|  |  |  |                                 DestStorage=m_Storage.m_dynSet; | 
					
						
							|  |  |  |                                 m_Size=Other.m_Size; | 
					
						
							|  |  |  |                             } | 
					
						
							|  |  |  |                             else | 
					
						
							|  |  |  |                             { | 
					
						
							|  |  |  |                                 // Allocate the new one
 | 
					
						
							|  |  |  |                                 set_value_type* pTemp=new set_value_type[Other.m_Size]; | 
					
						
							|  |  |  |                                 DestStorage=pTemp; | 
					
						
							|  |  |  |                          | 
					
						
							|  |  |  |                                 // Delete old storage if necessary
 | 
					
						
							|  |  |  |                                 if(m_Storage.m_dynSet!=0) | 
					
						
							|  |  |  |                                 { | 
					
						
							|  |  |  |                                     delete [] m_Storage.m_dynSet; | 
					
						
							|  |  |  |                                 } | 
					
						
							|  |  |  |                                 // Store the new storage
 | 
					
						
							|  |  |  |                                 m_Storage.m_dynSet=pTemp; | 
					
						
							|  |  |  |                                 // Set new size
 | 
					
						
							|  |  |  |                                 m_Size=Other.m_Size; | 
					
						
							|  |  |  |                             } | 
					
						
							| 
									
										
										
										
											2008-08-18 18:32:51 +00:00
										 |  |  |                         } | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                     // Copy the data
 | 
					
						
							| 
									
										
										
										
											2012-01-01 13:35:27 +00:00
										 |  |  |                     ::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                     return *this; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template<typename Char2T> | 
					
						
							|  |  |  |                 bool operator()( Char2T Ch ) const | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     const set_value_type* Storage= | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                         (use_fixed_storage(m_Size)) | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                         ? &m_Storage.m_fixSet[0] | 
					
						
							|  |  |  |                         : m_Storage.m_dynSet; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                     return ::std::binary_search(Storage, Storage+m_Size, Ch); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |             private: | 
					
						
							|  |  |  |                 // check if the size is eligible for fixed storage
 | 
					
						
							|  |  |  |                 static bool use_fixed_storage(std::size_t size) | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     return size<=sizeof(set_value_type*)*2; | 
					
						
							|  |  |  |                 } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |             private: | 
					
						
							|  |  |  |                 // storage
 | 
					
						
							|  |  |  |                 // The actual used storage is selected on the type
 | 
					
						
							|  |  |  |                 union | 
					
						
							|  |  |  |                 { | 
					
						
							|  |  |  |                     set_value_type* m_dynSet; | 
					
						
							| 
									
										
										
										
											2008-08-19 14:32:59 +00:00
										 |  |  |                     set_value_type m_fixSet[sizeof(set_value_type*)*2]; | 
					
						
							| 
									
										
										
										
											2008-06-18 21:54:06 +00:00
										 |  |  |                 }  | 
					
						
							|  |  |  |                 m_Storage; | 
					
						
							|  |  |  |          | 
					
						
							|  |  |  |                 // storage size
 | 
					
						
							|  |  |  |                 ::std::size_t m_Size; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |             // is_from_range functor
 | 
					
						
							|  |  |  |             /*
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 returns true if the value is from the specified range. | 
					
						
							|  |  |  |                 (i.e. x>=From && x>=To) | 
					
						
							|  |  |  |             */ | 
					
						
							|  |  |  |             template<typename CharT> | 
					
						
							|  |  |  |             struct is_from_rangeF : | 
					
						
							|  |  |  |                 public predicate_facade< is_from_rangeF<CharT> > | 
					
						
							|  |  |  |             { | 
					
						
							| 
									
										
										
										
											2010-06-09 20:16:21 +00:00
										 |  |  |                 // Boost.ResultOf support
 | 
					
						
							|  |  |  |                 typedef bool result_type; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |                 // Constructor
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 is_from_rangeF( CharT From, CharT To ) : m_From(From), m_To(To) {} | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template<typename Char2T> | 
					
						
							|  |  |  |                 bool operator()( Char2T Ch ) const | 
					
						
							|  |  |  |                 { | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |                     return ( m_From <= Ch ) && ( Ch <= m_To ); | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 } | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             private: | 
					
						
							|  |  |  |                 CharT m_From; | 
					
						
							|  |  |  |                 CharT m_To; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // class_and composition predicate
 | 
					
						
							|  |  |  |             template<typename Pred1T, typename Pred2T> | 
					
						
							|  |  |  |             struct pred_andF : | 
					
						
							|  |  |  |                 public predicate_facade< pred_andF<Pred1T,Pred2T> > | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |             public: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-06-09 20:16:21 +00:00
										 |  |  |                 // Boost.ResultOf support
 | 
					
						
							|  |  |  |                 typedef bool result_type; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 // Constructor
 | 
					
						
							|  |  |  |                 pred_andF( Pred1T Pred1, Pred2T Pred2 ) : | 
					
						
							|  |  |  |                     m_Pred1(Pred1), m_Pred2(Pred2) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template<typename CharT> | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |                 bool operator()( CharT Ch ) const | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 { | 
					
						
							|  |  |  |                     return m_Pred1(Ch) && m_Pred2(Ch); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             private: | 
					
						
							|  |  |  |                 Pred1T m_Pred1; | 
					
						
							|  |  |  |                 Pred2T m_Pred2; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // class_or composition predicate
 | 
					
						
							|  |  |  |             template<typename Pred1T, typename Pred2T> | 
					
						
							|  |  |  |             struct pred_orF : | 
					
						
							|  |  |  |                 public predicate_facade< pred_orF<Pred1T,Pred2T> > | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |             public: | 
					
						
							| 
									
										
										
										
											2010-06-09 20:16:21 +00:00
										 |  |  |                 // Boost.ResultOf support
 | 
					
						
							|  |  |  |                 typedef bool result_type; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 // Constructor
 | 
					
						
							|  |  |  |                 pred_orF( Pred1T Pred1, Pred2T Pred2 ) : | 
					
						
							|  |  |  |                     m_Pred1(Pred1), m_Pred2(Pred2) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template<typename CharT> | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |                 bool operator()( CharT Ch ) const | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 { | 
					
						
							|  |  |  |                     return m_Pred1(Ch) || m_Pred2(Ch); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             private: | 
					
						
							|  |  |  |                 Pred1T m_Pred1; | 
					
						
							|  |  |  |                 Pred2T m_Pred2; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |             // class_not composition predicate
 | 
					
						
							|  |  |  |             template< typename PredT > | 
					
						
							|  |  |  |             struct pred_notF : | 
					
						
							|  |  |  |                 public predicate_facade< pred_notF<PredT> > | 
					
						
							|  |  |  |             { | 
					
						
							|  |  |  |             public: | 
					
						
							| 
									
										
										
										
											2010-06-09 20:16:21 +00:00
										 |  |  |                 // Boost.ResultOf support
 | 
					
						
							|  |  |  |                 typedef bool result_type; | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |                 // Constructor
 | 
					
						
							|  |  |  |                 pred_notF( PredT Pred ) : m_Pred(Pred) {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |                 // Operation
 | 
					
						
							|  |  |  |                 template<typename CharT> | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  |                 bool operator()( CharT Ch ) const | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |                 { | 
					
						
							|  |  |  |                     return !m_Pred(Ch); | 
					
						
							|  |  |  |                 } | 
					
						
							| 
									
										
										
										
											2005-05-11 09:17:14 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-03-04 22:12:19 +00:00
										 |  |  |             private: | 
					
						
							|  |  |  |                 PredT m_Pred; | 
					
						
							|  |  |  |             }; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |         } // namespace detail
 | 
					
						
							|  |  |  |     } // namespace algorithm
 | 
					
						
							|  |  |  | } // namespace boost
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #endif  // BOOST_STRING_CLASSIFICATION_DETAIL_HPP
 |