Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
TranslationPluginRequest.c
Go to the documentation of this file.
1#ifdef WORKBENCH
2class TranslationPluginRequest : JsonApiStruct
3{
4 ref array<string> locales;
5 ref array<ref TranslationPluginQuery> queries = {};
6
7 //------------------------------------------------------------------------------------------------
8 override event void OnPack()
9 {
10 super.OnPack();
11
12 UnregV("locales");
13 if (locales && !locales.IsEmpty())
14 {
15 StartArray("locales");
16
17 foreach (string locale : locales)
18 {
19 ItemString(locale);
20 }
21
22 EndArray();
23 }
24
25 UnregV("queries");
26 StartArray("queries");
27
28 if (queries)
29 {
30 foreach (TranslationPluginQuery query : queries)
31 {
32 ItemObject(query);
33 }
34 }
35
36 EndArray();
37 }
38
39 //------------------------------------------------------------------------------------------------
40 override event void OnExpand()
41 {
42 super.OnExpand();
43
44 if (locales && !locales.IsEmpty())
45 RegV("locales");
46
47 RegV("queries");
48 }
49}
50
51class TranslationPluginQuery : JsonApiStruct
52{
53 string id;
54 string text;
55 ref array<string> locales = {};
56 ref TranslationRequestMeta meta;
57
58 //------------------------------------------------------------------------------------------------
59 override event void OnPack()
60 {
61 super.OnPack();
62
63 UnregV("id");
64 StoreString("id", id);
65
66 UnregV("text");
67 StoreString("text", text);
68
69 UnregV("locales");
70 if (locales)
71 {
72 StartArray("locales");
73
74 foreach (string locale : locales)
75 {
76 ItemString(locale);
77 }
78
79 EndArray();
80 }
81
82 UnregV("meta");
83 if (meta && !meta.IsEmpty())
84 StoreObject("meta", meta);
85 }
86
87 //------------------------------------------------------------------------------------------------
88 override event void OnExpand()
89 {
90 super.OnExpand();
91
92 RegV("id");
93 RegV("text");
94 RegV("locales");
95
96 if (meta && !meta.IsEmpty())
97 RegV("meta");
98 }
99}
100
101class TranslationRequestMeta : JsonApiStruct
102{
103 string comment;
104 string gender;
105 int maxLength;
106
107 //------------------------------------------------------------------------------------------------
109 bool IsEmpty()
110 {
111 return maxLength < 1 && comment.IsEmpty() && gender.IsEmpty();
112 }
113
114 //------------------------------------------------------------------------------------------------
115 override event void OnPack()
116 {
117 super.OnPack();
118
119 UnregV("comment");
120 if (!comment.IsEmpty())
121 StoreString("comment", comment);
122
123 UnregV("gender");
124 if (!gender.IsEmpty())
125 StoreString("gender", gender);
126
127 UnregV("maxLength");
128 if (maxLength > 0)
129 StoreInteger("maxLength", maxLength);
130 }
131
132 //------------------------------------------------------------------------------------------------
133 override event void OnExpand()
134 {
135 super.OnExpand();
136
137 if (!comment.IsEmpty())
138 RegV("comment");
139
140 if (!gender.IsEmpty())
141 RegV("gender");
142
143 if (maxLength > 0)
144 RegV("maxLength");
145 }
146}
147#endif // WORKBENCH
AddonBuildInfoTool id
override void OnPack()
override void OnExpand()
base classes for filtering in server browser
proto native bool IsEmpty()