add a StringTable.clear that requires no mode specification (#12853)

* add clear overload, test, changelog

* add since annotation
This commit is contained in:
Andy Davidoff 2019-12-09 00:58:36 -05:00 • committed by Andreas Rumpf
commit a3d45d0c1b
3 changed files with 9 additions and 1 deletions

View file

@ -308,7 +308,7 @@ proc getValue(t: StringTableRef, flags: set[FormatFlag], key: string): string =
proc clear*(s: StringTableRef, mode: StringTableMode) {.
rtlFunc, extern: "nst$1".} =
## Resets a string table to be empty again.
## Resets a string table to be empty again, perhaps altering the mode.
##
## See also:
## * `del proc <#del,StringTableRef,string>`_ for removing a key from the table
@ -324,6 +324,10 @@ proc clear*(s: StringTableRef, mode: StringTableMode) {.
for i in 0..<s.data.len:
s.data[i].hasValue = false
proc clear*(s: StringTableRef) {.since: (1, 1).} =
## Resets a string table to be empty again without changing the mode.
s.clear(s.mode)
proc del*(t: StringTableRef, key: string) =
## Removes `key` from `t`.
##