Skip to content

Commit

Permalink
Script API: changed Sorted/CaseSensitive props in containers to enums
Browse files Browse the repository at this point in the history
  • Loading branch information
ivan-mogilko committed Jun 4, 2019
1 parent 4d5923e commit f384e2c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 26 deletions.
12 changes: 6 additions & 6 deletions Editor/AGS.Editor/Resources/agsdefns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -489,9 +489,9 @@ builtin managed struct Dictionary
import bool Set(String key, String value);
/// Gets if this dictionary is case-sensitive.
import readonly attribute bool CaseSensitive;
/// Gets if this dictionary is sorted by keys in alphabetical order.
import readonly attribute bool Sorted;
import readonly attribute StringCompareStyle CompareStyle;
/// Gets the method items are arranged in this dictionary.
import readonly attribute SortStyle SortStyle;
/// Gets the number of key/value pairs currently in the dictionary.
import readonly attribute int ItemCount;
/// Creates a dynamic array filled with keys in same order as they are stored in the Dictionary.
Expand All @@ -515,9 +515,9 @@ builtin managed struct Set
import bool Remove(String item);
/// Gets if this set is case-sensitive.
import readonly attribute bool CaseSensitive;
/// Gets if this set is sorted in alphabetical order.
import readonly attribute bool Sorted;
import readonly attribute StringCompareStyle CompareStyle;
/// Gets the method items are arranged in this set.
import readonly attribute SortStyle SortStyle;
/// Gets the number of items currently in the set.
import readonly attribute int ItemCount;
/// Creates a dynamic array filled with items in same order as they are stored in the Set.
Expand Down
40 changes: 20 additions & 20 deletions Engine/ac/scriptcontainers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ bool Dict_Set(ScriptDictBase *dic, const char *key, const char *value)
return dic->Set(key, value);
}

bool Dict_GetCaseSensitive(ScriptDictBase *dic)
int Dict_GetCompareStyle(ScriptDictBase *dic)
{
return dic->IsCaseSensitive();
return dic->IsCaseSensitive() ? 1 : 0;
}

bool Dict_GetSorted(ScriptDictBase *dic)
int Dict_GetSortStyle(ScriptDictBase *dic)
{
return dic->IsSorted();
return dic->IsSorted() ? 1 : 0;
}

int Dict_GetItemCount(ScriptDictBase *dic)
Expand Down Expand Up @@ -159,14 +159,14 @@ RuntimeScriptValue Sc_Dict_Set(void *self, const RuntimeScriptValue *params, int
API_OBJCALL_BOOL_POBJ2(ScriptDictBase, Dict_Set, const char, const char);
}

RuntimeScriptValue Sc_Dict_GetCaseSensitive(void *self, const RuntimeScriptValue *params, int32_t param_count)
RuntimeScriptValue Sc_Dict_GetCompareStyle(void *self, const RuntimeScriptValue *params, int32_t param_count)
{
API_OBJCALL_BOOL(ScriptDictBase, Dict_GetCaseSensitive);
API_OBJCALL_INT(ScriptDictBase, Dict_GetCompareStyle);
}

RuntimeScriptValue Sc_Dict_GetSorted(void *self, const RuntimeScriptValue *params, int32_t param_count)
RuntimeScriptValue Sc_Dict_GetSortStyle(void *self, const RuntimeScriptValue *params, int32_t param_count)
{
API_OBJCALL_BOOL(ScriptDictBase, Dict_GetSorted);
API_OBJCALL_INT(ScriptDictBase, Dict_GetSortStyle);
}

RuntimeScriptValue Sc_Dict_GetItemCount(void *self, const RuntimeScriptValue *params, int32_t param_count)
Expand Down Expand Up @@ -250,14 +250,14 @@ bool Set_Remove(ScriptSetBase *set, const char *item)
return set->Remove(item);
}

