aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sdp/ao_object_setter.d
blob: f2abd7fb52c345e2cf0b1e5c724c1bdbbd261cfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
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[string] object_set;
      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[string] object_set;
      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[string] object_set;
      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[string] object_set;
      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[string] object_set;
      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;
    }
  }
}