Use a list attribute name as model category

This commit is contained in:
Raphael Coeffic
2021-11-10 11:06:59 +01:00
parent 9436e171a7
commit e1736294c8
2 changed files with 8 additions and 5 deletions
+6 -4
View File
@@ -89,6 +89,12 @@ static bool find_node(void* ctx, char* buf, uint8_t len)
memcpy(mi->current_attr, buf, len);
mi->current_attr[len] = '\0';
list<ModelsCategory *>& cats = mi->root->getCategories();
if (mi->level == modelslist_iter::Category) {
ModelsCategory* cat = new ModelsCategory(buf,len);
cats.push_back(cat);
}
return true;
}
@@ -97,10 +103,6 @@ static void set_attr(void* ctx, char* buf, uint8_t len)
modelslist_iter* mi = (modelslist_iter*)ctx;
list<ModelsCategory *>& cats = mi->root->getCategories();
switch(mi->level) {
case modelslist_iter::Category: {
ModelsCategory* cat = new ModelsCategory(buf,len);
cats.push_back(cat);
} break;
case modelslist_iter::Model:
if (!strcmp(mi->current_attr,"filename")) {