Editor API
UnigineEditor public API
UnigineEditor::Collection Class Reference

This class is used to represent a collection of values (boolean, integer, float, or string) that can represent a set of import parameters for an asset. More...

#include <UnigineCollection.h>

Inherits APIInterface.

Public Types

enum  TYPE {
  TYPE_NONE = 0, TYPE_BOOL, TYPE_INT, TYPE_FLOAT,
  TYPE_STRING
}
 Value type. More...
 

Public Member Functions

void clear ()
 Clears the collection by removing all elements. More...
 
bool isEmpty () const
 Checks if the collection is empty or has any elements. More...
 
bool hasValue (const char *value_name) const
 Checks if the collection contains a value element with the specified name. More...
 
Unigine::Vector< Unigine::String > getNames () const
 Returns the list of names of all elements in the collection as a vector of strings. More...
 
bool remove (const char *value_name)
 Removes a value element with the specified name from the collection. More...
 
Collection::TYPE getType (const char *value_name) const
 Returns the type of a value element with the specified name (see TYPE). More...
 
void setBool (const char *value_name, bool value)
 Sets a new boolean value for the collection element with the specified name. More...
 
bool getBool (const char *value_name, bool default_value=false) const
 Returns the current boolean value of the collection element with the specified name. More...
 
void setInt (const char *value_name, int value)
 Sets a new integer value for the collection element with the specified name. More...
 
int getInt (const char *value_name, int default_value=0) const
 Returns the current integer value of the collection element with the specified name. More...
 
void setFloat (const char *value_name, float value)
 Sets a new float value for the collection element with the specified name. More...
 
float getFloat (const char *value_name, float default_value=0) const
 Returns the current float value of the collection element with the specified name. More...
 
void setString (const char *value_name, const char *value)
 Sets a new string value for the collection element with the specified name. More...
 
Unigine::String getString (const char *value_name, const char *default_value=nullptr) const
 Returns the current string value of the collection element with the specified name. More...
 

Static Public Member Functions

static Unigine::Ptr< Collectioncreate ()
 Creates a new empty collection. More...
 

Detailed Description

This class is used to represent a collection of values (boolean, integer, float, or string) that can represent a set of import parameters for an asset.

Member Enumeration Documentation

◆ TYPE

Value type.

Enumerator
TYPE_NONE 

Boolean value.

TYPE_BOOL 

Boolean value type.

TYPE_INT 

Integer value type.

TYPE_FLOAT 

Float value type.

TYPE_STRING 

String value type.

Member Function Documentation

◆ clear()

void UnigineEditor::Collection::clear ( )

Clears the collection by removing all elements.

◆ create()

static Unigine::Ptr<Collection> UnigineEditor::Collection::create ( )
static

Creates a new empty collection.

◆ getBool()

bool UnigineEditor::Collection::getBool ( const char *  value_name,
bool  default_value = false 
) const

Returns the current boolean value of the collection element with the specified name.

Parameters
value_nameName of the collection element.
default_valueDefault value to be returned in case the requested value does not exist or cannot be converted to the specified type.

◆ getFloat()

float UnigineEditor::Collection::getFloat ( const char *  value_name,
float  default_value = 0 
) const

Returns the current float value of the collection element with the specified name.

Parameters
value_nameName of the collection element.
default_valueDefault value to be returned in case the requested value does not exist or cannot be converted to the specified type.

◆ getInt()

int UnigineEditor::Collection::getInt ( const char *  value_name,
int  default_value = 0 
) const

Returns the current integer value of the collection element with the specified name.

Parameters
value_nameName of the collection element.
default_valueDefault value to be returned in case the requested value does not exist or cannot be converted to the specified type.

◆ getNames()

Unigine::Vector<Unigine::String> UnigineEditor::Collection::getNames ( ) const

Returns the list of names of all elements in the collection as a vector of strings.

◆ getString()

Unigine::String UnigineEditor::Collection::getString ( const char *  value_name,
const char *  default_value = nullptr 
) const

Returns the current string value of the collection element with the specified name.

Parameters
value_nameName of the collection element.
default_valueDefault value to be returned in case the requested value does not exist or cannot be converted to the specified type.

◆ getType()

Collection::TYPE UnigineEditor::Collection::getType ( const char *  value_name) const

Returns the type of a value element with the specified name (see TYPE).

Parameters
value_nameName of the collection element.

◆ hasValue()

bool UnigineEditor::Collection::hasValue ( const char *  value_name) const

Checks if the collection contains a value element with the specified name.

Parameters
value_nameName of the collection element to be checked.
Returns
true if the collection contains an element with the specified name; otherwise, false.

◆ isEmpty()

bool UnigineEditor::Collection::isEmpty ( ) const

Checks if the collection is empty or has any elements.

Returns
true if the collection is empty; otherwise, false.

◆ remove()

bool UnigineEditor::Collection::remove ( const char *  value_name)

Removes a value element with the specified name from the collection.

Parameters
value_nameName of the collection element to be removed.
Returns
true if the element with the specified name is removed successfully; otherwise, false.

◆ setBool()

void UnigineEditor::Collection::setBool ( const char *  value_name,
bool  value 
)

Sets a new boolean value for the collection element with the specified name.

Parameters
value_nameName of the collection element to be updated.
valueNew boolean value to be set.

◆ setFloat()

void UnigineEditor::Collection::setFloat ( const char *  value_name,
float  value 
)

Sets a new float value for the collection element with the specified name.

Parameters
value_nameName of the collection element to be updated.
valueNew float value to be set.

◆ setInt()

void UnigineEditor::Collection::setInt ( const char *  value_name,
int  value 
)

Sets a new integer value for the collection element with the specified name.

Parameters
value_nameName of the collection element to be updated.
valueNew integer value to be set.

◆ setString()

void UnigineEditor::Collection::setString ( const char *  value_name,
const char *  value 
)

Sets a new string value for the collection element with the specified name.

Parameters
value_nameName of the collection element to be updated.
valueNew string value to be set.