Cind programming language

Language definition Examples Download Contact

Sheet object

A sheet is a system object that represents a part of memory.
Its implementation is based on the array of bytes, allowing to read and write binary data, from and to the sheet, and also to change the size of data.

A Sheet is treated as a system object, having a sheet type. For example:

sheet h;

is a variable declaration of a sheet type.

Creating sheet

There is no explicit construction to create a sheet object, but it can be done, for example, by converting from string object. For example:

sheet h = (sheet)"";

it creates new empty sheet object (object with array of zero length).

Notice, that unlike string, sheet object allows to change its own data. Making operation on the string object will always result on the new string object, but making an operation on the sheet, won't change the sheet object, but only its internal data.

For more about objects creation see Creating objects.

Examples of most common sheet creation:

(sheet)"Hello" ((sheet)"").setSize(size) "".newSheet('A','B',...)

Methods

Sheet object accepts methods:

method parameters description result
size () returns size of owned memory
(size of array of bytes)
integer
setSize (newSize) changes size of owned memory
byteAt (pos) returns byte at given position byte
read (from,length) returns new sheet that contains subset of memory sheet
write (destOffset,
srcSheet,srcOffset,
count)
writes data to owned memory
from the other sheet
append (...) appends binary data from the parameters to the sheet
clone () returns new sheet having the same data sheet
subSheet (from,length) returns new sheet that contains subset of memory
(the same as read method)
sheet
newString (...) returns new string object,
that contains data from parameters
string
newSheet (...) returns new sheet object,
that contains data from parameters
sheet

Type conversion

Object of sheet type can be converted to system objects of type:

dest type conversion description
byte[] returns new array of bytes, which is a copy of sheet content
string return new string object of owned bytes, assuming UTF-8 representation

There is no conversion to other types, but it can be done via intermediate type.
For example, conversion to array of chars is possible through string:

sheet h = ... ; char[] x = (char[])(string)h;

For more about type conversion see Type conversion.

Operators

There are no operators allowed for the sheet object.
All sheet management can be done by methods and type conversion.



Cind programming language 1.0.4