00001 // -*- C++ -*- 00002 // 00003 // String_Base.inl,v 4.9 2006/06/04 14:03:12 schmidt Exp 00004 00005 #include "ace/Malloc_Base.h" 00006 #include "ace/Min_Max.h" 00007 #include "ace/OS_NS_string.h" 00008 #include "ace/OS_Memory.h" 00009 00010 ACE_BEGIN_VERSIONED_NAMESPACE_DECL 00011 00012 template <class CHAR> ACE_INLINE void 00013 ACE_String_Base<CHAR>::dump (void) const 00014 { 00015 #if defined (ACE_HAS_DUMP) 00016 ACE_TRACE ("ACE_String_Base<CHAR>::dump"); 00017 #endif /* ACE_HAS_DUMP */ 00018 } 00019 00020 // Assignment method (does not copy memory) 00021 template <class CHAR> ACE_INLINE ACE_String_Base<CHAR> & 00022 ACE_String_Base<CHAR>::assign_nocopy (const ACE_String_Base<CHAR> &s) 00023 { 00024 ACE_TRACE ("ACE_String_Base<CHAR>::assign_nocopy"); 00025 this->set (s.rep_, s.len_, 0); 00026 return *this; 00027 } 00028 00029 template <class CHAR> ACE_INLINE size_t 00030 ACE_String_Base<CHAR>::length (void) const 00031 { 00032 ACE_TRACE ("ACE_String_Base<CHAR>::length"); 00033 return this->len_; 00034 } 00035 00036 template <class CHAR> ACE_INLINE bool 00037 ACE_String_Base<CHAR>::is_empty (void) const 00038 { 00039 return this->len_ == 0; 00040 } 00041 00042 template <class CHAR> ACE_INLINE bool 00043 ACE_String_Base<CHAR>::empty (void) const 00044 { 00045 return this->is_empty (); 00046 } 00047 00048 template <class CHAR> ACE_INLINE ACE_String_Base<CHAR> 00049 ACE_String_Base<CHAR>::substr (size_t offset, 00050 ssize_t length) const 00051 { 00052 ACE_TRACE ("ACE_String_Base<CHAR>::substr"); 00053 return this->substring (offset, length); 00054 } 00055 00056 // Return the <slot'th> character in the string. 00057 00058 template <class CHAR> ACE_INLINE const CHAR & 00059 ACE_String_Base<CHAR>::operator[] (size_t slot) const 00060 { 00061 ACE_TRACE ("ACE_String_Base<CHAR>::operator[]"); 00062 return this->rep_[slot]; 00063 } 00064 00065 // Return the <slot'th> character in the string by reference. 00066 00067 template <class CHAR> ACE_INLINE CHAR & 00068 ACE_String_Base<CHAR>::operator[] (size_t slot) 00069 { 00070 ACE_TRACE ("ACE_String_Base<CHAR>::operator[]"); 00071 return this->rep_[slot]; 00072 } 00073 00074 template <class CHAR> ACE_INLINE const CHAR * 00075 ACE_String_Base<CHAR>::fast_rep (void) const 00076 { 00077 return this->rep_; 00078 } 00079 00080 template <class CHAR> ACE_INLINE const CHAR * 00081 ACE_String_Base<CHAR>::c_str (void) const 00082 { 00083 return this->rep_; 00084 } 00085 00086 // Less than comparison operator. 00087 00088 template <class CHAR> ACE_INLINE bool 00089 ACE_String_Base<CHAR>::operator < (const ACE_String_Base<CHAR> &s) const 00090 { 00091 ACE_TRACE ("ACE_String_Base<CHAR>::operator <"); 00092 return compare (s) < 0; 00093 } 00094 00095 // Greater than comparison operator. 00096 00097 template <class CHAR> ACE_INLINE bool 00098 ACE_String_Base<CHAR>::operator > (const ACE_String_Base &s) const 00099 { 00100 ACE_TRACE ("ACE_String_Base<CHAR>::operator >"); 00101 return compare (s) > 0; 00102 } 00103 00104 00105 // Comparison operator. 00106 00107 template <class CHAR> ACE_INLINE bool 00108 ACE_String_Base<CHAR>::operator!= (const ACE_String_Base<CHAR> &s) const 00109 { 00110 ACE_TRACE ("ACE_String_Base<CHAR>::operator!="); 00111 return !(*this == s); 00112 } 00113 00114 template <class CHAR> ACE_INLINE bool 00115 ACE_String_Base<CHAR>::operator!= (const CHAR *s) const 00116 { 00117 return !(*this == s); 00118 } 00119 00120 template <class CHAR> ACE_INLINE ssize_t 00121 ACE_String_Base<CHAR>::find (const ACE_String_Base<CHAR>&str, size_t pos) const 00122 { 00123 ACE_TRACE ("ACE_String_Base<CHAR>::find"); 00124 return this->find (str.rep_, pos); 00125 } 00126 00127 template <class CHAR> ACE_INLINE ssize_t 00128 ACE_String_Base<CHAR>::strstr (const ACE_String_Base<CHAR> &s) const 00129 { 00130 ACE_TRACE ("ACE_String_Base<CHAR>::strstr"); 00131 return this->find (s.rep_); 00132 } 00133 00134 template <class CHAR> ACE_INLINE bool 00135 operator== (const CHAR *s, 00136 const ACE_String_Base<CHAR> &t) 00137 { 00138 return t == s; 00139 } 00140 00141 template <class CHAR> ACE_INLINE bool 00142 operator!= (const CHAR *s, 00143 const ACE_String_Base<CHAR> &t) 00144 { 00145 return !(t == s); 00146 } 00147 00148 ACE_END_VERSIONED_NAMESPACE_DECL