summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-02-15 18:18:54 +0100
committernsensfel <SpamShield0@noot-noot.org>2019-02-15 18:18:54 +0100
commit85b1e04a22e7564b702aa27c5f6467ad4d5f4416 (patch)
treed0a408eb97412feccdbcfe20b951669b6f6e6588 /src/shared/struct/inventory/shr_portrait.erl.m4
parent9b91ff37a1e39f48631b5bee338c31318d1e2336 (diff)
Re-organizing shr_ structs.
Diffstat (limited to 'src/shared/struct/inventory/shr_portrait.erl.m4')
-rw-r--r--src/shared/struct/inventory/shr_portrait.erl.m473
1 files changed, 73 insertions, 0 deletions
diff --git a/src/shared/struct/inventory/shr_portrait.erl.m4 b/src/shared/struct/inventory/shr_portrait.erl.m4
new file mode 100644
index 0000000..fefc434
--- /dev/null
+++ b/src/shared/struct/inventory/shr_portrait.erl.m4
@@ -0,0 +1,73 @@
+-module(shr_portrait).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-type id() :: binary().
+
+-record
+(
+ portrait,
+ {
+ id :: id(),
+ name :: binary(),
+ body_id :: binary(),
+ icon_id :: binary()
+ }
+).
+
+-opaque type() :: #portrait{}.
+
+-export_type([type/0, id/0]).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% Accessors
+-export
+(
+ [
+ get_id/1,
+ get_name/1,
+ get_body_id/1,
+ get_icon_id/1
+ ]
+).
+
+-export
+(
+ [
+ from_id/1,
+ default/0
+ ]
+).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%% Accessors
+-spec get_id (type()) -> id().
+get_id (Pt) -> Pt#portrait.id.
+
+-spec get_name (type()) -> binary().
+get_name (Pt) -> Pt#portrait.name.
+
+-spec get_body_id (type()) -> binary().
+get_body_id (Pt) -> Pt#portrait.body_id.
+
+-spec get_icon_id (type()) -> binary().
+get_icon_id (Pt) -> Pt#portrait.icon_id.
+
+-spec from_id (id()) -> type().
+m4_include(__MAKEFILE_DATA_DIR/portrait/global.m4.conf)m4_dnl
+m4_include(__MAKEFILE_DATA_DIR/portrait/basic.m4d)m4_dnl
+from_id(_) ->
+ default().
+
+-spec default () -> type().
+default () -> from_id(<<"cat">>).