MCPcopy Create free account
hub / github.com/CytopiaTeam/Cytopia / CScriptArray

Class CScriptArray

external/as_add_on/scriptarray/scriptarray.h:30–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28struct SArrayCache;
29
30class CScriptArray
31{
32public:
33 // Set the memory functions that should be used by all CScriptArrays
34 static void SetMemoryFunctions(asALLOCFUNC_t allocFunc, asFREEFUNC_t freeFunc);
35
36 // Factory functions
37 static CScriptArray *Create(asITypeInfo *ot);
38 static CScriptArray *Create(asITypeInfo *ot, asUINT length);
39 static CScriptArray *Create(asITypeInfo *ot, asUINT length, void *defaultValue);
40 static CScriptArray *Create(asITypeInfo *ot, void *listBuffer);
41
42 // Memory management
43 void AddRef() const;
44 void Release() const;
45
46 // Type information
47 asITypeInfo *GetArrayObjectType() const;
48 int GetArrayTypeId() const;
49 int GetElementTypeId() const;
50
51 // Get the current size
52 asUINT GetSize() const;
53
54 // Returns true if the array is empty
55 bool IsEmpty() const;
56
57 // Pre-allocates memory for elements
58 void Reserve(asUINT maxElements);
59
60 // Resize the array
61 void Resize(asUINT numElements);
62
63 // Get a pointer to an element. Returns 0 if out of bounds
64 void *At(asUINT index);
65 const void *At(asUINT index) const;
66
67 // Set value of an element.
68 // The value arg should be a pointer to the value that will be copied to the element.
69 // Remember, if the array holds handles the value parameter should be the
70 // address of the handle. The refCount of the object will also be incremented
71 void SetValue(asUINT index, void *value);
72
73 // Copy the contents of one array to another (only if the types are the same)
74 CScriptArray &operator=(const CScriptArray&);
75
76 // Compare two arrays
77 bool operator==(const CScriptArray &) const;
78
79 // Array manipulation
80 void InsertAt(asUINT index, void *value);
81 void InsertAt(asUINT index, const CScriptArray &arr);
82 void InsertLast(void *value);
83 void RemoveAt(asUINT index);
84 void RemoveLast();
85 void RemoveRange(asUINT start, asUINT count);
86 void SortAsc();
87 void SortDesc();

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected