diff options
Diffstat (limited to 'lib/sdp/ao_object_setter.d')
-rw-r--r-- | lib/sdp/ao_object_setter.d | 138 |
1 files changed, 84 insertions, 54 deletions
diff --git a/lib/sdp/ao_object_setter.d b/lib/sdp/ao_object_setter.d index a44aeb0..4492e8a 100644 --- a/lib/sdp/ao_object_setter.d +++ b/lib/sdp/ao_object_setter.d @@ -3,42 +3,74 @@ ao_object_setter.d +/ template ObjectSetter() { + /+ structs +/ + struct HeadingAttrib { + int lev = 9; // use of enum should make this redundant, remove + int lev_markup_number = 9; + int lev_collapsed_number = 9; + } + struct ParaAttrib { + int indent_first = 0; + int indent_second = 0; + bool bullet = false; + } + struct BlockAttrib { + } + struct Comment { + // no .attrib and no .obj_cite_number + } + struct Node { + int ocn = 0; + int parent_lev = 0; + int parent_ocn = 0; + string node = ""; + } + struct ObjComposite { + // size_t id; + string use = ""; + string of = ""; + string is_a = ""; + string object = ""; + string obj_cite_number = ""; // not used for calculations? output only? else int + HeadingAttrib heading_attrib; + ParaAttrib para_attrib; + BlockAttrib block_attrib; + Node node_structure; + } + struct ObjCompositeArr { + ObjComposite[] oca; + } + + /+ structs setter +/ struct ObjectAbstractSet { import std.conv : to; - string[string] contents_comment(in string object) { - string[string] object_set; - object_set["use"] = "comment"; - object_set["of"] = "comment"; - object_set["is"] = "comment"; - object_set["obj"] = object; - // object_set["attrib"] = attrib; + auto contents_comment(in string object) { + ObjComposite object_set; + object_set.use = "comment"; + object_set.of = "comment"; + object_set.is_a = "comment"; + object_set.object = object; return object_set; } - string[string] contents_heading( - in int type, + auto contents_heading( in string object, in string attrib, in int obj_cite_number, - in string lev, - in string lev_markup_number, - in string lev_collapsed_number, + in int lev_markup_number, + in int lev_collapsed_number, ) { - string[string] object_set; - object_set["use"] = "content"; - object_set["of"] = "para"; - object_set["is"] = "heading"; - object_set["type"] = to!string(type); - // object_set["is"] = type; // "heading" "heading_dummy" - object_set["obj"] = object; - object_set["obj_cite_number"] = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set["lev"] = to!string(lev); - object_set["lev_markup_number"] = to!string(lev_markup_number); - object_set["lev_collapsed_number"] = to!string(lev_collapsed_number); - object_set["attrib"] = attrib; - // object_set["children"] = children; + ObjComposite object_set; + object_set.use = "content"; + object_set.of = "para"; + object_set.is_a = "heading"; + object_set.object = object; + object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + object_set.heading_attrib.lev_markup_number = lev_markup_number; + object_set.heading_attrib.lev_collapsed_number = lev_collapsed_number; + // object_set.node_structure.node = node; return object_set; } - string[string] contents_para( + auto contents_para( in string is_a, in string object, in string attrib, @@ -46,48 +78,46 @@ template ObjectSetter() { in string[string] indent, in bool bullet ) { - string[string] object_set; - object_set["use"] = "content"; - object_set["of"] = "para"; - object_set["is"] = is_a; - // object_set["status"] = status; - object_set["obj"] = object; - object_set["obj_cite_number"] = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set["indent_first"] = indent["first"]; - object_set["indent_second"] = indent["second"]; - object_set["bullet"] = to!string(bullet); - object_set["attrib"] = attrib; + ObjComposite object_set; + object_set.use = "content"; + object_set.of = "para"; + object_set.is_a = "para"; + object_set.object = object; + object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + object_set.para_attrib.indent_first = 0; // indent["first"]; + object_set.para_attrib.indent_second = 0; // indent["second"]; + object_set.para_attrib.bullet = false; + // object_set.node_structure.node = node; return object_set; } - string[string] contents_block( + auto contents_block( in string type, in string object, in string attrib, in int obj_cite_number ) { - string[string] object_set; - object_set["use"] = "content"; - object_set["of"] = "block"; - object_set["is"] = type; - object_set["obj"] = object; - object_set["obj_cite_number"] = (obj_cite_number==0) ? "" : to!string(obj_cite_number); - object_set["attrib"] = attrib; + ObjComposite object_set; + object_set.use = "content"; + object_set.of = "block"; + object_set.is_a = type; + object_set.object = object; + object_set.obj_cite_number = (obj_cite_number==0) ? "" : to!string(obj_cite_number); + // object_set.node_structure.node = node; return object_set; } - string[string] contents_block_obj_cite_number_string( + auto contents_block_obj_cite_number_string( in string type, in string object, in string obj_cite_number, in string node ) { - string[string] object_set; - object_set["use"] = "content"; - object_set["of"] = "block"; - object_set["is"] = type; - object_set["obj"] = object; - object_set["obj_cite_number"] = obj_cite_number; - object_set["node"] = node; - // object_set["attrib"] = ""; + ObjComposite object_set; + object_set.use = "content"; + object_set.of = "block"; + object_set.is_a = type; + object_set.object = object; + object_set.obj_cite_number = obj_cite_number; + object_set.node_structure.node = node; return object_set; } } |