diff options
author | Ralph Amissah <ralph@amissah.com> | 2015-09-30 13:07:43 -0400 |
---|---|---|
committer | Ralph Amissah <ralph@amissah.com> | 2015-09-30 13:12:21 -0400 |
commit | 45e96028ce7696381aca7f155c21b0b718b6a610 (patch) | |
tree | eefcf5737cffc0d457bc433cd41ba21579076ff2 /lib/sdp/ao_object_setter.d |
sdp, abstract objects, a start
Diffstat (limited to 'lib/sdp/ao_object_setter.d')
-rw-r--r-- | lib/sdp/ao_object_setter.d | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/lib/sdp/ao_object_setter.d b/lib/sdp/ao_object_setter.d new file mode 100644 index 0000000..050b606 --- /dev/null +++ b/lib/sdp/ao_object_setter.d @@ -0,0 +1,90 @@ +/* +#+OPTIONS: ^:nil _:nil#+OPTIONS: ^:nil _:nil +* sisu_setter.d +*/ +mixin template ObjectSetters() { + class ObjectAbstractSet { + import std.conv : to; + string[string] contents_comment(in string object) { + string object_set[string]; + object_set["use"] = "comment"; + object_set["of"] = "comment"; + object_set["is"] = "comment"; + object_set["obj"] = object; + return object_set; + } + string[string] contents_heading( + in int type, + in string object, + in string attrib, + in int ocn, + in string lev, + in string lvn, + in string lcn, + ) { + string object_set[string]; + object_set["use"] = "content"; + object_set["of"] = "para"; + object_set["is"] = "heading"; + object_set["type"] = to!string(type); + object_set["obj"] = object; + object_set["ocn"] = (ocn==0) ? "" : to!string(ocn); + object_set["lev"] = to!string(lev); + object_set["lvn"] = to!string(lvn); + object_set["lcn"] = to!string(lcn); + object_set["attrib"] = attrib; + return object_set; + } + string[string] contents_para( + in string type, + in string object, + in string attrib, + in int ocn, + in string indent_first, + in string indent_second, + in bool bullet + ) { + string object_set[string]; + object_set["use"] = "content"; + object_set["of"] = "para"; + object_set["is"] = type; + object_set["obj"] = object; + object_set["ocn"] = (ocn==0) ? "" : to!string(ocn); + object_set["indent_first"] = indent_first; + object_set["indent_second"] = indent_second; + object_set["bullet"] = to!string(bullet); + object_set["attrib"] = attrib; + return object_set; + } + string[string] contents_block( + in string type, + in string object, + in string attrib, + in int ocn + ) { + string object_set[string]; + object_set["use"] = "content"; + object_set["of"] = "block"; + object_set["is"] = type; + object_set["obj"] = object; + object_set["ocn"] = (ocn==0) ? "" : to!string(ocn); + object_set["attrib"] = attrib; + return object_set; + } + string[string] contents_block_ocn_string( + in string type, + in string object, + in string ocn, + in string node + ) { + string object_set[string]; + object_set["use"] = "content"; + object_set["of"] = "block"; + object_set["is"] = type; + object_set["obj"] = object; + object_set["ocn"] = ocn; + object_set["node"] = node; + return object_set; + } + } +} |