7 * IoTString wraps the underlying char string.
8 * @author Brian Demsky <bdemsky@uci.edu>
18 * Builds an IoTString object around the char array. This
19 * constructor makes a copy, so the caller is free to modify the char array.
23 IoTString(Array<char> *_array) : array(new Array<char>(_array)) {}
24 IoTString(const char *_array) {
25 int32_t len = strlen(_array);
26 array = new Array<char>(len);
27 strcpy(array->internalArray(), _array);
35 * Internal method to grab a reference to our char array. Caller
39 Array<char> *internalBytes() { return array; }
42 * Returns a copy of the underlying char string.
45 Array<char> *getBytes() { return new Array<char>(array); }
48 * Returns the length in chars of the IoTString.
51 bool equals(IoTString *str) {
52 uint strlength = str->array->length();
53 uint thislength = array->length();
54 if (strlength != thislength)
57 int result = memcmp(str->array->internalArray(), array->internalArray(), strlength);
61 int length() { return array->length(); }
62 friend IoTString *IoTString_shallow(Array<char> *_array);
65 IoTString *IoTString_shallow(Array<char> *_array) {
66 IoTString *str = new IoTString();