# class StringArray

StringArray is the string implementation of ValueArray. See ValueArray for a description.

See also: ValueArray

# Properties

Property Description
AlternativeName A string that can be used to identify the array in collections.
ItemCount The number of individual items in the array. Warning! Do not confuse this count with the count of tuples, they are only the same if TupleSize is equal to 1, i.e. when the tuples are exactly one component each. Also note that the item count should be a multiple of TupleSize. Note that the total number of items cannotexceed INT_MAX.
TupleCount The tuple count, meaning how many tuples are in the array. If resized to larger array, the new tuples will not be set to anything.
TupleSize The tuple size, meaning how many items of the underlying data type is in a tuple. The tuple size must be set before the array is populated.

# Methods

Method Description
AddItem Adds an item to the list, allocates memory as needed to enlarge the list. If many items are being put into the list, use Resize to set the size of the new list (only one reallocation needed) and then use SetItem() / SetTuple() to set the items directly.
AppendArray Appends an array to this array. The array must be a descendant of ValueArray. For best performance, append arrays of the same basic type.
Clear Clears the array and sets the tuple count to 0. Tuple size and name remains the same though.
CompareTuples CompareTuples compares a tuple in this array with a tuple in another array. Returns 0 if the tuples are identical, 1 if an element in this array tuple in ascending order is larger and -1 if smaller.
CopyRange CopyRange copies a range of tuples from a source array into this array. The arrays must have the same tuple size and base type. This array must be resized to hold the tuples before copying. The basetypes are listed in EBaseTypes.
CopyTuple CopyTuple copies one tuple in a source array to a tuple in this array. Both the dest_id and the source_id must exist in the arrays. This array can be used as the source array to copy within the array.
DeepCopy Copies data from another array. The arrays must have the same underlying data types.
ExtractTuples Extracts tuples from the array. Note that the destination array must have the same classtype and have the same tuple size as the source array. (If both arrays are decendants of ValueArray, they can be of different types, but the conversion is slow).
GetBaseType Returns the id of the basic type that the array is based on The ids are listed in the BaseTypes enumeration.
GetClass Get the name of the StringArray class.
GetItem Gets the value of an item in the list. The id of the item is the exact location of the item (TupleId * TupleSize + Index of item in tuple) Warning! No range checking is done.
GetMaxItemId Returns the id of the last item that is in the array. The id returned is equal to (ItemCount - 1). Warning! Do not confuse this id with the id of a tuple, they are only the same if TupleSize is equal to one, i.e. when the tuples are exactly one component each.
GetMaxTupleId Returns the id of the tuple last in the list. If the array is empty, the value is unspecified. Note: GetMaxTupleId() always returns (GetTupleCount()-1) as a signed id.
GetRealItem GetRealItem() retrieves the item at position id. The id is the id of the item, not the tuple the item belongs to. GetRealItem() converts the value from the actual underlying data type to a real.
IndexedCopy Copies tuples from a source array through an id table. The id table dictates the order in which the tuples are to be copied to this array. E.g. If the first item in the id table has the value 14, then the tuple with id 14 in the source array will be copied to the first tuple in this array. Note: All ids in the id table must be valid ids of tuples in the source array. The id table is assumed to have a tuple size of 1. The source array and this array must have the same underlying data type, and have the same tuple size. The array must be large enough to hold the copied data.
IsA Returns true if StringArray is a or is a descendant of the class named as the type parameter.
IsEmpty Returns true if the list is empty.
IsNull Returns true if the StringArray object is invalid.
NewCopy Creates a new array with the same underlying data type, size and tuple settings as this array. To also copy the actual data, set copy_data to true.
NewPackedCopy Like NewCopy, NewPackedCopy creates an array with the same underlying data and tuple settings as the source array. However, NewPackedCopy only copies unique tuples, and if the index_array parameter is set, this index array will contain the same number of tuples as the source array, and with the ids of a specific tuples within the new copy of the array.
SetItem Sets an item in the list. The id of the item is the exact location of the item (TupleId * TupleSize + Index of item in tuple) Warning! No range checking is done.
SetRealItem SetRealItem() sets the item at position id. The id is the id of the item, not the tuple the item belongs to. SetRealItem() converts the value from real to the actual underlying data type.

# Static methods

Method Description
IsClassA Returns true if the class is a or is a descendant of the class named as the type parameter.
SafeCast SafeCast makes sure the input object is of a class that can be cast into spStringArray, and if this is the case, returns the object cast into spStringArray.

# Properties details

# AlternativeName

A string that can be used to identify the array in collections.

    # ItemCount

    The number of individual items in the array. Warning! Do not confuse this count with the count of tuples, they are only the same if TupleSize is equal to 1, i.e. when the tuples are exactly one component each. Also note that the item count should be a multiple of TupleSize. Note that the total number of items cannotexceed INT_MAX.

      # TupleCount

      The tuple count, meaning how many tuples are in the array. If resized to larger array, the new tuples will not be set to anything.

        # TupleSize

        The tuple size, meaning how many items of the underlying data type is in a tuple. The tuple size must be set before the array is populated.

          # Methods details

          # AddItem

          Adds an item to the list, allocates memory as needed to enlarge the list. If many items are being put into the list, use Resize to set the size of the new list (only one reallocation needed) and then use SetItem() / SetTuple() to set the items directly.

            # AppendArray

            Appends an array to this array. The array must be a descendant of ValueArray. For best performance, append arrays of the same basic type.

              # Clear

              Clears the array and sets the tuple count to 0. Tuple size and name remains the same though.

                # CompareTuples

                CompareTuples compares a tuple in this array with a tuple in another array. Returns 0 if the tuples are identical, 1 if an element in this array tuple in ascending order is larger and -1 if smaller.

                  # CopyRange

                  CopyRange copies a range of tuples from a source array into this array. The arrays must have the same tuple size and base type. This array must be resized to hold the tuples before copying. The basetypes are listed in EBaseTypes.

                    # CopyTuple

                    CopyTuple copies one tuple in a source array to a tuple in this array. Both the dest_id and the source_id must exist in the arrays. This array can be used as the source array to copy within the array.

                      # DeepCopy

                      Copies data from another array. The arrays must have the same underlying data types.

                        # ExtractTuples

                        Extracts tuples from the array. Note that the destination array must have the same classtype and have the same tuple size as the source array. (If both arrays are decendants of ValueArray, they can be of different types, but the conversion is slow).

                          # GetBaseType

                          Returns the id of the basic type that the array is based on The ids are listed in the BaseTypes enumeration.

                            # GetClass

                            Get the name of the StringArray class.

                              # GetItem

                              Gets the value of an item in the list. The id of the item is the exact location of the item (TupleId * TupleSize + Index of item in tuple) Warning! No range checking is done.

                                # GetMaxItemId

                                Returns the id of the last item that is in the array. The id returned is equal to (ItemCount - 1). Warning! Do not confuse this id with the id of a tuple, they are only the same if TupleSize is equal to one, i.e. when the tuples are exactly one component each.

                                  # GetMaxTupleId

                                  Returns the id of the tuple last in the list. If the array is empty, the value is unspecified. Note: GetMaxTupleId() always returns (GetTupleCount()-1) as a signed id.

                                    # GetRealItem

                                    GetRealItem() retrieves the item at position id. The id is the id of the item, not the tuple the item belongs to. GetRealItem() converts the value from the actual underlying data type to a real.

                                      # IndexedCopy

                                      Copies tuples from a source array through an id table. The id table dictates the order in which the tuples are to be copied to this array. E.g. If the first item in the id table has the value 14, then the tuple with id 14 in the source array will be copied to the first tuple in this array. Note: All ids in the id table must be valid ids of tuples in the source array. The id table is assumed to have a tuple size of 1. The source array and this array must have the same underlying data type, and have the same tuple size. The array must be large enough to hold the copied data.

                                        # IsA

                                        Returns true if StringArray is a or is a descendant of the class named as the type parameter.

                                          # IsEmpty

                                          Returns true if the list is empty.

                                            # IsNull

                                            Returns true if the StringArray object is invalid.

                                              # NewCopy

                                              Creates a new array with the same underlying data type, size and tuple settings as this array. To also copy the actual data, set copy_data to true.

                                                # NewPackedCopy

                                                Like NewCopy, NewPackedCopy creates an array with the same underlying data and tuple settings as the source array. However, NewPackedCopy only copies unique tuples, and if the index_array parameter is set, this index array will contain the same number of tuples as the source array, and with the ids of a specific tuples within the new copy of the array.

                                                  # SetItem

                                                  Sets an item in the list. The id of the item is the exact location of the item (TupleId * TupleSize + Index of item in tuple) Warning! No range checking is done.

                                                    # SetRealItem

                                                    SetRealItem() sets the item at position id. The id is the id of the item, not the tuple the item belongs to. SetRealItem() converts the value from real to the actual underlying data type.

                                                      # Static methods details

                                                      # IsClassA

                                                      Returns true if the class is a or is a descendant of the class named as the type parameter.

                                                        # SafeCast

                                                        SafeCast makes sure the input object is of a class that can be cast into spStringArray, and if this is the case, returns the object cast into spStringArray.