String_Base.inl

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // $Id: String_Base.inl 80826 2008-03-04 14:51:23Z wotte $
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_, false);
00026   return *this;
00027 }
00028 
00029 template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type
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 size_t
00037 ACE_String_Base<CHAR>::capacity (void) const
00038 {
00039   ACE_TRACE ("ACE_String_Base<CHAR>::capacity");
00040   return this->buf_len_;
00041 }
00042 
00043 template <class CHAR> ACE_INLINE bool
00044 ACE_String_Base<CHAR>::is_empty (void) const
00045 {
00046   return this->len_ == 0;
00047 }
00048 
00049 template <class CHAR> ACE_INLINE bool
00050 ACE_String_Base<CHAR>::empty (void) const
00051 {
00052   return this->is_empty ();
00053 }
00054 
00055 template <class CHAR> ACE_INLINE ACE_String_Base<CHAR>
00056 ACE_String_Base<CHAR>::substr (
00057   typename ACE_String_Base<CHAR>::size_type offset,
00058   typename ACE_String_Base<CHAR>::size_type length) const
00059 {
00060   ACE_TRACE ("ACE_String_Base<CHAR>::substr");
00061   return this->substring (offset, length);
00062 }
00063 
00064 // Return the <slot'th> character in the string.
00065 
00066 template <class CHAR> ACE_INLINE const CHAR &
00067 ACE_String_Base<CHAR>::operator[] (
00068   typename ACE_String_Base<CHAR>::size_type slot) const
00069 {
00070   ACE_TRACE ("ACE_String_Base<CHAR>::operator[]");
00071   return this->rep_[slot];
00072 }
00073 
00074 // Return the <slot'th> character in the string by reference.
00075 
00076 template <class CHAR> ACE_INLINE CHAR &
00077 ACE_String_Base<CHAR>::operator[] (
00078   typename ACE_String_Base<CHAR>::size_type slot)
00079 {
00080   ACE_TRACE ("ACE_String_Base<CHAR>::operator[]");
00081   return this->rep_[slot];
00082 }
00083 
00084 template <class CHAR> ACE_INLINE const CHAR *
00085 ACE_String_Base<CHAR>::fast_rep (void) const
00086 {
00087   return this->rep_;
00088 }
00089 
00090 template <class CHAR> ACE_INLINE const CHAR *
00091 ACE_String_Base<CHAR>::c_str (void) const
00092 {
00093   return this->rep_;
00094 }
00095 
00096 // Less than comparison operator.
00097 
00098 template <class CHAR> ACE_INLINE bool
00099 ACE_String_Base<CHAR>::operator < (const ACE_String_Base<CHAR> &s) const
00100 {
00101   ACE_TRACE ("ACE_String_Base<CHAR>::operator <");
00102   return compare (s) < 0;
00103 }
00104 
00105 // Greater than comparison operator.
00106 
00107 template <class CHAR> ACE_INLINE bool
00108 ACE_String_Base<CHAR>::operator > (const ACE_String_Base &s) const
00109 {
00110   ACE_TRACE ("ACE_String_Base<CHAR>::operator >");
00111   return compare (s) > 0;
00112 }
00113 
00114 
00115 // Comparison operator.
00116 
00117 template <class CHAR> ACE_INLINE bool
00118 ACE_String_Base<CHAR>::operator!= (const ACE_String_Base<CHAR> &s) const
00119 {
00120   ACE_TRACE ("ACE_String_Base<CHAR>::operator!=");
00121   return !(*this == s);
00122 }
00123 
00124 template <class CHAR> ACE_INLINE bool
00125 ACE_String_Base<CHAR>::operator!= (const CHAR *s) const
00126 {
00127   return !(*this == s);
00128 }
00129 
00130 template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type
00131 ACE_String_Base<CHAR>::find (const ACE_String_Base<CHAR>&str,
00132                              typename ACE_String_Base<CHAR>::size_type pos) const
00133 {
00134   ACE_TRACE ("ACE_String_Base<CHAR>::find");
00135   return this->find (str.rep_, pos);
00136 }
00137 
00138 template <class CHAR> ACE_INLINE typename ACE_String_Base<CHAR>::size_type
00139 ACE_String_Base<CHAR>::strstr (const ACE_String_Base<CHAR> &s) const
00140 {
00141   ACE_TRACE ("ACE_String_Base<CHAR>::strstr");
00142   return this->find (s.rep_);
00143 }
00144 
00145 template <class CHAR> ACE_INLINE bool
00146 operator== (const CHAR *s,
00147             const ACE_String_Base<CHAR> &t)
00148 {
00149   return t == s;
00150 }
00151 
00152 template <class CHAR> ACE_INLINE bool
00153 operator!= (const CHAR *s,
00154             const ACE_String_Base<CHAR> &t)
00155 {
00156   return !(t == s);
00157 }
00158 
00159 ACE_END_VERSIONED_NAMESPACE_DECL

Generated on Tue Feb 2 17:18:43 2010 for ACE by  doxygen 1.4.7