|
10 | 10 | //
|
11 | 11 |
|
12 | 12 | #include "Support/Debug.hpp"
|
| 13 | +#include "Support/Radix.hpp" |
| 14 | +#include <mrdox/Metadata/Access.hpp> |
| 15 | +#include <mrdox/Metadata/Info.hpp> |
| 16 | +#include <mrdox/Metadata/Reference.hpp> |
| 17 | +#include <mrdox/Metadata/Symbols.hpp> |
13 | 18 | #include <atomic>
|
14 | 19 | #include <memory>
|
15 | 20 |
|
16 |
| -#ifdef MRDOX_HAS_CXX20_FORMAT |
17 |
| - #include "Support/Radix.hpp" |
18 |
| - #include <mrdox/Metadata/Access.hpp> |
19 |
| - #include <mrdox/Metadata/Reference.hpp> |
20 |
| - #include <mrdox/Metadata/Symbols.hpp> |
21 |
| - #include <mrdox/Metadata/Info.hpp> |
22 |
| -#endif |
23 |
| - |
24 | 21 | #if defined(_MSC_VER) && ! defined(NDEBUG)
|
25 | 22 |
|
26 | 23 | #define WIN32_LEAN_AND_MEAN
|
@@ -134,132 +131,133 @@ void debugEnableHeapChecking()
|
134 | 131 |
|
135 | 132 | #endif
|
136 | 133 |
|
137 |
| -#ifdef MRDOX_HAS_CXX20_FORMAT |
138 |
| - std::format_context::iterator |
139 |
| - std::formatter<clang::mrdox::SymbolID>:: |
140 |
| - format( |
141 |
| - const clang::mrdox::SymbolID& s, |
142 |
| - std::format_context& ctx) const |
143 |
| - { |
144 |
| - std::string str = s == clang::mrdox::SymbolID::zero ? |
145 |
| - "<empty SymbolID>" : clang::mrdox::toBase64(s); |
146 |
| - return std::formatter<std::string>::format(std::move(str), ctx); |
147 |
| - } |
| 134 | +fmt::format_context::iterator |
| 135 | +fmt::formatter<clang::mrdox::SymbolID>:: |
| 136 | +format( |
| 137 | + const clang::mrdox::SymbolID& s, |
| 138 | + fmt::format_context& ctx) const |
| 139 | +{ |
| 140 | + std::string str = s == clang::mrdox::SymbolID::zero ? |
| 141 | + "<empty SymbolID>" : clang::mrdox::toBase64(s); |
| 142 | + return fmt::formatter<std::string>::format(std::move(str), ctx); |
| 143 | +} |
148 | 144 |
|
149 |
| - std::format_context::iterator |
150 |
| - std::formatter<clang::mrdox::OptionalSymbolID>:: |
151 |
| - format( |
152 |
| - const clang::mrdox::OptionalSymbolID& s, |
153 |
| - std::format_context& ctx) const |
154 |
| - { |
155 |
| - return std::formatter<clang::mrdox::SymbolID>::format(*s, ctx); |
156 |
| - } |
| 145 | +fmt::format_context::iterator |
| 146 | +fmt::formatter<clang::mrdox::OptionalSymbolID>:: |
| 147 | +format( |
| 148 | + const clang::mrdox::OptionalSymbolID& s, |
| 149 | + fmt::format_context& ctx) const |
| 150 | +{ |
| 151 | + return fmt::formatter<clang::mrdox::SymbolID>::format(*s, ctx); |
| 152 | +} |
157 | 153 |
|
158 |
| - std::format_context::iterator |
159 |
| - std::formatter<clang::mrdox::InfoType>:: |
160 |
| - format( |
161 |
| - clang::mrdox::InfoType t, |
162 |
| - std::format_context& ctx) const |
| 154 | +fmt::format_context::iterator |
| 155 | +fmt::formatter<clang::mrdox::InfoType>:: |
| 156 | +format( |
| 157 | + clang::mrdox::InfoType t, |
| 158 | + fmt::format_context& ctx) const |
| 159 | +{ |
| 160 | + const char* str = "<unknown InfoType>"; |
| 161 | + switch(t) |
163 | 162 | {
|
164 |
| - const char* str = "<unknown InfoType>"; |
165 |
| - switch(t) |
166 |
| - { |
167 |
| - case clang::mrdox::InfoType::IT_default: |
168 |
| - str = "default"; |
169 |
| - break; |
170 |
| - case clang::mrdox::InfoType::IT_namespace: |
171 |
| - str = "namespace"; |
172 |
| - break; |
173 |
| - case clang::mrdox::InfoType::IT_record: |
174 |
| - str = "record"; |
175 |
| - break; |
176 |
| - case clang::mrdox::InfoType::IT_function: |
177 |
| - str = "function"; |
178 |
| - break; |
179 |
| - case clang::mrdox::InfoType::IT_enum: |
180 |
| - str = "enum"; |
181 |
| - break; |
182 |
| - case clang::mrdox::InfoType::IT_typedef: |
183 |
| - str = "typedef"; |
184 |
| - break; |
185 |
| - case clang::mrdox::InfoType::IT_variable: |
186 |
| - str = "variable"; |
187 |
| - break; |
188 |
| - default: |
189 |
| - break; |
190 |
| - } |
191 |
| - return std::formatter<std::string>::format(str, ctx); |
| 163 | + case clang::mrdox::InfoType::IT_default: |
| 164 | + str = "default"; |
| 165 | + break; |
| 166 | + case clang::mrdox::InfoType::IT_namespace: |
| 167 | + str = "namespace"; |
| 168 | + break; |
| 169 | + case clang::mrdox::InfoType::IT_record: |
| 170 | + str = "record"; |
| 171 | + break; |
| 172 | + case clang::mrdox::InfoType::IT_function: |
| 173 | + str = "function"; |
| 174 | + break; |
| 175 | + case clang::mrdox::InfoType::IT_enum: |
| 176 | + str = "enum"; |
| 177 | + break; |
| 178 | + case clang::mrdox::InfoType::IT_typedef: |
| 179 | + str = "typedef"; |
| 180 | + break; |
| 181 | + case clang::mrdox::InfoType::IT_variable: |
| 182 | + str = "variable"; |
| 183 | + break; |
| 184 | + case clang::mrdox::InfoType::IT_field: |
| 185 | + str = "field"; |
| 186 | + break; |
| 187 | + default: |
| 188 | + break; |
192 | 189 | }
|
| 190 | + return fmt::formatter<std::string>::format(str, ctx); |
| 191 | +} |
193 | 192 |
|
194 |
| - std::format_context::iterator |
195 |
| - std::formatter<clang::mrdox::Access>:: |
196 |
| - format( |
197 |
| - clang::mrdox::Access a, |
198 |
| - std::format_context& ctx) const |
| 193 | +fmt::format_context::iterator |
| 194 | +fmt::formatter<clang::mrdox::Access>:: |
| 195 | +format( |
| 196 | + clang::mrdox::Access a, |
| 197 | + fmt::format_context& ctx) const |
| 198 | +{ |
| 199 | + const char* str = "<unknown Access>"; |
| 200 | + switch(a) |
199 | 201 | {
|
200 |
| - const char* str = "<unknown Access>"; |
201 |
| - switch(a) |
202 |
| - { |
203 |
| - case clang::mrdox::Access::Public: |
204 |
| - str = "public"; |
205 |
| - break; |
206 |
| - case clang::mrdox::Access::Protected: |
207 |
| - str = "protected"; |
208 |
| - break; |
209 |
| - case clang::mrdox::Access::Private: |
210 |
| - str = "private"; |
211 |
| - break; |
212 |
| - default: |
213 |
| - break; |
214 |
| - } |
215 |
| - return std::formatter<std::string>::format(str, ctx); |
| 202 | + case clang::mrdox::Access::Public: |
| 203 | + str = "public"; |
| 204 | + break; |
| 205 | + case clang::mrdox::Access::Protected: |
| 206 | + str = "protected"; |
| 207 | + break; |
| 208 | + case clang::mrdox::Access::Private: |
| 209 | + str = "private"; |
| 210 | + break; |
| 211 | + default: |
| 212 | + break; |
216 | 213 | }
|
| 214 | + return fmt::formatter<std::string>::format(str, ctx); |
| 215 | +} |
217 | 216 |
|
218 |
| - std::format_context::iterator |
219 |
| - std::formatter<clang::mrdox::Reference>:: |
220 |
| - format( |
221 |
| - const clang::mrdox::Reference& r, |
222 |
| - std::format_context& ctx) const |
223 |
| - { |
224 |
| - std::string str = std::format("Reference: type = {}", r.RefType); |
225 |
| - if(! r.Name.empty()) |
226 |
| - str += std::format(", name = '{}'", std::string(r.Name)); |
227 |
| - str += std::format(", ID = {}", r.id); |
228 |
| - return std::formatter<std::string>::format(std::move(str), ctx); |
229 |
| - } |
| 217 | +fmt::format_context::iterator |
| 218 | +fmt::formatter<clang::mrdox::Reference>:: |
| 219 | +format( |
| 220 | + const clang::mrdox::Reference& r, |
| 221 | + fmt::format_context& ctx) const |
| 222 | +{ |
| 223 | + std::string str = fmt::format("Reference: type = {}", r.RefType); |
| 224 | + if(! r.Name.empty()) |
| 225 | + str += fmt::format(", name = '{}'", std::string(r.Name)); |
| 226 | + str += fmt::format(", ID = {}", r.id); |
| 227 | + return fmt::formatter<std::string>::format(std::move(str), ctx); |
| 228 | +} |
230 | 229 |
|
231 |
| - std::format_context::iterator |
232 |
| - std::formatter<clang::mrdox::MemberRef>:: |
233 |
| - format( |
234 |
| - const clang::mrdox::MemberRef& r, |
235 |
| - std::format_context& ctx) const |
236 |
| - { |
237 |
| - std::string str = std::format("MemberRef: access = {}, ID = {}", |
238 |
| - r.access, r.id); |
239 |
| - return std::formatter<std::string>::format(std::move(str), ctx); |
240 |
| - } |
| 230 | +fmt::format_context::iterator |
| 231 | +fmt::formatter<clang::mrdox::MemberRef>:: |
| 232 | +format( |
| 233 | + const clang::mrdox::MemberRef& r, |
| 234 | + fmt::format_context& ctx) const |
| 235 | +{ |
| 236 | + std::string str = fmt::format("MemberRef: access = {}, ID = {}", |
| 237 | + r.access, r.id); |
| 238 | + return fmt::formatter<std::string>::format(std::move(str), ctx); |
| 239 | +} |
241 | 240 |
|
242 |
| - std::format_context::iterator |
243 |
| - std::formatter<clang::mrdox::Info>:: |
244 |
| - format( |
245 |
| - const clang::mrdox::Info& i, |
246 |
| - std::format_context& ctx) const |
| 241 | +fmt::format_context::iterator |
| 242 | +fmt::formatter<clang::mrdox::Info>:: |
| 243 | +format( |
| 244 | + const clang::mrdox::Info& i, |
| 245 | + fmt::format_context& ctx) const |
| 246 | +{ |
| 247 | + std::string str = fmt::format("Info: type = {}", i.IT); |
| 248 | + if(! i.Name.empty()) |
| 249 | + str += fmt::format(", name = '{}'", i.Name); |
| 250 | + str += fmt::format(", ID = {}", i.id); |
| 251 | + if(! i.Namespace.empty()) |
247 | 252 | {
|
248 |
| - std::string str = std::format("Info: type = {}", i.IT); |
249 |
| - if(! i.Name.empty()) |
250 |
| - str += std::format(", name = '{}'", i.Name); |
251 |
| - str += std::format(", ID = {}", i.id); |
252 |
| - if(! i.Namespace.empty()) |
| 253 | + std::string namespaces; |
| 254 | + namespaces += i.Namespace[0].Name; |
| 255 | + for(std::size_t idx = 1; idx < i.Namespace.size(); ++idx) |
253 | 256 | {
|
254 |
| - std::string namespaces; |
255 |
| - namespaces += i.Namespace[0].Name; |
256 |
| - for(std::size_t idx = 1; idx < i.Namespace.size(); ++idx) |
257 |
| - { |
258 |
| - namespaces += "::"; |
259 |
| - namespaces += i.Namespace[0].Name; |
260 |
| - } |
261 |
| - str += std::format(", namespace = {}", namespaces); |
| 257 | + namespaces += "::"; |
| 258 | + namespaces += i.Namespace[idx].Name; |
262 | 259 | }
|
263 |
| - return std::formatter<std::string>::format(std::move(str), ctx); |
| 260 | + str += fmt::format(", namespace = {}", namespaces); |
264 | 261 | }
|
265 |
| -#endif |
| 262 | + return fmt::formatter<std::string>::format(std::move(str), ctx); |
| 263 | +} |
0 commit comments