/* * TODO: Can DefaultTRE use these now that they're not private? * */ NITFAPI(nitf_List*) nitf_TREUtils_basicFind(nitf_TRE* tre, const char* pattern, nitf_Error* error) { nitf_List* list; nitf_HashTableIterator it = nitf_HashTable_begin( ((nitf_TREPrivateData*)tre->priv)->hash); nitf_HashTableIterator end = nitf_HashTable_end( ((nitf_TREPrivateData*)tre->priv)->hash); list = nitf_List_construct(error); if (!list) return NULL; while (nitf_HashTableIterator_notEqualTo(&it, &end)) { nitf_Pair* pair = nitf_HashTableIterator_get(&it); if (strstr(pair->key, pattern)) { /* Should check this, I suppose */ nitf_List_pushBack(list, pair, error); } nitf_HashTableIterator_increment(&it); } return list; }
NITFPRIV(NITF_BOOL) insertPlugin(nitf_PluginRegistry * reg, const char **ident, nitf_DLL * dll, nitf_Error * error) { nitf_HashTable *hash = NULL; int i; int ok; const char* suffix = NULL; /* Load the DLL */ if (!nitf_List_pushBack(reg->dsos, dll, error)) { return NITF_FAILURE; } if (strcmp(ident[0], NITF_PLUGIN_TRE_KEY) == 0) { hash = reg->treHandlers; suffix = NITF_PLUGIN_HOOK_SUFFIX; } else if (strcmp(ident[0], NITF_PLUGIN_COMPRESSION_KEY) == 0) { hash = reg->compressionHandlers; suffix = NITF_PLUGIN_CONSTRUCT_SUFFIX; } else if (strcmp(ident[0], NITF_PLUGIN_DECOMPRESSION_KEY) == 0) { hash = reg->decompressionHandlers; suffix = NITF_PLUGIN_CONSTRUCT_SUFFIX; } else { nitf_Error_initf(error, NITF_CTXT, NITF_ERR_INVALID_OBJECT, "The identity [%s] is not supported", ident[0]); return NITF_FAILURE; } /* Go through each identity and add it as a creator */ for (i = 1;; i++) { const char *key = ident[i]; if (key == NULL) break; /* no more */ ok = insertCreator(dll, hash, key, suffix, error); if (!ok) { return NITF_FAILURE; } } return NITF_SUCCESS; }
NITFAPI(NITF_BOOL) cgm_PolyLineElement_addVertex(cgm_PolyLineElement *poly, cgm_Vertex *vertex, nitf_Error* error) { return nitf_List_pushBack(poly->vertices, vertex, error); }