#include <Local_Name_Space.h>
| Public Member Functions | |
| ACE_NS_String (void) | |
| Default "no-op" constructor. | |
| ACE_NS_String (ACE_WCHAR_T *dst, const ACE_WCHAR_T *src, size_t len) | |
| Initialization method. | |
| ACE_NS_String (const ACE_NS_WString &) | |
| Converts an ACE_NS_WString to an ACE_NS_String;. | |
| ~ACE_NS_String (void) | |
| Destructor. | |
| operator ACE_NS_WString () const | |
| Converts an ACE_NS_String to fresh copy of an ACE_NS_WString;. | |
| char * | char_rep (void) const | 
| Return the ASCII character representation. | |
| int | strstr (const ACE_NS_String &) const | 
| Matches on substrings. | |
| bool | operator== (const ACE_NS_String &) const | 
| Compare an ACE_NS_String. | |
| bool | operator!= (const ACE_NS_String &) const | 
| Compare an ACE_NS_String. | |
| size_t | len (void) const | 
| Returns length of the string. | |
| ACE_WCHAR_T * | fast_rep (void) const | 
| Returns the underlying representation. | |
| u_long | hash (void) const | 
| Returns a hash value for this string. | |
| Private Attributes | |
| size_t | len_ | 
| Length of the string. | |
| ACE_WCHAR_T * | rep_ | 
| This actually points into shared/persistent memory. | |
| int | delete_rep_ | 
In order to work correctly, this class must be able to convert back and forth with .
Definition at line 39 of file Local_Name_Space.h.
| 
 | 
| Default "no-op" constructor. 
 Definition at line 50 of file Local_Name_Space.cpp. References ACE_TRACE. 
 00051 : len_ (0), 00052 rep_ (0), 00053 delete_rep_ (0) 00054 { 00055 ACE_TRACE ("ACE_NS_String::ACE_NS_String"); 00056 } | 
| 
 | ||||||||||||||||
| Initialization method. 
 Definition at line 116 of file Local_Name_Space.cpp. References ACE_TRACE, and ACE_OS::memcpy(). 
 00119 : len_ (bytes), 00120 rep_ (dst), 00121 delete_rep_ (0) 00122 { 00123 ACE_TRACE ("ACE_NS_String::ACE_NS_String"); 00124 ACE_OS::memcpy (this->rep_, src, bytes); 00125 } | 
| 
 | 
| Converts an ACE_NS_WString to an ACE_NS_String;. 
 Definition at line 58 of file Local_Name_Space.cpp. References ACE_TRACE, and ACE_WCHAR_T. 
 00059 : len_ ((s.length () + 1) * sizeof (ACE_WCHAR_T)), 00060 rep_ (s.rep ()), 00061 delete_rep_ (1) 00062 { 00063 ACE_TRACE ("ACE_NS_String::ACE_NS_String"); 00064 } | 
| 
 | 
| Destructor. 
 Definition at line 14 of file Local_Name_Space.cpp. References delete_rep_. 
 00015 {
00016   if (this->delete_rep_)
00017     delete [] this->rep_;
00018 }
 | 
| 
 | 
| Return the ASCII character representation. 
 Definition at line 42 of file Local_Name_Space.cpp. References ACE_TRACE, ACE_WCHAR_T, and ACE_NS_WString::char_rep(). 
 00043 {
00044   ACE_TRACE ("ACE_NS_String::char_rep");
00045   ACE_NS_WString w_string (this->rep_,
00046                            (this->len_ / sizeof (ACE_WCHAR_T)) - 1);
00047   return w_string.char_rep ();
00048 }
 | 
| 
 | 
| Returns the underlying representation. 
 Definition at line 21 of file Local_Name_Space.cpp. References ACE_TRACE. 
 | 
| 
 | 
| Returns a hash value for this string. 
 Definition at line 128 of file Local_Name_Space.cpp. References len_. 
 | 
| 
 | 
| Returns length of the string. 
 Definition at line 35 of file Local_Name_Space.cpp. References ACE_TRACE, and len_. 
 | 
| 
 | 
| Converts an ACE_NS_String to fresh copy of an ACE_NS_WString;. 
 Definition at line 27 of file Local_Name_Space.cpp. References ACE_NS_WString, ACE_TRACE, and ACE_WCHAR_T. 
 00028 {
00029   ACE_TRACE ("ACE_NS_String::operator ACE_NS_WString");
00030   return ACE_NS_WString (this->rep_,
00031                          (this->len_ / sizeof (ACE_WCHAR_T)) - 1);
00032 }
 | 
| 
 | 
| Compare an ACE_NS_String. 
 Definition at line 110 of file Local_Name_Space.cpp. References ACE_TRACE, and operator==(). 
 00111 {
00112   ACE_TRACE ("ACE_NS_String::operator !=");
00113   return !this->operator == (s);
00114 }
 | 
| 
 | 
| Compare an ACE_NS_String. 
 Definition at line 101 of file Local_Name_Space.cpp. References ACE_TRACE, len_, ACE_OS::memcmp(), and rep_. Referenced by operator!=(). 
 00102 {
00103   ACE_TRACE ("ACE_NS_String::operator ==");
00104   return this->len_ == s.len_
00105     && ACE_OS::memcmp ((void *) this->rep_,
00106                        (void *) s.rep_, this->len_) == 0;
00107 }
 | 
| 
 | 
| Matches on substrings. 
 Definition at line 67 of file Local_Name_Space.cpp. References ACE_TRACE, ACE_WCHAR_T, len_, and rep_. 
 00068 {
00069   ACE_TRACE ("ACE_NS_String::strstr");
00070 
00071   if (this->len_ < s.len_)
00072     // If they're larger than we are they can't be a substring of us!
00073     return -1;
00074   else if (this->len_ == s.len_)
00075     // Check if we're equal.
00076     return *this == s ? 0 : -1;
00077   else
00078     {
00079       // They're smaller than we are...
00080       const size_t len = (this->len_ - s.len_) / sizeof (ACE_WCHAR_T);
00081       const size_t pat_len = s.len_ / sizeof (ACE_WCHAR_T) - 1;
00082 
00083       for (size_t i = 0; i <= len; ++i)
00084         {
00085           size_t j;
00086 
00087           for (j = 0; j < pat_len; ++j)
00088             if (this->rep_[i + j] != s.rep_[j])
00089               break;
00090 
00091           if (j == pat_len)
00092             // Found a match!  Return the index.
00093             return ACE_Utils::truncate_cast<int> (i);
00094         }
00095 
00096       return -1;
00097     }
00098 }
 | 
| 
 | 
| Should rep_ be deleted when destructed (only used for WString conversions) Definition at line 90 of file Local_Name_Space.h. Referenced by ~ACE_NS_String(). | 
| 
 | 
| Length of the string. 
 Definition at line 83 of file Local_Name_Space.h. Referenced by hash(), len(), operator==(), and strstr(). | 
| 
 | 
| This actually points into shared/persistent memory. 
 Definition at line 86 of file Local_Name_Space.h. Referenced by operator==(), and strstr(). | 
 1.3.6
 
1.3.6