Пример #1
0
void find_structs_callback(FcitxConfiguration* config,
                          const char* path,
                          void* userData)
{
    FCITX_UNUSED(config);
    if (strcmp(path, "DescriptionFile") == 0) {
        return;
    }
    FcitxDescription* desc = userData;
    fcitx_string_hashset_insert(desc->structs, path);
}
Пример #2
0
void test_string_hash_set()
{

    FcitxStringHashSet* sset = fcitx_string_hashset_parse("a,b,c,d", ',');
    assert(fcitx_dict_size(sset) == 4);
    assert(fcitx_string_hashset_contains(sset, "c"));
    assert(!fcitx_string_hashset_contains(sset, "e"));
    fcitx_string_hashset_remove(sset, "c");
    assert(!fcitx_string_hashset_contains(sset, "c"));
    fcitx_string_hashset_insert(sset, "e");
    assert(fcitx_string_hashset_contains(sset, "e"));

    /* uthash guarantee order, so we can sure about this */
    char* joined = fcitx_string_hashset_join(sset, ',');
    assert(strcmp(joined, "a,b,d,e") == 0);

    free(joined);

    fcitx_string_hashset_free(sset);
}