From 765e46dba87a3fa7070ef7fb70d9be76e1d7a47b Mon Sep 17 00:00:00 2001 From: Tyge Løvset Date: Sat, 6 Feb 2021 23:11:03 +0100 Subject: Updated csmap.h to match api of cmap. Updated docs. --- docs/cmap_api.md | 22 ++++++++++------------ docs/cset_api.md | 17 ++++++++--------- docs/csmap_api.md | 20 +++++++++----------- docs/csset_api.md | 11 +++++------ 4 files changed, 32 insertions(+), 38 deletions(-) (limited to 'docs') diff --git a/docs/cmap_api.md b/docs/cmap_api.md index c57dc38f..a9bc9b3a 100644 --- a/docs/cmap_api.md +++ b/docs/cmap_api.md @@ -61,27 +61,25 @@ void cmap_X_swap(cmap_X* a, cmap_X* b); void cmap_X_del(cmap_X* self); -bool cmap_X_empty(cmap_X m); -size_t cmap_X_size(cmap_X m); -size_t cmap_X_bucket_count(cmap_X m); // num. of allocated buckets -size_t cmap_X_capacity(cmap_X m); // buckets * max_load_factor +bool cmap_X_empty(cmap_X map); +size_t cmap_X_size(cmap_X map); +size_t cmap_X_capacity(cmap_X map); // buckets * max_load_factor +size_t cmap_X_bucket_count(cmap_X map); // num. of allocated buckets -void cmap_X_push_n(cmap_X* self, const cmap_X_rawvalue_t arr[], size_t size); +cmap_X_iter_t cmap_X_find(const cmap_X* self, RawKey rkey); +bool cmap_X_contains(const cmap_X* self, RawKey rkey); +void cmap_X_push_n(cmap_X* self, const cmap_X_rawvalue_t arr[], size_t size); +cmap_X_result_t cmap_X_put(cmap_X* self, RawKey rkey, RawMapped rmapped); cmap_X_result_t cmap_X_emplace(cmap_X* self, RawKey rkey, RawMapped rmapped); // no change if rkey in map -cmap_X_result_t cmap_X_insert(cmap_X* self, cmap_X_rawvalue_t rval); // same, but takes rawvalue param -cmap_X_result_t cmap_X_insert_or_assign(cmap_X* self, RawKey rkey, RawMapped rmapped); -cmap_X_result_t cmap_X_put(cmap_X* self, RawKey rkey, RawMapped rmapped); // same as insert_or_assign() -cmap_X_result_t cmap_X_put_mapped(cmap_X* self, RawKey rkey, Mapped mapped); // same, but takes Mapped param +cmap_X_result_t cmap_X_insert(cmap_X* self, cmap_X_value_t val); // like emplace. +cmap_X_result_t cmap_X_insert_or_assign(cmap_X* self, Key key, Mapped mapped); // like put cmap_X_mapped_t* cmap_X_at(const cmap_X* self, RawKey rkey); // rkey must be in map size_t cmap_X_erase(cmap_X* self, RawKey rkey); void cmap_X_erase_entry(cmap_X* self, cmap_X_value_t* entry); cmap_X_iter_t cmap_X_erase_at(cmap_X* self, cmap_X_iter_t pos); -cmap_X_iter_t cmap_X_find(const cmap_X* self, RawKey rkey); -bool cmap_X_contains(const cmap_X* self, RawKey rkey); - cmap_X_iter_t cmap_X_begin(cmap_X* self); cmap_X_iter_t cmap_X_end(cmap_X* self); void cmap_X_next(cmap_X_iter_t* it); diff --git a/docs/cset_api.md b/docs/cset_api.md index 949171e9..03a0e765 100644 --- a/docs/cset_api.md +++ b/docs/cset_api.md @@ -43,23 +43,22 @@ void cset_X_swap(cset_X* a, cset_X* b); void cset_X_del(cset_X* self); -bool cset_X_empty(cset_X m); -size_t cset_X_size(cset_X m); -size_t cset_X_bucket_count(cset_X m); -size_t cset_X_capacity(cset_X m); +bool cset_X_empty(cset_X set); +size_t cset_X_size(cset_X set); +size_t cset_X_bucket_count(cset_X set); +size_t cset_X_capacity(cset_X set); -void cset_X_push_n(cset_X* self, const RawKey arr[], size_t size); +cset_X_iter_t cset_X_find(const cset_X* self, RawKey rkey); +bool cset_X_contains(const cset_X* self, RawKey rkey); +void cset_X_push_n(cset_X* self, const RawKey arr[], size_t size); cset_X_result_t cset_X_emplace(cset_X* self, RawKey rkey); -cset_X_result_t cset_X_insert(cset_X* self, RawKey rkey); +cset_X_result_t cset_X_insert(cset_X* self, Key key); size_t cset_X_erase(cset_X* self, RawKey rkey); void cset_X_erase_entry(cset_X* self, cset_X_key_t* key); cset_X_iter_t cset_X_erase_at(cset_X* self, cset_X_iter_t pos); -cset_X_iter_t cset_X_find(const cset_X* self, RawKey rkey); -bool cset_X_contains(const cset_X* self, RawKey rkey); - cset_X_iter_t cset_X_begin(cset_X* self); cset_X_iter_t cset_X_end(cset_X* self); void cset_X_next(cset_X_iter_t* it); diff --git a/docs/csmap_api.md b/docs/csmap_api.md index 8400f044..45ce8fee 100644 --- a/docs/csmap_api.md +++ b/docs/csmap_api.md @@ -53,25 +53,23 @@ void csmap_X_clear(csmap_X* self); void csmap_X_swap(csmap_X* a, csmap_X* b); void csmap_X_del(csmap_X* self); -bool csmap_X_empty(csmap_X m); -size_t csmap_X_size(csmap_X m); +bool csmap_X_empty(csmap_X map); +size_t csmap_X_size(csmap_X map); -void csmap_X_push_n(csmap_X* self, const csmap_X_rawvalue_t arr[], size_t size); +csmap_X_iter_t csmap_X_find(const csmap_X* self, RawKey rkey); +csmap_X_value_t* csmap_X_find_it(const csmap_X* self, RawKey rkey, csmap_X_iter_t* out); // return NULL if not found +bool csmap_X_contains(const csmap_X* self, RawKey rkey); +void csmap_X_push_n(csmap_X* self, const csmap_X_rawvalue_t arr[], size_t size); +csmap_X_result_t csmap_X_put(csmap_X* self, RawKey rkey, RawMapped rmapped); // like std::map::operator[] csmap_X_result_t csmap_X_emplace(csmap_X* self, RawKey rkey, RawMapped rmapped); // no change if rkey in map -csmap_X_result_t csmap_X_insert(csmap_X* self, csmap_X_rawvalue_t rval); // same, just different param -csmap_X_result_t csmap_X_insert_or_assign(csmap_X* self, RawKey rkey, RawMapped rmapped); -csmap_X_result_t csmap_X_put(csmap_X* self, RawKey rkey, RawMapped rmapped); // same as insert_or_assign() -csmap_X_result_t csmap_X_put_mapped(csmap_X* self, RawKey rkey, Mapped mapped); // same, different param +csmap_X_result_t csmap_X_insert(csmap_X* self, csmap_X_value_t val); // like emplace +csmap_X_result_t csmap_X_insert_or_assign(csmap_X* self, Key key, Mapped mapped); // like put csmap_X_mapped_t* csmap_X_at(const csmap_X* self, RawKey rkey); // rkey must be in map. size_t csmap_X_erase(csmap_X* self, RawKey rkey); csmap_X_iter_t csmap_X_erase_at(csmap_X* self, csmap_X_iter_t pos); -csmap_X_iter_t csmap_X_find(const csmap_X* self, RawKey rkey); -csmap_X_value_t* csmap_X_find_it(const csmap_X* self, RawKey rkey, csmap_X_iter_t* out); // return NULL if not found -bool csmap_X_contains(const csmap_X* self, RawKey rkey); - csmap_X_iter_t csmap_X_begin(csmap_X* self); csmap_X_iter_t csmap_X_end(csmap_X* self); void csmap_X_next(csmap_X_iter_t* it); diff --git a/docs/csset_api.md b/docs/csset_api.md index af276532..33eecd1b 100644 --- a/docs/csset_api.md +++ b/docs/csset_api.md @@ -41,18 +41,17 @@ void csset_X_del(csset_X* self); bool csset_X_empty(csset_X m); size_t csset_X_size(csset_X m); -void csset_X_push_n(csset_X* self, const RawKey arr[], size_t size); +csset_X_iter_t csset_X_find(const csset_X* self, RawKey rkey); +csset_X_value_t* csset_X_find_it(const csset_X* self, RawKey rkey, csset_X_iter_t* out); +bool csset_X_contains(const csset_X* self, RawKey rkey); +void csset_X_push_n(csset_X* self, const RawKey arr[], size_t size); csset_X_result_t csset_X_emplace(csset_X* self, RawKey rkey); -csset_X_result_t csset_X_insert(csset_X* self, RawKey rkey); +csset_X_result_t csset_X_insert(csset_X* self, Key key); size_t csset_X_erase(csset_X* self, RawKey rkey); csset_X_iter_t csset_X_erase_at(csset_X* self, csset_X_iter_t pos); -csset_X_iter_t csset_X_find(const csset_X* self, RawKey rkey); -csset_X_value_t* csset_X_find_it(const csset_X* self, RawKey rkey, csset_X_iter_t* out); -bool csset_X_contains(const csset_X* self, RawKey rkey); - csset_X_iter_t csset_X_begin(csset_X* self); csset_X_iter_t csset_X_end(csset_X* self); void csset_X_next(csset_X_iter_t* it); -- cgit v1.2.3