Start port
[iotcloud.git] / version2 / src / C / IoTString.h
diff --git a/version2/src/C/IoTString.h b/version2/src/C/IoTString.h
new file mode 100644 (file)
index 0000000..00dd8e6
--- /dev/null
@@ -0,0 +1,46 @@
+#ifndef IOTSTRING_H
+#define IOTSTRING_H
+
+#include "array.h"
+
+/**
+ * IoTString wraps the underlying char string.
+ * @author Brian Demsky <bdemsky@uci.edu>
+ * @version 1.0
+ */
+
+public class IoTString {
+ private:
+       Array<char> array;
+  
+  IoTString() {}
+
+       /**
+        * Builds an IoTString object around the char array.  This
+        * constructor makes a copy, so the caller is free to modify the char array.
+        */
+  
+ public:
+  IoTString(Array<char> * _array) { array.init(_array); }
+  ~IoTString() {}
+  
+       /**
+        * Internal method to grab a reference to our char array.  Caller
+        * must not modify it.
+        */
+  
+       Array<char> * internalBytes() { return &array; }
+  
+       /**
+        * Returns a copy of the underlying char string.
+        */
+  
+       Array<char> * getBytes() { return new Array<Char>(&array); }
+
+       /**
+        * Returns the length in chars of the IoTString.
+        */
+  
+       int length() { return array->length(); }
+}
+#endif