#include <ByteString.h>
Inheritance diagram for Core::ByteString:
Public Member Functions | |
ByteString (int size) | |
virtual | ~ByteString (void) |
virtual String * | className (void) const |
Answer receiver class name. | |
virtual Character * | at (int index) const |
virtual void | put (int index, Character *object) |
virtual int | byteSize (void) |
virtual void | changeSize (long newSize) |
virtual bool | isEqual (StringImpl *object) |
virtual bool | isEqualToBytes (unsigned char *object) |
virtual bool | isEqualToShorts (unsigned short *object) |
virtual ByteString * | asByteString (void) |
virtual TwoByteString * | asTwoByteString (void) |
virtual bool | isByteString (void) const |
Protected Attributes | |
unsigned char * | content |
Every character is stored as single byte. It is good idea not to use this class directly. Use String instead.
Definition at line 40 of file ByteString.h.
|
Definition at line 33 of file ByteString.cc. References content, and Core::StringImpl::tally. 00034 { 00035 tally = size; 00036 content = (unsigned char *) GC_malloc(tally * sizeof(unsigned char)); 00037 bzero(content, tally); 00038 }
|
|
Definition at line 40 of file ByteString.cc. References content. 00041 { 00042 GC_free(content); 00043 }
|
|
Reimplemented from Core::StringImpl. Definition at line 103 of file ByteString.cc. 00104 { 00105 return this; 00106 }
|
|
Reimplemented from Core::StringImpl. Definition at line 108 of file ByteString.cc. References content, Core::TwoByteString::putRawValue(), and Core::StringImpl::size(). 00109 { 00110 TwoByteString *newString = new TwoByteString(size()); 00111 for (int i = 0; i < size(); i++) { 00112 newString->putRawValue(i, content[i]); 00113 } 00114 return newString; 00115 }
|
|
Reimplemented from Core::StringImpl. Definition at line 52 of file ByteString.cc. References content, and Core::Character::value(). 00053 { 00054 return Character::value(content[index]); 00055 }
|
|
Reimplemented from Core::StringImpl. Definition at line 62 of file ByteString.cc. 00063 {
00064 return 1;
00065 }
|
|
Reimplemented from Core::StringImpl. Definition at line 68 of file ByteString.cc. References content, Core::StringImpl::size(), and Core::StringImpl::tally. 00069 { 00070 unsigned char *oldContent = content; 00071 00072 content = (unsigned char *) GC_malloc(newSize * sizeof(unsigned char)); 00073 bzero(content, newSize); 00074 memcpy(content, oldContent, size() * sizeof(unsigned char)); 00075 tally = newSize; 00076 }
|
|
Answer receiver class name. Because there isn't any standard way to obtain class name this method comes to place. Every class should rewrite this method but many didn't (yet). Reimplemented from Core::Object. Definition at line 46 of file ByteString.cc. 00047 { 00048 return new String("ByteString"); 00049 }
|
|
Reimplemented from Core::StringImpl. Definition at line 118 of file ByteString.cc. 00119 { 00120 return true; 00121 }
|
|
Reimplemented from Core::StringImpl. Definition at line 79 of file ByteString.cc. References Core::StringImpl::isEqualToBytes(). 00080 { 00081 return string->isEqualToBytes(this->content); 00082 }
|
|
Reimplemented from Core::StringImpl. Definition at line 84 of file ByteString.cc. References Core::StringImpl::tally. 00085 { 00086 for (int i = 0; i < tally; i++) { 00087 if (this->content[i] != string[i]) 00088 return false; 00089 } 00090 return true; 00091 }
|
|
Reimplemented from Core::StringImpl. Definition at line 93 of file ByteString.cc. References Core::StringImpl::tally. 00094 { 00095 for (int i = 0; i < tally; i++) { 00096 if (this->content[i] != string[i]) 00097 return false; 00098 } 00099 return true; 00100 }
|
|
Reimplemented from Core::StringImpl. Definition at line 57 of file ByteString.cc. References Core::Character::asInteger(), and content. Referenced by Core::StringImpl::asByteString().
|
|
Definition at line 43 of file ByteString.h. Referenced by asTwoByteString(), at(), ByteString(), changeSize(), put(), and ~ByteString(). |