#include <lkrawdata.h>
Inheritance diagram for look::LookRawData::
Public Methods | |
LookRawData () | |
Default constructor. More... | |
LookRawData (const char *theData, long theDataLength) | |
Constructor. | |
~LookRawData (void) | |
Destructor. | |
LookRawData (const LookRawData &theOther) | |
Shallow Copy constructor. More... | |
LookRawData& | operator= (const LookRawData &theOther) |
Shallow Assignment operator. More... | |
LookTypeBase* | GetNewCopy (void) const |
Get a new copy. More... | |
long | GetTypeID (void) const |
Get Type ID. More... | |
char* | GetData (void) |
Get a pointer to the data. More... | |
long | GetLength (void) |
Get the length of the data. More... | |
char* | GetData (long &theLength) |
Get a pointer to the data and its length. More... | |
void | SetData (const char *theData, long theLength) |
Set the data. More... | |
char* | InitialiseData (long theLength) |
Set up a data space. More... | |
void | Append (const LookRawData &theOther) |
Append data. More... | |
void | Append (const char *theData, long theLength) |
Append data. More... | |
void | Resize (long theNewLength) |
Resize data. More... | |
bool | Set (const LookString &theString) |
Convert from string. More... | |
LookString | GetString (void) const |
Convert to string. More... | |
Protected Attributes | |
RawDataRepresentation* | itsData |
This behaves as a very stupid string class in some ways. Copies share the same binary data, so copying is fast but changes to one copy affect the other one.
For this reason, it should be used with great care!
There are a number of operations which create a proper new copy, eg append. These invalidate any pointers to the data in that object, however if there are any shallow copies around, pointers to data in that shallow copy will remain valid.
|
Default constructor. Default length and data will be 0 (NULL). |
|
Shallow Copy constructor. The new copy shares the binary data representation. The const isn't really so... |
|
Append data. Appends theLength bytes of data from theData to me. All existing pointers to my data will be invalidated. My data will not be shared with anything else.
|
|
Append data. Appends the data in theOther to me. All existing pointers to my data will be invalidated. My data will not be shared with anything else.
|
|
Get a pointer to the data and its length.
|
|
Get a pointer to the data.
|
|
Get the length of the data.
|
|
Get a new copy. Virtual copy constructor, aka clone. Note this new copy shares data with the old one.
Reimplemented from look::LookTypeBase. |
|
Convert to string. LookString can cope with embedded nulls (as it is std::string), so this method returns a string of the correct length.
|
|
Get Type ID. Pseudo-rtti, or isA.
Reimplemented from look::LookTypeBase. |
|
Set up a data space. This reserves a space for data for you to fill - ie no copy required. After this we own our own data representation.
|
|
Resize data. Resize my data to theNewLength. All existing pointers to my data will be invalidated. My data will not be shared with anything else.
|
|
Convert from string. LookString has a length independent of embedded nulls (as it is std::string), so this calls SetData with that length.
|
|
Set the data. This takes a copy of theData. After this we own our own data representation.
|
|
Shallow Assignment operator. The old binary data representation is thrown away. We now share the binary data with theOther. The const isn't really so... |