more edits
[iotcloud.git] / version2 / src / C / IoTString.h
1 #ifndef IOTSTRING_H
2 #define IOTSTRING_H
3
4 #include "array.h"
5
6 /**
7  * IoTString wraps the underlying char string.
8  * @author Brian Demsky <bdemsky@uci.edu>
9  * @version 1.0
10  */
11
12 public class IoTString {
13  private:
14         Array<char> array;
15   
16   IoTString() {}
17
18         /**
19          * Builds an IoTString object around the char array.  This
20          * constructor makes a copy, so the caller is free to modify the char array.
21          */
22   
23  public:
24   IoTString(Array<char> * _array) { array.init(_array); }
25   ~IoTString() {}
26   
27         /**
28          * Internal method to grab a reference to our char array.  Caller
29          * must not modify it.
30          */
31   
32         Array<char> * internalBytes() { return &array; }
33   
34         /**
35          * Returns a copy of the underlying char string.
36          */
37   
38         Array<char> * getBytes() { return new Array<Char>(&array); }
39
40         /**
41          * Returns the length in chars of the IoTString.
42          */
43   
44         int length() { return array->length(); }
45 }
46 #endif