Permalink
Browse files

Added Char type (UTF-32)

  • Loading branch information...
1 parent 35b191f commit 5bdcbbb86eda52f9adf00d0d1c1c98e9a7c7cfa9 nddrylliog committed Aug 10, 2010
Showing with 10 additions and 4 deletions.
  1. +10 −4 sdk/lang/String.ooc
View
@@ -1,11 +1,15 @@
-
/**
* A byte. Not a char - die, C, die.
*/
Byte: cover from char
/**
+ * An UTF-32 character
+ */
+Char: cover from uint32_t
+
+/**
* A string
*/
String: abstract class {
@@ -14,16 +18,16 @@ String: abstract class {
get { _getSize() }
}
+ /** the number of bytes in this string */
+ _getSize: abstract func -> SizeT
+
bytes: Byte* {
get { _getBytes() }
}
/** return the contents of this String, as an array of bytes, UTF-8 encoded */
_getBytes: abstract func -> Byte*
- /** the number of bytes in this string */
- _getSize: abstract func -> SizeT
-
/** print *this* followed by a newline. */
println: abstract func
@@ -95,6 +99,8 @@ ASCIIString: class extends String {
/* ----- C interfacing ----- */
+include stdint // for uint32_t
+
include stdio, string
/** stdio.h - formatted print into a buffer, with a specified max length. Returns the actual length of the formatting. */

0 comments on commit 5bdcbbb

Please sign in to comment.