|
28 | 28 | result fmt(bool start,prompt& target,menuOut::fmtParts part,navNode &nav,idx_t idx=-1) {
|
29 | 29 | switch(part) {
|
30 | 30 | case menuOut::fmtPanel:
|
31 |
| - if (start) *this<<"{"; |
32 |
| - else T::operator<<("}"); |
| 31 | + if (start) T::print("{"); |
| 32 | + else T::print("}"); |
33 | 33 | break;
|
34 | 34 | case menuOut::fmtTitle:
|
35 |
| - if (start) T::operator<<("\"title\":{"); |
36 |
| - else T::operator<<("}\n"); |
| 35 | + if (start) T::print("\"title\":{"); |
| 36 | + else T::print("}\n"); |
37 | 37 | break;
|
38 | 38 | case menuOut::fmtBody:
|
39 | 39 | if (start) {
|
40 |
| - *this<<",\"path\":\""; |
| 40 | + T::print(",\"path\":\""); |
41 | 41 | nav.root->printPath(*this,(menuNode*)&target);
|
42 |
| - *this<<"\",\"sel\":\""<<nav.sel<<"\""; |
43 |
| - *this<<",\"items\":[\n"; |
44 |
| - } else T::operator<<("\n]\n"); |
| 42 | + T::print("\",\"sel\":\""); |
| 43 | + T::print(nav.sel); |
| 44 | + T::print("\""); |
| 45 | + T::print(",\"items\":[\n"); |
| 46 | + } else T::print("\n]\n"); |
45 | 47 | break;
|
46 | 48 | case menuOut::fmtUnit:
|
47 |
| - *this<<(start?",\"unit\":\"":"\""); |
| 49 | + if (start) T::print(",\"unit\":\""); |
| 50 | + else T::print("\""); |
48 | 51 | break;
|
49 | 52 | case menuOut::fmtOp:
|
50 | 53 | if (start) {
|
51 |
| - if (idx>0) *this<<",\n"; |
52 |
| - *this<<"{\"idx\":\""<<idx<<"\"" |
53 |
| - <<",\"enabled\":\""<<target.enabled<<"\""; |
54 |
| - } else *this<<("}"); |
| 54 | + if (idx>0) T::print(",\n"); |
| 55 | + T::print("{\"idx\":\""); |
| 56 | + T::print(idx); |
| 57 | + T::print("\""); |
| 58 | + T::print(",\"enabled\":\""); |
| 59 | + T::print(target.enabled); |
| 60 | + T::print("\""); |
| 61 | + } else T::print("}"); |
55 | 62 | break;
|
56 | 63 | case menuOut::fmtToggle:
|
57 | 64 | if (start) {
|
58 |
| - *this<<",\"value\":\""; |
| 65 | + T::print(",\"value\":\""); |
59 | 66 | } else {
|
60 |
| - *this<<"\""; |
| 67 | + T::print("\""); |
61 | 68 | jsonOptions(*this,nav,*(menuNode*)&target,idx);
|
62 | 69 | // *this<<",";
|
63 | 70 | }
|
64 | 71 | break;
|
65 | 72 | case menuOut::fmtPrompt:
|
66 | 73 | if (start) {
|
67 |
| - if (idx>=0) *this<<","; |
68 |
| - *this<<"\"prompt\":\""; |
| 74 | + if (idx>=0) T::print(","); |
| 75 | + T::print("\"prompt\":\""); |
69 | 76 | } else {
|
70 |
| - *this<<"\""; |
| 77 | + T::print("\""); |
71 | 78 | if (target.has(_asPad))
|
72 |
| - *this<<",\"pad\":["; |
| 79 | + T::print(",\"pad\":["); |
73 | 80 | };
|
74 | 81 | break;
|
75 | 82 | case menuOut::fmtValue:
|
76 |
| - if (start) *this<<",\"value\":\""; |
77 |
| - else *this<<"\""; |
| 83 | + if (start) T::print(",\"value\":\""); |
| 84 | + else T::print("\""); |
78 | 85 | break;
|
79 | 86 | case menuOut::fmtSelect:
|
80 | 87 | if (start) {
|
81 |
| - *this<<",\"select\":\""; |
| 88 | + T::print(",\"select\":\""); |
82 | 89 | } else {
|
83 |
| - *this<<"\""; |
| 90 | + T::print("\""); |
84 | 91 | jsonOptions(*this,nav,*(menuNode*)&target,idx);
|
85 | 92 | }
|
86 | 93 | break;
|
87 | 94 | case menuOut::fmtChoose:
|
88 | 95 | if (start) {
|
89 |
| - *this<<",\"choose\":\""; |
| 96 | + T::print(",\"choose\":\""); |
90 | 97 | } else {
|
91 |
| - *this<<"\""; |
| 98 | + T::print("\""); |
92 | 99 | jsonOptions(*this,nav,*(menuNode*)&target,idx);
|
93 | 100 | }
|
94 | 101 | break;
|
95 | 102 | break;
|
96 | 103 | case menuOut::fmtField:
|
97 | 104 | if (start) {
|
98 |
| - *this<<",\"field\":\""; |
| 105 | + T::print(",\"field\":\""); |
99 | 106 | } else {
|
100 |
| - *this<<"\",\"range\":{\"low\":\""; |
| 107 | + T::print("\",\"range\":{\"low\":\""); |
101 | 108 | target.printLow(*this);
|
102 |
| - *this<<"\",\"high\":\""; |
| 109 | + T::print("\",\"high\":\""); |
103 | 110 | target.printHigh(*this);
|
104 |
| - *this<<"\",\"step\":\""; |
| 111 | + T::print("\",\"step\":\""); |
105 | 112 | target.printStep(*this);
|
106 |
| - *this<<"\",\"tune\":\""; |
| 113 | + T::print("\",\"tune\":\""); |
107 | 114 | target.printTune(*this);
|
108 |
| - *this<<"\"}"; |
| 115 | + T::print("\"}"); |
109 | 116 | }
|
110 | 117 | break;
|
111 | 118 | case menuOut::fmtEditCursor:
|
112 |
| - if (start) *this<<",\"editCursor\":\""; |
113 |
| - else *this<<"\""; |
| 119 | + if (start) T::print(",\"editCursor\":\""); |
| 120 | + else T::print("\""); |
114 | 121 | break;
|
115 | 122 | case menuOut::fmtTextField:
|
116 |
| - if (start) *this<<",\"text\":\""; |
117 |
| - else *this<<"\""; |
| 123 | + if (start) T::print(",\"text\":\""); |
| 124 | + else T::print("\""); |
118 | 125 | break;
|
119 | 126 | case menuOut::fmtIdx:
|
120 | 127 | // if (start) *this<<"\"idx\":";
|
121 | 128 | // else *this<<",";
|
122 | 129 | break;
|
123 | 130 | case menuOut::fmtCursor:
|
124 |
| - if (start) *this<<",\"cursor\":\""; |
125 |
| - else *this<<"\""; |
| 131 | + if (start) T::print(",\"cursor\":\""); |
| 132 | + else T::print("\""); |
126 | 133 | break;
|
127 | 134 | case menuOut::fmtCursorOpen:
|
128 |
| - if (start) *this<<",\"selStart\":\""; |
129 |
| - else *this<<"\""; |
| 135 | + if (start) T::print(",\"selStart\":\""); |
| 136 | + else T::print("\""); |
130 | 137 | break;
|
131 | 138 | case menuOut::fmtCursorClose:
|
132 |
| - if (start) *this<<",\"selEnd\":\""; |
133 |
| - else *this<<"\""; |
| 139 | + if (start) T::print(",\"selEnd\":\""); |
| 140 | + else T::print("\""); |
134 | 141 | break;
|
135 | 142 | case menuOut::fmtOpBody:
|
136 | 143 | if (start) {
|
137 | 144 | // *this<<"\"body\":{";
|
138 | 145 | // if (target.has(_asPad)) *this<<"\"pad\":[";
|
139 | 146 | } else {
|
140 |
| - if (target.has(_asPad)) *this<<"]"; |
| 147 | + if (target.has(_asPad)) T::print("]"); |
141 | 148 | // *this<<"}";
|
142 | 149 | }
|
143 | 150 | break;
|
144 | 151 | case menuOut::fmtPreview:
|
145 |
| - if (start) *this<<",\"preview\":\""; |
146 |
| - else *this<<"\"\n"; |
| 152 | + if (start) T::print(",\"preview\":\""); |
| 153 | + else T::print("\"\n"); |
147 | 154 | break;
|
148 | 155 | default:break;
|
149 | 156 | }
|
|
0 commit comments