summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2019-02-15 18:18:54 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2019-02-15 18:18:54 +0100 |
commit | 85b1e04a22e7564b702aa27c5f6467ad4d5f4416 (patch) | |
tree | d0a408eb97412feccdbcfe20b951669b6f6e6588 /src/shared/struct/map/shr_map_marker.erl | |
parent | 9b91ff37a1e39f48631b5bee338c31318d1e2336 (diff) |
Re-organizing shr_ structs.
Diffstat (limited to 'src/shared/struct/map/shr_map_marker.erl')
-rw-r--r-- | src/shared/struct/map/shr_map_marker.erl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/shared/struct/map/shr_map_marker.erl b/src/shared/struct/map/shr_map_marker.erl new file mode 100644 index 0000000..35ba195 --- /dev/null +++ b/src/shared/struct/map/shr_map_marker.erl @@ -0,0 +1,52 @@ +-module(shr_map_marker). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-type name() :: binary(). +-type type() :: 'none'. +-type collection() :: orddict:orddict(name(), type()). + +-export_type([name/0, type/0, collection/0]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export +( + [ + get/2, + empty_collection/0 + ] +). + +-export +( + [ + decode_collection/1, + encode_collection/1 + ] +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec get (name(), collection()) -> ('not_found' | {'ok', type()}). +get (Name, Collection) -> + case orddict:find(Name, Collection) of + error -> not_found; + Other -> Other + end. + +-spec empty_collection () -> collection(). +empty_collection () -> orddict:new(). + +-spec encode_collection (collection()) -> list(any()). +encode_collection (_Collection) -> []. + +-spec decode_collection (map()) -> collection(). +decode_collection (_Map) -> orddict:new(). |