#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 49 of file Local_Name_Space.cpp. References ACE_TRACE.
00050 : len_ (0), 00051 rep_ (0), 00052 delete_rep_ (0) 00053 { 00054 ACE_TRACE ("ACE_NS_String::ACE_NS_String"); 00055 } |
|
||||||||||||||||
|
Initialization method.
Definition at line 115 of file Local_Name_Space.cpp. References ACE_TRACE, and ACE_OS::memcpy().
00118 : len_ (bytes), 00119 rep_ (dst), 00120 delete_rep_ (0) 00121 { 00122 ACE_TRACE ("ACE_NS_String::ACE_NS_String"); 00123 ACE_OS::memcpy (this->rep_, src, bytes); 00124 } |
|
|
Converts an ACE_NS_WString to an ACE_NS_String;.
Definition at line 57 of file Local_Name_Space.cpp. References ACE_TRACE, and ACE_WCHAR_T.
00058 : len_ ((s.length () + 1) * sizeof (ACE_WCHAR_T)), 00059 rep_ (s.rep ()), 00060 delete_rep_ (1) 00061 { 00062 ACE_TRACE ("ACE_NS_String::ACE_NS_String"); 00063 } |
|
|
Destructor.
Definition at line 13 of file Local_Name_Space.cpp. References delete_rep_.
00014 {
00015 if (this->delete_rep_)
00016 delete [] this->rep_;
00017 }
|
|
|
Return the ASCII character representation.
Definition at line 41 of file Local_Name_Space.cpp. References ACE_TRACE, ACE_WCHAR_T, and ACE_NS_WString::char_rep().
00042 {
00043 ACE_TRACE ("ACE_NS_String::char_rep");
00044 ACE_NS_WString w_string (this->rep_,
00045 (this->len_ / sizeof (ACE_WCHAR_T)) - 1);
00046 return w_string.char_rep ();
00047 }
|
|
|
Returns the underlying representation.
Definition at line 20 of file Local_Name_Space.cpp. References ACE_TRACE.
|
|
|
Returns a hash value for this string.
Definition at line 127 of file Local_Name_Space.cpp. References len_.
|
|
|
Returns length of the string.
Definition at line 34 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 26 of file Local_Name_Space.cpp. References ACE_NS_WString, ACE_TRACE, and ACE_WCHAR_T.
00027 {
00028 ACE_TRACE ("ACE_NS_String::operator ACE_NS_WString");
00029 return ACE_NS_WString (this->rep_,
00030 (this->len_ / sizeof (ACE_WCHAR_T)) - 1);
00031 }
|
|
|
Compare an ACE_NS_String.
Definition at line 109 of file Local_Name_Space.cpp. References ACE_TRACE, and operator==().
00110 {
00111 ACE_TRACE ("ACE_NS_String::operator !=");
00112 return !this->operator == (s);
00113 }
|
|
|
Compare an ACE_NS_String.
Definition at line 100 of file Local_Name_Space.cpp. References ACE_TRACE, len_, ACE_OS::memcmp(), and rep_. Referenced by operator!=().
00101 {
00102 ACE_TRACE ("ACE_NS_String::operator ==");
00103 return this->len_ == s.len_
00104 && ACE_OS::memcmp ((void *) this->rep_,
00105 (void *) s.rep_, this->len_) == 0;
00106 }
|
|
|
Matches on substrings.
Definition at line 66 of file Local_Name_Space.cpp. References ACE_TRACE, ACE_WCHAR_T, len_, and rep_.
00067 {
00068 ACE_TRACE ("ACE_NS_String::strstr");
00069
00070 if (this->len_ < s.len_)
00071 // If they're larger than we are they can't be a substring of us!
00072 return -1;
00073 else if (this->len_ == s.len_)
00074 // Check if we're equal.
00075 return *this == s ? 0 : -1;
00076 else
00077 {
00078 // They're smaller than we are...
00079 const size_t len = (this->len_ - s.len_) / sizeof (ACE_WCHAR_T);
00080 const size_t pat_len = s.len_ / sizeof (ACE_WCHAR_T) - 1;
00081
00082 for (size_t i = 0; i <= len; ++i)
00083 {
00084 size_t j;
00085
00086 for (j = 0; j < pat_len; ++j)
00087 if (this->rep_[i + j] != s.rep_[j])
00088 break;
00089
00090 if (j == pat_len)
00091 // Found a match! Return the index.
00092 return static_cast<int> (i);
00093 }
00094
00095 return -1;
00096 }
00097 }
|
|
|
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