Commit 964d7889 authored by Ryan Berkheimer's avatar Ryan Berkheimer

add methods for map item addition/access to the ListUtils class

parent 854f7013
Pipeline #5771 failed with stages
in 0 seconds
...@@ -90,6 +90,14 @@ struct val_list *ListUtils::getListItem(struct val_list *list, int index) ...@@ -90,6 +90,14 @@ struct val_list *ListUtils::getListItem(struct val_list *list, int index)
return valueList; return valueList;
} }
struct val_map *ListUtils::getMapItem(struct val_list *list, int index)
{
jobject mapItem = this->getObjectItem(list, index);
struct val_map *valMap = (struct val_map *)malloc(sizeof(struct val_map));
valMap->jmap = mapItem;
return valMap;
}
int ListUtils::getIntItem(struct val_list *list, int index) int ListUtils::getIntItem(struct val_list *list, int index)
{ {
jobject list_item = this->getObjectItem(list, index); jobject list_item = this->getObjectItem(list, index);
...@@ -236,6 +244,12 @@ void ListUtils::addListItem(struct val_list *list, struct val_list *val) ...@@ -236,6 +244,12 @@ void ListUtils::addListItem(struct val_list *list, struct val_list *val)
list->count += 1; list->count += 1;
} }
void ListUtils::addMapItem(struct val_list *list, struct val_map *val)
{
this->jvm->CallVoidMethod(list->jlist, this->addListItemMethod(), val->jmap);
list->count += 1;
}
struct string_list *ListUtils::translateStringList(jobject jList) struct string_list *ListUtils::translateStringList(jobject jList)
{ {
int stringCount = this->getListLength(jList); int stringCount = this->getListLength(jList);
......
...@@ -43,6 +43,7 @@ public: ...@@ -43,6 +43,7 @@ public:
bool getBoolItem(struct val_list *list, int index); bool getBoolItem(struct val_list *list, int index);
short getShortItem(struct val_list *list, int index); short getShortItem(struct val_list *list, int index);
struct val_list *getListItem(struct val_list *list, int index); struct val_list *getListItem(struct val_list *list, int index);
struct val_map *getMapItem(struct val_list *list, int index);
/*List Item Insertion Methods*/ /*List Item Insertion Methods*/
void addItem(struct val_list *list, struct list_item *item); void addItem(struct val_list *list, struct list_item *item);
...@@ -56,6 +57,7 @@ public: ...@@ -56,6 +57,7 @@ public:
void addBoolItem(struct val_list *list, bool val); void addBoolItem(struct val_list *list, bool val);
void addShortItem(struct val_list *list, short val); void addShortItem(struct val_list *list, short val);
void addListItem(struct val_list *list, struct val_list *val); void addListItem(struct val_list *list, struct val_list *val);
void addMapItem(struct val_list *list, struct val_map *map);
jmethodID createListMethod(); jmethodID createListMethod();
jmethodID getListSizeMethod(); jmethodID getListSizeMethod();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment