Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site













SourceForge.net Logo

ValueArray

 

class ValueArray 

ValueArray is an array of Value elements. It is fully Rich Value compatible.

 

ValueArray is also compatible with ValueMap (in the similar way how Date is compatible with Time). Assigning Value containing ValueMap to ValueArray assigns it a ValueArray representing values of ValueMap. Assigning ValueArray to ValueMap creates map where keys are number 0, 1, ... GetCount() - 1 and values contain elements with corresponding indices.

 

Note that Value also provides methods (GetCount() and operator[]) to directly access ValueArray elements contained in Value (if Value does not contain ValueArray, GetCount() returns 0).

 

Public Method List

 

ValueArray()

Creates an empty ValueArray.

 


 

ValueArray(const ValueArray& v)

Copy constructor.

 


 

ValueArray(Vector<Value>&& values)

Creates ValueArray by picking values - source is destroyed.

 


 

explicit ValueArray(const Vector<Value>& values, int deep)

Creates ValueArray as deep copy of values (deep is dummy parameter to make the signature different from picking version).

 


 

~ValueArray()

Destructor.

 


 

ValueArray(std::initializer_list<Valueinit)

C++11 initialization.

 


 

ValueArray& operator=(const ValueArray& v)

Assignment operator.

 


 

ValueArray& operator=(Vector<Valuerval_ values)

Pick assignment - source is destroyed.

 


 

operator Value() const

Returns ValueArray as Value.

 


 

ValueArray(const Value& src)

Gets ValueArray from Value src. Note that this also works if Value contains ValueMap (vector of values, of key-value pairs, is returned).

 


 

ValueArray(const Nuller&)

Creates empty ValueArray (Null assignment).

 


 

bool IsNull() const

Returns true if there are no elements.

 


 

void Clear()

Removes all elements.

 


 

void SetCount(int n)

Sets the count of elements to n. If number of elements increases, new elements are void Values.

 


 

void SetCount(int n, const Value& v)

Sets the count of elements to n. If number of elements increases, new elements are set to v .

 


 

int GetCount() const

Returns number of elements.

 


 

bool IsEmpty() const

Same as GetCount() == 0 (or as IsNull()).

 


 

void Add(const Value& v)

Adds new element v.

 


 

ValueArray& operator<<(const Value& v)

Same as Add(v).

 


 

void Set(int i, const Value& v)

Sets element at i to v. If i >= GetCount(), void Values are added so that element i created.

 


 

const Value& Get(int iconst

Returns element at i.

 


 

Value GetAndClear(int i)

Assigns empty Value at i and returns Value that was in this element before. This special method is intended as optimization in certain situation, as it can void expensive cloning of Value in situation where keeping original Value in ValueArray is not required.

 


 

const Vector<Value>& Get() const

Returns constant reference to (internal) Vector<Value>.

 


 

Vector<ValuePick()

Picks the content, ValueArray is cleared.

 


 

void Remove(int i, int count = 1)

Removes count elements at i.

 


 

void Remove(const Vector<int>& ii)

Removes the sorted set of indicies.

 


 

void Insert(int i, const ValueArray& va)

Inserts another ValueArra va at i.

 


 

void Append(const ValueArray& va)

Appends va at the end of ValueArray.

 


 

const Value& operator[](int iconst

Returns element at i.

 


 

Value& At(int i)

Returns a reference of element at i , if there is none, adds as much Void Values to array as necessarry to have it. The reference returned is invalidated by any further use of originating Value.

 


 

unsigned GetHashValue() const

Returns hashing value.

 


 

void Serialize(Stream& s)

Serializes ValueArray. All elements must have serialization implemented.

 


 

void Jsonize(JsonIO& jio)

Converts ValueArray to/from JSON. All elements must have JSON conversion implemented.

 


 

void Xmlize(XmlIO& xio)

XML serialization support.

 


 

String ToString() const

Converts ValueArray to text.

 


 

bool operator==(const ValueArray& vconst

bool operator!=(const ValueArray& vconst

(In)Equality comparison. Two ValueArrays are equal if they have the same number of elements and all elements at the same position are equal.

 


 

int Compare(const ValueArray& bconst

bool operator<=(const ValueArray& xconst

bool operator>=(const ValueArray& xconst

bool operator<(const ValueArray& xconst

bool operator>(const ValueArray& xconst

Compares two ValueArrays using lexicographical comparison.

 

Last edit by klugier on 06/12/2016. Do you want to contribute?. T++