bool Set_GetCaseSensitive(ScriptSetBase *set)
int Set_GetCompareStyle(ScriptSetBase *set)
{
return set->IsCaseSensitive();
return set->IsCaseSensitive() ? 1 : 0;
}

bool Set_GetSorted(ScriptSetBase *set)
int Set_GetSortStyle(ScriptSetBase *set)
{
return set->IsSorted();
return set->IsSorted() ? 1 : 0;
}

int Set_GetItemCount(ScriptSetBase *set)
Expand Down Expand Up @@ -298,14 +298,14 @@ RuntimeScriptValue Sc_Set_Remove(void *self, const RuntimeScriptValue *params, i
API_OBJCALL_BOOL_POBJ(ScriptSetBase, Set_Remove, const char);
}

RuntimeScriptValue Sc_Set_GetCaseSensitive(void *self, const RuntimeScriptValue *params, int32_t param_count)
RuntimeScriptValue Sc_Set_GetCompareStyle(void *self, const RuntimeScriptValue *params, int32_t param_count)
{
API_OBJCALL_BOOL(ScriptSetBase, Set_GetCaseSensitive);
API_OBJCALL_INT(ScriptSetBase, Set_GetCompareStyle);
}

RuntimeScriptValue Sc_Set_GetSorted(void *self, const RuntimeScriptValue *params, int32_t param_count)
RuntimeScriptValue Sc_Set_GetSortStyle(void *self, const RuntimeScriptValue *params, int32_t param_count)
{
API_OBJCALL_BOOL(ScriptSetBase, Set_GetSorted);
API_OBJCALL_INT(ScriptSetBase, Set_GetSortStyle);
}

RuntimeScriptValue Sc_Set_GetItemCount(void *self, const RuntimeScriptValue *params, int32_t param_count)
Expand All @@ -328,8 +328,8 @@ void RegisterContainerAPI()
ccAddExternalObjectFunction("Dictionary::Get", Sc_Dict_Get);
ccAddExternalObjectFunction("Dictionary::Remove", Sc_Dict_Remove);
ccAddExternalObjectFunction("Dictionary::Set", Sc_Dict_Set);
ccAddExternalObjectFunction("Dictionary::get_CaseSensitive", Sc_Dict_GetCaseSensitive);
ccAddExternalObjectFunction("Dictionary::get_Sorted", Sc_Dict_GetSorted);
ccAddExternalObjectFunction("Dictionary::get_CompareStyle", Sc_Dict_GetCompareStyle);
ccAddExternalObjectFunction("Dictionary::get_SortStyle", Sc_Dict_GetSortStyle);
ccAddExternalObjectFunction("Dictionary::get_ItemCount", Sc_Dict_GetItemCount);
ccAddExternalObjectFunction("Dictionary::GetKeysAsArray", Sc_Dict_GetKeysAsArray);
ccAddExternalObjectFunction("Dictionary::GetValuesAsArray", Sc_Dict_GetValuesAsArray);
Expand All @@ -339,8 +339,8 @@ void RegisterContainerAPI()
ccAddExternalObjectFunction("Set::Clear", Sc_Set_Clear);
ccAddExternalObjectFunction("Set::Contains", Sc_Set_Contains);
ccAddExternalObjectFunction("Set::Remove", Sc_Set_Remove);
ccAddExternalObjectFunction("Set::get_CaseSensitive", Sc_Set_GetCaseSensitive);
ccAddExternalObjectFunction("Set::get_Sorted", Sc_Set_GetSorted);
ccAddExternalObjectFunction("Set::get_CompareStyle", Sc_Set_GetCompareStyle);
ccAddExternalObjectFunction("Set::get_SortStyle", Sc_Set_GetSortStyle);
ccAddExternalObjectFunction("Set::get_ItemCount", Sc_Set_GetItemCount);
ccAddExternalObjectFunction("Set::GetItemsAsArray", Sc_Set_GetItemAsArray);
}

0 comments on commit f384e2c

Please sign in to comment.