2016-10-31 21:04:15 +03:00
|
|
|
//- 💫 DOCS > API > STRINGSTORE
|
|
|
|
|
|
|
|
include ../../_includes/_mixins
|
|
|
|
|
|
|
|
p Map strings to and from integer IDs.
|
|
|
|
|
|
|
|
+h(2, "init") StringStore.__init__
|
|
|
|
+tag method
|
|
|
|
|
|
|
|
p Create the #[code StringStore].
|
|
|
|
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
|
|
+row
|
|
|
|
+cell #[code strings]
|
|
|
|
+cell -
|
|
|
|
+cell A sequence of unicode strings to add to the store.
|
|
|
|
|
|
|
|
+footrow
|
2017-05-19 01:02:34 +03:00
|
|
|
+cell returns
|
2016-10-31 21:04:15 +03:00
|
|
|
+cell #[code StringStore]
|
|
|
|
+cell The newly constructed object.
|
|
|
|
|
|
|
|
+h(2, "len") StringStore.__len__
|
|
|
|
+tag method
|
|
|
|
|
|
|
|
p Get the number of strings in the store.
|
|
|
|
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
|
|
+footrow
|
2017-05-19 01:02:34 +03:00
|
|
|
+cell returns
|
2016-10-31 21:04:15 +03:00
|
|
|
+cell int
|
|
|
|
+cell The number of strings in the store.
|
|
|
|
|
|
|
|
+h(2, "getitem") StringStore.__getitem__
|
|
|
|
+tag method
|
|
|
|
|
|
|
|
p Retrieve a string from a given integer ID, or vice versa.
|
|
|
|
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
|
|
+row
|
|
|
|
+cell #[code string_or_id]
|
|
|
|
+cell bytes / unicode / int
|
|
|
|
+cell The value to encode.
|
|
|
|
|
|
|
|
+footrow
|
2017-05-19 01:02:34 +03:00
|
|
|
+cell returns
|
2016-10-31 21:04:15 +03:00
|
|
|
+cell unicode / int
|
|
|
|
+cell The value to retrieved.
|
|
|
|
|
|
|
|
+h(2, "contains") StringStore.__contains__
|
|
|
|
+tag method
|
|
|
|
|
|
|
|
p Check whether a string is in the store.
|
|
|
|
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
|
|
+row
|
|
|
|
+cell #[code string]
|
|
|
|
+cell unicode
|
|
|
|
+cell The string to check.
|
|
|
|
|
|
|
|
+footrow
|
2017-05-19 01:02:34 +03:00
|
|
|
+cell returns
|
2016-10-31 21:04:15 +03:00
|
|
|
+cell bool
|
|
|
|
+cell Whether the store contains the string.
|
|
|
|
|
|
|
|
+h(2, "iter") StringStore.__iter__
|
|
|
|
+tag method
|
|
|
|
|
|
|
|
p Iterate over the strings in the store, in order.
|
|
|
|
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
|
|
+footrow
|
2017-05-19 01:02:34 +03:00
|
|
|
+cell yields
|
2016-10-31 21:04:15 +03:00
|
|
|
+cell unicode
|
|
|
|
+cell A string in the store.
|
|
|
|
|
|
|
|
+h(2, "dump") StringStore.dump
|
|
|
|
+tag method
|
|
|
|
|
|
|
|
p Save the strings to a JSON file.
|
|
|
|
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
|
|
+row
|
|
|
|
+cell #[code file]
|
|
|
|
+cell buffer
|
|
|
|
+cell The file to save the strings.
|
|
|
|
|
|
|
|
+footrow
|
2017-05-19 01:02:34 +03:00
|
|
|
+cell returns
|
2016-10-31 21:04:15 +03:00
|
|
|
+cell #[code None]
|
|
|
|
+cell -
|
|
|
|
|
|
|
|
+h(2, "load") StringStore.load
|
|
|
|
+tag method
|
|
|
|
|
|
|
|
p Load the strings from a JSON file.
|
|
|
|
|
|
|
|
+table(["Name", "Type", "Description"])
|
|
|
|
+row
|
|
|
|
+cell #[code file]
|
|
|
|
+cell buffer
|
|
|
|
+cell The file from which to load the strings.
|
|
|
|
|
|
|
|
+footrow
|
2017-05-19 01:02:34 +03:00
|
|
|
+cell returns
|
2016-10-31 21:04:15 +03:00
|
|
|
+cell #[code None]
|
|
|
|
+cell -
|