mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 07:34:45 +00:00
no idea why this was changed in a previous commit
how the fuck did this get changed!
This commit is contained in:
parent
89843b541c
commit
d7b68a97ee
2 changed files with 323 additions and 297 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -45,7 +45,7 @@ protected:
|
||||||
String key;
|
String key;
|
||||||
String value;
|
String value;
|
||||||
Element() { }
|
Element() { }
|
||||||
Element( const String& _key, const String& _value ) : key(_key), value(_value) { }
|
Element(const String& _key, const String& _value) : key(_key), value(_value) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
bool mCaseSensitive;
|
bool mCaseSensitive;
|
||||||
|
|
@ -61,16 +61,16 @@ protected:
|
||||||
static bool smCaseSensitive;
|
static bool smCaseSensitive;
|
||||||
static const char* smCompareFunction;
|
static const char* smCompareFunction;
|
||||||
|
|
||||||
static S32 QSORT_CALLBACK _valueCompare( const void *a, const void *b );
|
static S32 QSORT_CALLBACK _valueCompare(const void* a, const void* b);
|
||||||
static S32 QSORT_CALLBACK _valueNumCompare( const void *a, const void *b );
|
static S32 QSORT_CALLBACK _valueNumCompare(const void* a, const void* b);
|
||||||
static S32 QSORT_CALLBACK _keyCompare( const void *a, const void *b );
|
static S32 QSORT_CALLBACK _keyCompare(const void* a, const void* b);
|
||||||
static S32 QSORT_CALLBACK _keyNumCompare( const void *a, const void *b );
|
static S32 QSORT_CALLBACK _keyNumCompare(const void* a, const void* b);
|
||||||
static S32 QSORT_CALLBACK _keyFunctionCompare( const void* a, const void* b );
|
static S32 QSORT_CALLBACK _keyFunctionCompare(const void* a, const void* b);
|
||||||
static S32 QSORT_CALLBACK _valueFunctionCompare( const void* a, const void* b );
|
static S32 QSORT_CALLBACK _valueFunctionCompare(const void* a, const void* b);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
static bool _addKeyFromField( void *object, const char *index, const char *data );
|
static bool _addKeyFromField(void* object, const char* index, const char* data);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
|
@ -82,39 +82,39 @@ public:
|
||||||
/// Returns true if string handling by the array is case-sensitive.
|
/// Returns true if string handling by the array is case-sensitive.
|
||||||
bool isCaseSensitive() const { return mCaseSensitive; }
|
bool isCaseSensitive() const { return mCaseSensitive; }
|
||||||
|
|
||||||
bool isEqual( const String &valA, const String &valB ) const
|
bool isEqual(const String& valA, const String& valB) const
|
||||||
{
|
{
|
||||||
return valA.equal( valB, isCaseSensitive() ? String::Case : String::NoCase );
|
return valA.equal(valB, isCaseSensitive() ? String::Case : String::NoCase);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Searches the array for the first matching value from the
|
/// Searches the array for the first matching value from the
|
||||||
/// current array position. It will return -1 if no matching
|
/// current array position. It will return -1 if no matching
|
||||||
/// index is found.
|
/// index is found.
|
||||||
S32 getIndexFromValue( const String &value ) const;
|
S32 getIndexFromValue(const String& value) const;
|
||||||
|
|
||||||
/// Searches the array for the first matching key from the current
|
/// Searches the array for the first matching key from the current
|
||||||
/// array position. It will return -1 if no matching index found.
|
/// array position. It will return -1 if no matching index found.
|
||||||
S32 getIndexFromKey( const String &key ) const;
|
S32 getIndexFromKey(const String& key) const;
|
||||||
|
|
||||||
/// Returns the key for a given index.
|
/// Returns the key for a given index.
|
||||||
/// Will return a null value for an invalid index
|
/// Will return a null value for an invalid index
|
||||||
const String& getKeyFromIndex( S32 index ) const;
|
const String& getKeyFromIndex(S32 index) const;
|
||||||
|
|
||||||
/// Returns the value for a given index.
|
/// Returns the value for a given index.
|
||||||
/// Will return a null value for an invalid index
|
/// Will return a null value for an invalid index
|
||||||
const String& getValueFromIndex( S32 index ) const;
|
const String& getValueFromIndex(S32 index) const;
|
||||||
|
|
||||||
///
|
///
|
||||||
S32 getIndexFromKeyValue( const String &key, const String &value ) const;
|
S32 getIndexFromKeyValue(const String& key, const String& value) const;
|
||||||
|
|
||||||
/// Counts the number of elements in the array
|
/// Counts the number of elements in the array
|
||||||
S32 count() const { return mArray.size(); }
|
S32 count() const { return mArray.size(); }
|
||||||
|
|
||||||
/// Counts the number of instances of a particular value in the array
|
/// Counts the number of instances of a particular value in the array
|
||||||
S32 countValue( const String &value ) const;
|
S32 countValue(const String& value) const;
|
||||||
|
|
||||||
/// Counts the number of instances of a particular key in the array
|
/// Counts the number of instances of a particular key in the array
|
||||||
S32 countKey( const String &key ) const;
|
S32 countKey(const String& key) const;
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
@ -122,13 +122,13 @@ public:
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
/// Adds a new array item to the end of the array
|
/// Adds a new array item to the end of the array
|
||||||
void push_back( const String &key, const String &value );
|
void push_back(const String& key, const String& value);
|
||||||
|
|
||||||
/// Adds a new array item to the front of the array
|
/// Adds a new array item to the front of the array
|
||||||
void push_front( const String &key, const String &value );
|
void push_front(const String& key, const String& value);
|
||||||
|
|
||||||
/// Adds a new array item to a particular index of the array
|
/// Adds a new array item to a particular index of the array
|
||||||
void insert( const String &key, const String &value, S32 index );
|
void insert(const String& key, const String& value, S32 index);
|
||||||
|
|
||||||
/// Removes an array item from the end of the array
|
/// Removes an array item from the end of the array
|
||||||
void pop_back();
|
void pop_back();
|
||||||
|
|
@ -137,13 +137,13 @@ public:
|
||||||
void pop_front();
|
void pop_front();
|
||||||
|
|
||||||
/// Removes an array item from a particular index of the array
|
/// Removes an array item from a particular index of the array
|
||||||
void erase( S32 index );
|
void erase(S32 index);
|
||||||
|
|
||||||
/// Clears an array
|
/// Clears an array
|
||||||
void empty();
|
void empty();
|
||||||
|
|
||||||
/// Moves a key and value from one index location to another.
|
/// Moves a key and value from one index location to another.
|
||||||
void moveIndex( S32 prev, S32 index );
|
void moveIndex(S32 prev, S32 index);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
@ -158,32 +158,36 @@ public:
|
||||||
/// (keeps the first instance only)
|
/// (keeps the first instance only)
|
||||||
void uniqueKey();
|
void uniqueKey();
|
||||||
|
|
||||||
|
/// Removes any duplicate keys from the array
|
||||||
|
/// (keeps the first instance only)
|
||||||
|
void uniquePair();
|
||||||
|
|
||||||
/// Makes this array an exact duplicate of another array
|
/// Makes this array an exact duplicate of another array
|
||||||
void duplicate( ArrayObject *obj );
|
void duplicate(ArrayObject* obj);
|
||||||
|
|
||||||
/// Crops the keys that exists in the target array from our current array
|
/// Crops the keys that exists in the target array from our current array
|
||||||
void crop( ArrayObject *obj );
|
void crop(ArrayObject* obj);
|
||||||
|
|
||||||
/// Appends the target array to our current array
|
/// Appends the target array to our current array
|
||||||
void append( ArrayObject *obj );
|
void append(ArrayObject* obj);
|
||||||
|
|
||||||
/// Sets the key at the given index
|
/// Sets the key at the given index
|
||||||
void setKey( const String &key, S32 index );
|
void setKey(const String& key, S32 index);
|
||||||
|
|
||||||
/// Sets the key at the given index
|
/// Sets the key at the given index
|
||||||
void setValue( const String &value, S32 index );
|
void setValue(const String& value, S32 index);
|
||||||
|
|
||||||
/// This sorts the array.
|
/// This sorts the array.
|
||||||
/// @param valtest Determines whether sorting by value or key.
|
/// @param valtest Determines whether sorting by value or key.
|
||||||
/// @param asc Determines if sorting ascending or descending.
|
/// @param asc Determines if sorting ascending or descending.
|
||||||
/// @param numeric Determines if sorting alpha or numeric search.
|
/// @param numeric Determines if sorting alpha or numeric search.
|
||||||
void sort( bool valtest, bool asc, bool numeric );
|
void sort(bool valtest, bool asc, bool numeric);
|
||||||
|
|
||||||
/// This sorts the array using a script callback.
|
/// This sorts the array using a script callback.
|
||||||
/// @param valtest Determines whether sorting by value or key.
|
/// @param valtest Determines whether sorting by value or key.
|
||||||
/// @param asc Determines if sorting ascending or descending.
|
/// @param asc Determines if sorting ascending or descending.
|
||||||
/// @param callbackFunctionName Name of the script function.
|
/// @param callbackFunctionName Name of the script function.
|
||||||
void sort( bool valtest, bool asc, const char* callbackFunctionName );
|
void sort(bool valtest, bool asc, const char* callbackFunctionName);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
@ -208,7 +212,7 @@ public:
|
||||||
S32 getCurrent() const { return mCurrentIndex; }
|
S32 getCurrent() const { return mCurrentIndex; }
|
||||||
|
|
||||||
///
|
///
|
||||||
void setCurrent( S32 idx );
|
void setCurrent(S32 idx);
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
|
|
@ -222,9 +226,9 @@ public:
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
// SimObject
|
// SimObject
|
||||||
DECLARE_CONOBJECT( ArrayObject );
|
DECLARE_CONOBJECT(ArrayObject);
|
||||||
DECLARE_CATEGORY( "Core" );
|
DECLARE_CATEGORY("Core");
|
||||||
DECLARE_DESCRIPTION( "An object storing an indexed sequence of key/value pairs." );
|
DECLARE_DESCRIPTION("An object storing an indexed sequence of key/value pairs.");
|
||||||
|
|
||||||
static void initPersistFields();
|
static void initPersistFields();
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue