00001 // -*- C++ -*- 00002 00003 //========================================================================== 00004 /** 00005 * @file Functor_String.h 00006 * 00007 * $Id: Functor_String.h 86698 2009-09-13 15:58:17Z johnnyw $ 00008 * 00009 * Class template specializations for ACE_*String types implementing 00010 * function objects that are used in various places in ATC. They 00011 * could be placed in Functor.h. But we don't want to couple string 00012 * types to the rest of ACE+TAO. Hence they are placed in a seperate 00013 * file. 00014 */ 00015 //========================================================================== 00016 #ifndef ACE_FUNCTOR_STRING_H 00017 #define ACE_FUNCTOR_STRING_H 00018 #include /**/ "ace/pre.h" 00019 00020 #include /**/ "ace/config-all.h" 00021 00022 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00023 # pragma once 00024 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00025 00026 #include /**/ "ace/ACE_export.h" 00027 #include "ace/SStringfwd.h" 00028 00029 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00030 00031 //////////////////////////////////////////////////////////// 00032 // STL-style Functor Classes and Template Specializations // 00033 //////////////////////////////////////////////////////////// 00034 00035 // Forward declaration since we are going to specialize that template 00036 // here. The template itself requires this file so every user of the 00037 // template should also see the specialization. 00038 template <class TYPE> class ACE_Hash; 00039 template <class TYPE> class ACE_Equal_To; 00040 template <class TYPE> class ACE_Less_Than; 00041 00042 /** 00043 * @brief Function object for determining whether two ACE_CStrings are 00044 * equal. 00045 */ 00046 template<> 00047 class ACE_Export ACE_Equal_To<ACE_CString> 00048 { 00049 public: 00050 int operator () (const ACE_CString &lhs, 00051 const ACE_CString &rhs) const; 00052 }; 00053 00054 00055 /** 00056 * @brief Function object for hashing a ACE_CString 00057 */ 00058 template<> 00059 class ACE_Export ACE_Hash<ACE_CString> 00060 { 00061 public: 00062 /// Calls ACE::hash_pjw 00063 unsigned long operator () (const ACE_CString &lhs) const; 00064 }; 00065 00066 00067 /** 00068 * @brief Function object for determining whether the first const string 00069 * is less than the second const string. 00070 */ 00071 template<> 00072 class ACE_Export ACE_Less_Than<ACE_CString> 00073 { 00074 public: 00075 /// Simply calls ACE_OS::strcmp 00076 int operator () (const ACE_CString &lhs, 00077 const ACE_CString &rhs) const; 00078 }; 00079 00080 00081 #if defined (ACE_USES_WCHAR) 00082 00083 /** 00084 * @brief Function object for determining whether two ACE_WStrings are 00085 * equal. 00086 */ 00087 template<> 00088 class ACE_Export ACE_Equal_To<ACE_WString> 00089 { 00090 public: 00091 int operator () (const ACE_WString &lhs, 00092 const ACE_WString &rhs) const; 00093 }; 00094 00095 00096 /** 00097 * @brief Function object for hashing a ACE_WString 00098 */ 00099 template<> 00100 class ACE_Export ACE_Hash<ACE_WString> 00101 { 00102 public: 00103 /// Calls ACE::hash_pjw 00104 unsigned long operator () (const ACE_WString &lhs) const; 00105 }; 00106 00107 /** 00108 * @brief Function object for determining whether the first const wstring 00109 * is less than the second const wstring. 00110 */ 00111 template<> 00112 class ACE_Export ACE_Less_Than<ACE_WString> 00113 { 00114 public: 00115 /// Simply calls ACE_OS::strcmp 00116 int operator () (const ACE_WString &lhs, 00117 const ACE_WString &rhs) const; 00118 }; 00119 00120 #endif /*ACE_USES_WCHAR*/ 00121 00122 ACE_END_VERSIONED_NAMESPACE_DECL 00123 00124 #if defined (__ACE_INLINE__) 00125 #include "ace/Functor_String.inl" 00126 #endif /* __ACE_INLINE__ */ 00127 00128 #include /**/ "ace/post.h" 00129 #endif /*ACE_FUNCTOR_STRING_H*/