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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
|
#+TITLE: sdp object setter
#+AUTHOR: Ralph Amissah
#+EMAIL: ralph.amissah@gmail.com
#+STARTUP: indent
#+LANGUAGE: en
#+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:nil _:nil -:t f:t *:t <:t
#+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
#+OPTIONS: author:nil email:nil creator:nil timestamp:nil
#+PROPERTY: header-args :padline no :exports code :noweb yes
#+EXPORT_SELECT_TAGS: export
#+EXPORT_EXCLUDE_TAGS: noexport
#+FILETAGS: :sdp:rel:ao:
#+TAGS: assert(a) class(c) debug(d) mixin(m) sdp(s) tangle(T) template(t) WEB(W) noexport(n)
* object setter :object:set:
[[./sdp.org][sdp]] [[./][org/]]
** struct :struct:
#+name: ao_object_setter
#+BEGIN_SRC d
mixin Structs;
#+END_SRC
** comment :comment:
#+name: ao_object_setter
#+BEGIN_SRC d
ObjComposite contents_comment_new(in string object) {
ObjComposite object_set;
object_set.use = "comment";
object_set.of = "comment";
object_set.is_a = "comment";
object_set.object = object;
// does not have .attrib;
// does not have .ocn
return object_set;
}
#+END_SRC
#+name: ao_object_setter
#+BEGIN_SRC d
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;
}
#+END_SRC
** heading :heading:
#+name: ao_object_setter
#+BEGIN_SRC d
ObjComposite contents_heading_new(
in int type,
in string object,
in string attrib,
in int ocn,
in string lev,
in string lvn,
in string lcn,
) {
ObjComposite object_set;
object_set.use = "content";
object_set.of = "para";
object_set.is_a = "heading";
object_set.object = object;
object_set.ocn = (ocn==0) ? "" : to!string(ocn);
object_set.attrib = attrib;
object_set.heading.type = to!string(type);
object_set.heading.lev = to!string(lev);
object_set.heading.lvn = to!string(lvn);
object_set.heading.lcn = to!string(lcn);
return object_set;
}
#+END_SRC
#+name: ao_object_setter
#+BEGIN_SRC d
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;
}
#+END_SRC
** para :para:
#+name: ao_object_setter
#+BEGIN_SRC d
ObjComposite contents_para_new(
in string is_a,
in string object,
in string attrib,
in int ocn,
in string indent_first,
in string indent_second,
in bool bullet
) {
ObjComposite object_set;
object_set.use = "content";
object_set.of = "para";
object_set.is_a = "heading";
object_set.object = object;
object_set.ocn = (ocn==0) ? "" : to!string(ocn);
object_set.attrib = attrib;
object_set.para.indent_first = indent_first;
object_set.para.indent_second = indent_second;
object_set.para.bullet = to!string(bullet);
return object_set;
}
#+END_SRC
#+name: ao_object_setter
#+BEGIN_SRC d
string[string] contents_para(
in string is_a,
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"] = is_a;
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;
}
#+END_SRC
** block :block:
#+name: ao_object_setter
#+BEGIN_SRC d
ObjComposite contents_block_new(
in string type,
in string object,
in string attrib,
in int ocn
) {
ObjComposite object_set;
// does not have .attrib;
object_set.use = "content";
object_set.of = "block";
object_set.is_a = type;
object_set.object = object;
object_set.ocn = (ocn==0) ? "" : to!string(ocn);
object_set.attrib = attrib;
return object_set;
}
#+END_SRC
#+name: ao_object_setter
#+BEGIN_SRC d
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;
}
#+END_SRC
** block ocn string :block:
#+name: ao_object_setter
#+BEGIN_SRC d
ObjComposite contents_block_ocn_string_new(
in string type,
in string object,
in string ocn,
in string node
) {
ObjComposite object_set;
object_set.use = "content";
object_set.of = "block";
object_set.is_a = type;
object_set.object = object;
object_set.ocn = ocn;
object_set.block_ocn_string.node = node;
// object_set.attrib = attrib;
return object_set;
}
#+END_SRC
#+name: ao_object_setter
#+BEGIN_SRC d
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;
}
#+END_SRC
* tangles :tangle:
** code structure: :ao_object_setter.d:
#+name: tangle_ao_object_setter
#+BEGIN_SRC d :tangle ../lib/sdp/ao_object_setter.d
/+
object setter
ao_object_setter.d
+/
mixin template ObjectSetters() {
struct ObjectAbstractSet {
import std.conv : to;
<<ao_object_setter>>
}
}
#+END_SRC
|