Doxygen
Loading...
Searching...
No Matches
types.h
Go to the documentation of this file.
1/******************************************************************************
2 *
3 * Copyright (C) 1997-2015 by Dimitri van Heesch.
4 *
5 * Permission to use, copy, modify, and distribute this software and its
6 * documentation under the terms of the GNU General Public License is hereby
7 * granted. No representations are made about the suitability of this software
8 * for any purpose. It is provided "as is" without express or implied warranty.
9 * See the GNU General Public License for more details.
10 *
11 * Documents produced by Doxygen are derivative works derived from the
12 * input used in their production; they are not affected by this license.
13 *
14 */
15
16#ifndef TYPES_H
17#define TYPES_H
18
19#include "qcstring.h"
20
21/** @file
22 * @brief This file contains a number of basic enums and types.
23 */
24
25/** Protection level of members */
26#define PROTECTION_SPECIFICATIONS \
27 PROTSPEC(Public,public,public) \
28 PROTSPEC(Protected,protected,protected) \
29 PROTSPEC(Private,private,private) \
30 PROTSPEC(Package,package,protected)
31
32enum class Protection {
33#define PROTSPEC(x,y,z) x,
35#undef PROTSPEC
36};
37
38[[maybe_unused]] static constexpr const char *to_string(Protection prot) noexcept
39{
40 const char *result = "ERROR";
41 switch (prot)
42 {
43#define PROTSPEC(x,y,z) case Protection::x: result = #x; break;
45#undef PROTSPEC
46 }
47 return result;
48}
49
50[[maybe_unused]] static constexpr const char *to_string_lower(Protection prot) noexcept
51{
52 const char *result = "error";
53 switch (prot)
54 {
55#define PROTSPEC(x,y,z) case Protection::x: result = #y; break;
57#undef PROTSPEC
58 }
59 return result;
60}
61
62[[maybe_unused]] static constexpr const char *to_string_lower_class(Protection prot) noexcept
63{
64 const char *result = "error";
65 switch (prot)
66 {
67#define PROTSPEC(x,y,z) case Protection::x: result = #z; break;
69#undef PROTSPEC
70 }
71 return result;
72}
73
74/** Virtualness of a member. */
75#define SPECIFIER_SPECIFICATIONS \
76 SPECSPEC(Normal,non-virtual) \
77 SPECSPEC(Virtual,virtual) \
78 SPECSPEC(Pure,pure-virtual)
79
80enum class Specifier {
81#define SPECSPEC(x,y) x,
83#undef SPECSPEC
84};
85
86[[maybe_unused]] static constexpr const char *to_string(Specifier spec) noexcept
87{
88 const char *result = "ERROR";
89 switch (spec)
90 {
91#define SPECSPEC(x,y) case Specifier::x: result = #x; break;
93#undef SPECSPEC
94 }
95 return result;
96}
97
98[[maybe_unused]] static constexpr const char *to_string_lower(Specifier spec) noexcept
99{
100 const char *result = "error";
101 switch (spec)
102 {
103#define SPECSPEC(x,y) case Specifier::x: result = #y; break;
105#undef SPECSPEC
106 }
107 return result;
108}
109
110/** Kind of method */
111#define METHODTYPE_SPECIFICATIONS \
112 MTSPEC(Method) \
113 MTSPEC(Signal) \
114 MTSPEC(Slot) \
115 MTSPEC(DCOP) \
116 MTSPEC(Property) \
117 MTSPEC(Event)
118
119enum class MethodTypes {
120#define MTSPEC(x) x,
122#undef MTSPEC
123};
124
125[[maybe_unused]] static constexpr const char *to_string(MethodTypes mt) noexcept
126{
127 const char *result = "ERROR";
128 switch (mt)
129 {
130#define MTSPEC(x) case MethodTypes::x: result = #x; break;
132#undef MTSPEC
133 }
134 return result;
135}
136
137/** Type of member relation */
138#define RELATESTYPE_SPECIFICATIONS \
139 RTSPEC(Simple) \
140 RTSPEC(Duplicate) \
141 RTSPEC(MemberOf)
142
143enum class RelatesType {
144#define RTSPEC(x) x,
146#undef RTSPEC
147};
148
149[[maybe_unused]] static constexpr const char *to_string(RelatesType rt) noexcept
150{
151 const char *result = "ERROR";
152 switch (rt)
153 {
154#define RTSPEC(x) case RelatesType::x: result = #x; break;
156#undef RTSPEC
157 }
158 return result;
159}
160
161/** Kind of member relationship */
162#define RELATIONSHIP_SPECIFICATIONS \
163 RSSPEC(Member) \
164 RSSPEC(Related) \
165 RSSPEC(Foreign)
166
167enum class Relationship {
168#define RSSPEC(x) x,
170#undef RSSPEC
171};
172
173[[maybe_unused]] static constexpr const char *to_string(Relationship rs) noexcept
174{
175 const char *result = "ERROR";
176 switch (rs)
177 {
178#define RSSPEC(x) case Relationship::x: result = #x; break;
180#undef RSSPEC
181 }
182 return result;
183}
184
185/** Language as given by extension */
186#define SRCLANGEXT_SPECIFICATIONS \
187 SRCLANGEXT(Unknown , 0x00000, Unknown) \
188 SRCLANGEXT(IDL , 0x00008, IDL) \
189 SRCLANGEXT(Java , 0x00010, Java) \
190 SRCLANGEXT(CSharp , 0x00020, C#) \
191 SRCLANGEXT(D , 0x00040, D) \
192 SRCLANGEXT(PHP , 0x00080, PHP) \
193 SRCLANGEXT(ObjC , 0x00100, Objective-C) \
194 SRCLANGEXT(Cpp , 0x00200, C++) \
195 SRCLANGEXT(JS , 0x00400, Javascript) \
196 SRCLANGEXT(Python , 0x00800, Python) \
197 SRCLANGEXT(Fortran , 0x01000, Fortran) \
198 SRCLANGEXT(VHDL , 0x02000, VHDL) \
199 SRCLANGEXT(XML , 0x04000, XML) \
200 SRCLANGEXT(Markdown , 0x10000, Markdown) \
201 SRCLANGEXT(SQL , 0x20000, SQL) \
202 SRCLANGEXT(Slice , 0x40000, Slice) \
203 SRCLANGEXT(Lex , 0x80000, Lex)
204
205 /* SRCLANGEXT(Tcl , 0x08000, Tcl ) // no longer supported */
206
207enum class SrcLangExt {
208#define SRCLANGEXT(x, v, z) x = v,
210#undef SRCLANGEXT
211};
212
213[[maybe_unused]] static constexpr const char *to_string(SrcLangExt sle) noexcept
214{
215 const char *result = "ERROR";
216 switch (sle)
217 {
218#define SRCLANGEXT(x,v,z) case SrcLangExt::x: result = #z; break;
220#undef SRCLANGEXT
221 }
222 return result;
223}
224
225/** Grouping info */
227{
228 /** Grouping priority */
230 {
232 GROUPING_AUTO_WEAK = GROUPING_LOWEST, //!< membership in group was defined via \@weakgroup
233 GROUPING_AUTO_ADD, //!< membership in group was defined via \@add[to]group
234 GROUPING_AUTO_DEF, //!< membership in group was defined via \@defgroup
236 GROUPING_INGROUP, //!< membership in group was defined by \@ingroup
238 };
239
240 static constexpr const char *getGroupPriName( GroupPri_t priority ) noexcept
241 {
242 switch( priority )
243 {
245 return "@weakgroup";
247 return "@addtogroup";
249 return "@defgroup";
250 case GROUPING_INGROUP:
251 return "@ingroup";
252 }
253 return "???";
254 }
255
256 Grouping( const QCString &gn, GroupPri_t p ) : groupname(gn), pri(p) {}
257 QCString groupname; //!< name of the group
258 GroupPri_t pri; //!< priority of this definition
259
260};
261
262// enum name category to-public to-protected html-label xml-label
263#define ML_TYPES \
264 ML_TYPE(PubMethods, Public, Invalid, Invalid, "pub-methods", "public-func" ) \
265 ML_TYPE(ProMethods, Protected, PubMethods, Invalid, "pro-methods", "protected-func" ) \
266 ML_TYPE(PacMethods, Package, Invalid, Invalid, "pac-methods", "package-func" ) \
267 ML_TYPE(PriMethods, Private, PubMethods, ProMethods, "pri-methods", "private-func" ) \
268 ML_TYPE(PubStaticMethods, Public, Invalid, Invalid, "pub-static-methods", "public-static-func" ) \
269 ML_TYPE(ProStaticMethods, Protected, PubStaticMethods, Invalid, "pro-static-methods", "protected-static-func" ) \
270 ML_TYPE(PacStaticMethods, Package, Invalid, Invalid, "pac-static-methods", "package-static-func" ) \
271 ML_TYPE(PriStaticMethods, Private, PubStaticMethods, ProStaticMethods, "pri-static-methods", "private-static-func" ) \
272 ML_TYPE(PubSlots, Public, Invalid, Invalid, "pub-slots", "public-slot" ) \
273 ML_TYPE(ProSlots, Protected, PubSlots, Invalid, "pro-slots", "protected-slot" ) \
274 ML_TYPE(PriSlots, Private, PubSlots, ProSlots, "pri-slots", "private-slot" ) \
275 ML_TYPE(PubAttribs, Public, Invalid, Invalid, "pub-attribs", "public-attrib" ) \
276 ML_TYPE(ProAttribs, Protected, PubAttribs, Invalid, "pro-attribs", "protected-attrib" ) \
277 ML_TYPE(PacAttribs, Package, Invalid, Invalid, "pac-attribs", "package-attrib" ) \
278 ML_TYPE(PriAttribs, Private, PubAttribs, ProAttribs, "pri-attribs", "private-attrib" ) \
279 ML_TYPE(PubStaticAttribs, Public, Invalid, Invalid, "pub-static-attribs", "public-static-attrib" ) \
280 ML_TYPE(ProStaticAttribs, Protected, PubStaticAttribs, Invalid, "pro-static-attribs", "protected-static-attrib" ) \
281 ML_TYPE(PacStaticAttribs, Package, Invalid, Invalid, "pac-static-attribs", "package-static-attrib" ) \
282 ML_TYPE(PriStaticAttribs, Private, PubStaticAttribs, ProStaticAttribs, "pri-static-attribs", "private-static-attrib" ) \
283 ML_TYPE(PubTypes, Public, Invalid, Invalid, "pub-types", "public-type" ) \
284 ML_TYPE(ProTypes, Protected, PubTypes, Invalid, "pro-types", "protected-type" ) \
285 ML_TYPE(PacTypes, Package, Invalid, Invalid, "pac-types", "package-type" ) \
286 ML_TYPE(PriTypes, Private, PubTypes, ProTypes, "pri-types", "private-type" ) \
287 ML_TYPE(Related, OnlyPublic, Invalid, Invalid, "related", "related" ) \
288 ML_TYPE(Signals, OnlyPublic, Invalid, Invalid, "signals", "signal" ) \
289 ML_TYPE(Friends, OnlyPublic, Invalid, Invalid, "friends", "friend" ) \
290 ML_TYPE(DcopMethods, OnlyPublic, Invalid, Invalid, "dcop-methods", "dcop-func" ) \
291 ML_TYPE(Properties, OnlyPublic, Invalid, Invalid, "properties", "property" ) \
292 ML_TYPE(Events, OnlyPublic, Invalid, Invalid, "events", "event" ) \
293 ML_TYPE(AllMembersList, OnlyPublic, Invalid, Invalid, "all-members-list", "all-members-list" ) \
294 ML_TYPE(EnumFields, OnlyPublic, Invalid, Invalid, "enum-fields", "enum-fields" ) \
295 ML_TYPE(MemberGroup, OnlyPublic, Invalid, Invalid, "member-group", "member-group" ) \
296 ML_TYPE(Interfaces, OnlyPublic, Invalid, Invalid, "interfaces", "interfaces" ) \
297 ML_TYPE(Services, OnlyPublic, Invalid, Invalid, "services", "services" ) \
298 ML_TYPE(DecDefineMembers, Declaration, Invalid, Invalid, "define-members", "define" ) \
299 ML_TYPE(DecProtoMembers, Declaration, Invalid, Invalid, "proto-members", "prototype" ) \
300 ML_TYPE(DecTypedefMembers, Declaration, Invalid, Invalid, "typedef-members", "typedef" ) \
301 ML_TYPE(DecEnumMembers, Declaration, Invalid, Invalid, "enum-members", "enum" ) \
302 ML_TYPE(DecFuncMembers, Declaration, Invalid, Invalid, "func-members", "func" ) \
303 ML_TYPE(DecVarMembers, Declaration, Invalid, Invalid, "var-members", "var" ) \
304 ML_TYPE(DecEnumValMembers, Declaration, Invalid, Invalid, "enumval-members", "" ) \
305 ML_TYPE(DecPubSlotMembers, Declaration, Invalid, Invalid, "pub-slot-members", "" ) \
306 ML_TYPE(DecProSlotMembers, Declaration, Invalid, Invalid, "pro-slot-members", "" ) \
307 ML_TYPE(DecPriSlotMembers, Declaration, Invalid, Invalid, "pri-slot-members", "" ) \
308 ML_TYPE(DecSignalMembers, Declaration, Invalid, Invalid, "signal-members", "" ) \
309 ML_TYPE(DecEventMembers, Declaration, Invalid, Invalid, "event-members", "" ) \
310 ML_TYPE(DecFriendMembers, Declaration, Invalid, Invalid, "friend-members", "" ) \
311 ML_TYPE(DecPropMembers, Declaration, Invalid, Invalid, "prop-members", "" ) \
312 ML_TYPE(DecSequenceMembers, Declaration, Invalid, Invalid, "sequence-members", "sequence" ) \
313 ML_TYPE(DecDictionaryMembers,Declaration, Invalid, Invalid, "dictionary-members", "dictionary" ) \
314 ML_TYPE(TypedefMembers, Detailed, Invalid, Invalid, "doc-typedef-members", "" ) \
315 ML_TYPE(EnumMembers, Detailed, Invalid, Invalid, "doc-enum-members", "" ) \
316 ML_TYPE(EnumValMembers, Detailed, Invalid, Invalid, "doc-enum-val-members", "" ) \
317 ML_TYPE(FunctionMembers, Detailed, Invalid, Invalid, "doc-func-members", "" ) \
318 ML_TYPE(RelatedMembers, Detailed, Invalid, Invalid, "doc-related-members", "" ) \
319 ML_TYPE(VariableMembers, Detailed, Invalid, Invalid, "doc-variable-members", "" ) \
320 ML_TYPE(PropertyMembers, Detailed, Invalid, Invalid, "doc-property-members", "" ) \
321 ML_TYPE(EventMembers, Detailed, Invalid, Invalid, "doc-event-members", "" ) \
322 ML_TYPE(Constructors, Detailed, Invalid, Invalid, "doc-constructors", "" ) \
323 ML_TYPE(InterfaceMembers, Detailed, Invalid, Invalid, "interface-members", "" ) \
324 ML_TYPE(ServiceMembers, Detailed, Invalid, Invalid, "service-members", "" ) \
325 ML_TYPE(DocDefineMembers, Documentation,Invalid, Invalid, "doc-define-members", "" ) \
326 ML_TYPE(DocProtoMembers, Documentation,Invalid, Invalid, "doc-proto-members", "" ) \
327 ML_TYPE(DocTypedefMembers, Documentation,Invalid, Invalid, "doc-typedef-members", "" ) \
328 ML_TYPE(DocEnumMembers, Documentation,Invalid, Invalid, "doc-enum-members", "" ) \
329 ML_TYPE(DocFuncMembers, Documentation,Invalid, Invalid, "doc-func-members", "" ) \
330 ML_TYPE(DocVarMembers, Documentation,Invalid, Invalid, "doc-var-members", "" ) \
331 ML_TYPE(DocEnumValMembers, Documentation,Invalid, Invalid, "doc-enum-val-members", "" ) \
332 ML_TYPE(DocPubSlotMembers, Documentation,Invalid, Invalid, "doc-pub-slot-members", "" ) \
333 ML_TYPE(DocProSlotMembers, Documentation,Invalid, Invalid, "doc-pro-slot-members", "" ) \
334 ML_TYPE(DocPriSlotMembers, Documentation,Invalid, Invalid, "doc-pri-slot-members", "" ) \
335 ML_TYPE(DocSignalMembers, Documentation,Invalid, Invalid, "doc-signal-members", "" ) \
336 ML_TYPE(DocEventMembers, Documentation,Invalid, Invalid, "doc-event-members", "" ) \
337 ML_TYPE(DocFriendMembers, Documentation,Invalid, Invalid, "doc-friend-members", "" ) \
338 ML_TYPE(DocPropMembers, Documentation,Invalid, Invalid, "doc-prop-members", "" ) \
339 ML_TYPE(DocSequenceMembers, Documentation,Invalid, Invalid, "doc-sequence-members", "" ) \
340 ML_TYPE(DocDictionaryMembers,Documentation,Invalid, Invalid, "doc-dictionary-members","" ) \
341
342/** Wrapper class for the MemberListType type. Can be set only during construction.
343 * Packs the type together with category flags.
344 */
346{
348 {
349 Public = (1<<16),
350 Protected = (1<<17),
351 Package = (1<<18),
352 Private = (1<<19),
353 OnlyPublic = (1<<20),
354 Detailed = (1<<21),
355 Declaration = (1<<22),
356 Documentation = (1<<23),
357 TypeMask = 0x0000FFFF,
358 CategoryMask = 0xFFFF0000
359 };
360
362 {
364#define ML_TYPE(x,bits,to_pub,to_prot,label,xml_str) \
365 x##_,
367#undef ML_TYPE
368 };
369
370 public:
371 static constexpr MemberListType Invalid() noexcept { return MemberListType(Invalid_); }
372 constexpr bool isInvalid() const noexcept { return m_type==Invalid_; }
373#define ML_TYPE(x,bits,to_pub,to_prot,label,xml_str) \
374 static MemberListType x() { return MemberListType(static_cast<int>(x##_)|static_cast<int>(bits)); } \
375 constexpr bool is##x() const noexcept { return (m_type&TypeMask)==x##_; }
377#undef ML_TYPE
378 constexpr bool isPublic() const noexcept { return (m_type & Public)!=0; }
379 constexpr bool isOnlyPublic() const noexcept { return (m_type & OnlyPublic)!=0; }
380 constexpr bool isProtected() const noexcept { return (m_type & Protected)!=0; }
381 constexpr bool isPackage() const noexcept { return (m_type & Package)!=0; }
382 constexpr bool isPrivate() const noexcept { return (m_type & Private)!=0; }
383 constexpr bool isDetailed() const noexcept { return (m_type & Detailed)!=0; }
384 constexpr bool isDeclaration() const noexcept { return (m_type & Declaration)!=0; }
385 constexpr bool isDocumentation() const noexcept { return (m_type & Documentation)!=0; }
386 std::string to_string() const
387 {
388 switch (type())
389 {
390 case Invalid_: return "[Invalid]";
391#define ML_TYPE(x,bits,to_pub,to_prot,label,xml_str) \
392 case x##_ : return "["+std::string(#x)+bits_to_string()+"]";
394#undef ML_TYPE
395 }
396 return "[unknown]";
397 }
398 constexpr int to_int() const noexcept
399 {
400 return m_type!=Invalid_ ? m_type&TypeMask : -1;
401 }
402 constexpr const char *toLabel() const noexcept
403 {
404 switch (type())
405 {
406 case Invalid_: return "";
407#define ML_TYPE(x,bits,to_pub,to_prot,label,xml_str) \
408 case x##_ : return label;
410#undef ML_TYPE
411 }
412 return "";
413 }
414 constexpr const char *toXML() const noexcept
415 {
416 switch (type())
417 {
418 case Invalid_: return "";
419#define ML_TYPE(x,bits,to_pub,to_prot,label,xml_str) \
420 case x##_ : return xml_str;
422#undef ML_TYPE
423 }
424 return "";
425 }
426 constexpr MemberListType toPublic() const noexcept
427 {
428 switch (type())
429 {
430 case Invalid_: return Invalid();
431#define ML_TYPE(x,bits,to_pub,to_prot,label,xml_str) \
432 case x##_ : return to_pub();
434#undef ML_TYPE
435 }
436 return Invalid();
437 }
438 constexpr MemberListType toProtected() const noexcept
439 {
440 switch (type())
441 {
442 case Invalid_: return Invalid();
443#define ML_TYPE(x,bits,to_pub,to_prot,label,xml_str) \
444 case x##_ : return to_prot();
446#undef ML_TYPE
447 }
448 return Invalid();
449 }
450 friend inline bool operator==(const MemberListType &t1,const MemberListType &t2) { return t1.m_type==t2.m_type; }
451 friend inline bool operator!=(const MemberListType &t1,const MemberListType &t2) { return !(operator==(t1,t2)); }
452
453 private:
454 explicit constexpr MemberListType(int t) noexcept : m_type(t) {}
455 std::string bits_to_string() const
456 {
457 std::string result;
458 if (m_type&Public) result+=",Public";
459 if (m_type&Protected) result+=",Protected";
460 if (m_type&Package) result+=",Package";
461 if (m_type&Private) result+=",Private";
462 if (m_type&OnlyPublic) result+=",OnlyPublic";
463 if (m_type&Detailed) result+=",Detailed";
464 if (m_type&Documentation) result+=",Documentation";
465 return result;
466 }
467 constexpr TypeName type() const noexcept { return static_cast<TypeName>(m_type & TypeMask); }
468 int m_type = static_cast<int>(Invalid_);
469};
470
479
514
515constexpr const char *codeSymbolType2Str(CodeSymbolType type) noexcept
516{
517 switch (type)
518 {
519 case CodeSymbolType::Class: return "class";
520 case CodeSymbolType::Struct: return "struct";
521 case CodeSymbolType::Union: return "union";
522 case CodeSymbolType::Interface: return "interface";
523 case CodeSymbolType::Protocol: return "protocol";
524 case CodeSymbolType::Category: return "category";
525 case CodeSymbolType::Exception: return "exception";
526 case CodeSymbolType::Service: return "service";
527 case CodeSymbolType::Singleton: return "singleton";
528 case CodeSymbolType::Concept: return "concept";
529 case CodeSymbolType::Namespace: return "namespace";
530 case CodeSymbolType::Package: return "package";
531 case CodeSymbolType::Define: return "define";
532 case CodeSymbolType::Function: return "function";
533 case CodeSymbolType::Variable: return "variable";
534 case CodeSymbolType::Typedef: return "typedef";
535 case CodeSymbolType::EnumValue: return "enumvalue";
536 case CodeSymbolType::Enumeration: return "enumeration";
537 case CodeSymbolType::Signal: return "signal";
538 case CodeSymbolType::Slot: return "slot";
539 case CodeSymbolType::Friend: return "friend";
540 case CodeSymbolType::DCOP: return "dcop";
541 case CodeSymbolType::Property: return "property";
542 case CodeSymbolType::Event: return "event";
543 case CodeSymbolType::Sequence: return "sequence";
544 case CodeSymbolType::Dictionary: return "dictionary";
545 default:
546 return nullptr;
547 }
548}
549
550
551#define MEMBERTYPE_SPECIFICATIONS \
552 MEMBERTYPE(Define, define, false) \
553 MEMBERTYPE(Function, function, true) \
554 MEMBERTYPE(Variable, variable, false) \
555 MEMBERTYPE(Typedef, typedef, false) \
556 MEMBERTYPE(Enumeration, enum, false) \
557 MEMBERTYPE(EnumValue, enumvalue, false) \
558 MEMBERTYPE(Signal, signal, true) \
559 MEMBERTYPE(Slot, slot, true) \
560 MEMBERTYPE(Friend, friend, true) \
561 MEMBERTYPE(DCOP, dcop, true) \
562 MEMBERTYPE(Property, property, false) \
563 MEMBERTYPE(Event, event, false) \
564 MEMBERTYPE(Interface, interface, false) \
565 MEMBERTYPE(Service, service, false) \
566 MEMBERTYPE(Sequence, sequence, false) \
567 MEMBERTYPE(Dictionary, dictionary, false)
568
569enum class MemberType {
570#define MEMBERTYPE(x,y,z) x,
572#undef MEMBERTYPE
573};
574
575[[maybe_unused]] static constexpr const char *to_string(MemberType mt) noexcept
576{
577 const char *result = "Unknown";
578 switch (mt)
579 {
580#define MEMBERTYPE(x,y,z) case MemberType::x: result = #x; break;
582#undef MEMBERTYPE
583 }
584 return result;
585}
586
587[[maybe_unused]] static constexpr const char *to_string_lower(MemberType mt) noexcept
588{
589 const char *result = "unknown";
590 switch (mt)
591 {
592#define MEMBERTYPE(x,y,z) case MemberType::x: result = #y; break;
594#undef MEMBERTYPE
595 }
596 return result;
597}
598
599[[maybe_unused]] static constexpr bool to_isFunction(MemberType mt) noexcept
600{
601 bool result = false;
602 switch (mt)
603 {
604#define MEMBERTYPE(x,y,z) case MemberType::x: result = z; break;
606#undef MEMBERTYPE
607 }
608 return result;
609}
610
617
618
620{
621 public:
622 enum Type {
623 None = 0, // initial value
624 Html = 0, // index / also to be used as bit position in mask (1 << Html)
625 Latex = 1, // ...
626 Xml = 2, // ...
627 Docbook = 3, // ...
628 numTocTypes = 4 // number of enum values
629 };
630
631 // setters
632 constexpr void enableHtml(int level) noexcept
633 {
634 m_mask|=(1<<Html);
635 m_level[Html]=level;
636 }
637 constexpr void enableLatex(int level) noexcept
638 {
639 m_mask|=(1<<Latex);
640 m_level[Latex]=level;
641 }
642 constexpr void enableXml(int level) noexcept
643 {
644 m_mask|=(1<<Xml);
645 m_level[Xml]=level;
646 }
647 constexpr void enableDocbook(int level) noexcept
648 {
649 m_mask|=(1<<Docbook);
650 m_level[Docbook]=level;
651 }
652
653 // getters
654 constexpr bool isHtmlEnabled() const noexcept { return (m_mask & (1<<Html))!=0; }
655 constexpr bool isLatexEnabled() const noexcept { return (m_mask & (1<<Latex))!=0; }
656 constexpr bool isXmlEnabled() const noexcept { return (m_mask & (1<<Xml))!=0; }
657 constexpr bool isDocbookEnabled() const noexcept { return (m_mask & (1<<Docbook))!=0; }
658 constexpr bool nothingEnabled() const noexcept { return m_mask == None; }
659 constexpr int htmlLevel() const noexcept { return m_level[Html]; }
660 constexpr int latexLevel() const noexcept { return m_level[Latex]; }
661 constexpr int xmlLevel() const noexcept { return m_level[Xml]; }
662 constexpr int docbookLevel() const noexcept { return m_level[Docbook]; }
663 constexpr int mask() const noexcept { return m_mask; }
664
665 private:
668};
669
670//---------------------------------------------------------------------------------------
671
672// clang-format off
673#define TYPE_SPECIFIERS \
674/* 0 */ TSPEC0(Template) TSPEC(Generic) TSPEC(Ref) TSPEC(Value) TSPEC(Interface) \
675/* 5 */ TSPEC(Struct) TSPEC(Union) TSPEC(Exception) TSPEC(Protocol) TSPEC(Category) \
676/* 10 */ TSPEC(SealedClass) TSPEC(AbstractClass) TSPEC(Enum) TSPEC(Service) TSPEC(Singleton) \
677/* 15 */ TSPEC(ForwardDecl) TSPEC(Local) TSPEC(EnumStruct) TSPEC(ConstExpr) TSPEC(PrivateGettable) \
678/* 20 */ TSPEC(ProtectedGettable) TSPEC(PrivateSettable) TSPEC(ProtectedSettable) TSPEC(Inline) TSPEC(Explicit) \
679/* 25 */ TSPEC(Mutable) TSPEC(Settable) TSPEC(Gettable) TSPEC(Readable) TSPEC(Writable) \
680/* 30 */ TSPEC(Final) TSPEC(Abstract) TSPEC(Addable) TSPEC(Removable) TSPEC(Raisable) \
681/* 35 */ TSPEC(Override) TSPEC(New) TSPEC(Sealed) TSPEC(Initonly) TSPEC(Optional) \
682/* 40 */ TSPEC(Required) TSPEC(NonAtomic) TSPEC(Copy) TSPEC(Retain) TSPEC(Assign) \
683/* 45 */ TSPEC(Strong) TSPEC(Weak) TSPEC(Unretained) TSPEC(Alias) TSPEC(ConstExp) \
684/* 50 */ TSPEC(Default) TSPEC(Delete) TSPEC(NoExcept) TSPEC(Attribute) TSPEC(Property) \
685/* 55 */ TSPEC(Readonly) TSPEC(Bound) TSPEC(Constrained) TSPEC(Transient) TSPEC(MaybeVoid) \
686/* 60 */ TSPEC(MaybeDefault) TSPEC(MaybeAmbiguous) TSPEC(Published) TSPEC(ConstEval) TSPEC(ConstInit) \
687/* 65 */ TSPEC(NoDiscard) TSPEC(ThreadLocal)
688// clang-format on
689
690/** Wrapper class for a number of boolean properties.
691 * The properties are packed together, and initialized to false.
692 */
694{
695 public:
696 constexpr TypeSpecifier() noexcept :
697#define TSPEC(x) ,m_is##x(0)
698#define TSPEC0(x) m_is##x(0)
700#undef TSPEC0
701#undef TSPEC
702 {}
703
704 constexpr void reset() noexcept
705 {
706#define TSPEC(x) m_is##x = 0;
707#define TSPEC0(x) TSPEC(x)
709#undef TSPEC0
710#undef TSPEC
711 }
712
713 constexpr void merge(const TypeSpecifier &other) noexcept
714 {
715#define TSPEC(x) m_is##x = m_is##x || other.is##x();
716#define TSPEC0(x) TSPEC(x)
718#undef TSPEC0
719#undef TSPEC
720 }
721
722 friend inline bool operator==(const TypeSpecifier &t1,const TypeSpecifier &t2)
723 {
724 bool eq = true;
725#define TSPEC(x) eq = eq && (t1.m_is##x == t2.m_is##x);
726#define TSPEC0(x) TSPEC(x)
728#undef TSPEC0
729#undef TSPEC
730 return eq;
731 }
732
733 friend inline bool operator!=(const TypeSpecifier &t1,const TypeSpecifier &t2)
734 {
735 return !(operator==(t1,t2));
736 }
737
738 std::string to_string() const
739 {
740 std::string result="[";
741 bool first=true;
742#define TSPEC(x) \
743 if (m_is##x) { \
744 if (!first) result+=","; \
745 result+=#x; first=false; \
746 }
747#define TSPEC0(x) TSPEC(x)
749#undef TSPEC0
750#undef TSPEC
751 result+="]";
752 return result;
753 }
754
755 // generate getter and setter for each property
756#define TSPEC(x) \
757 public: \
758 constexpr TypeSpecifier &set##x(bool b) noexcept { m_is##x = b; return *this; } \
759 constexpr bool is##x() const noexcept { return m_is##x; } \
760 private: \
761 bool m_is##x : 1;
762#define TSPEC0(x) TSPEC(x)
764#undef TSPEC0
765#undef TSPEC
766
767};
768
800
801
802// Type Categories (or'ed)
803#define ENTRY_TYPES \
804 ETYPE(Empty, None) \
805 ETYPE(Class, Compound|Scope) \
806 ETYPE(Namespace, Scope) \
807 ETYPE(Concept, None) \
808 ETYPE(ConceptCodePart, None) \
809 ETYPE(ConceptDocPart, None) \
810 ETYPE(ClassDoc, CompoundDoc|Doc) \
811 ETYPE(StructDoc, CompoundDoc|Doc) \
812 ETYPE(UnionDoc, CompoundDoc|Doc) \
813 ETYPE(ExceptionDoc, CompoundDoc|Doc) \
814 ETYPE(InterfaceDoc, CompoundDoc|Doc) \
815 ETYPE(ProtocolDoc, CompoundDoc|Doc) \
816 ETYPE(CategoryDoc, CompoundDoc|Doc) \
817 ETYPE(ServiceDoc, CompoundDoc|Doc) \
818 ETYPE(SingletonDoc, CompoundDoc|Doc) \
819 ETYPE(Source, File) \
820 ETYPE(Header, File) \
821 ETYPE(ModuleDoc, Doc) \
822 ETYPE(ConceptDoc, Doc) \
823 ETYPE(NamespaceDoc, Doc) \
824 ETYPE(EnumDoc, Doc) \
825 ETYPE(PageDoc, Doc) \
826 ETYPE(MemberDoc, Doc) \
827 ETYPE(OverloadDoc, Doc) \
828 ETYPE(Example, Doc) \
829 ETYPE(VariableDoc, Doc) \
830 ETYPE(FileDoc, Doc) \
831 ETYPE(DefineDoc, Doc) \
832 ETYPE(GroupDoc, Doc) \
833 ETYPE(RequirementDoc, Doc) \
834 ETYPE(MainpageDoc, Doc) \
835 ETYPE(MemberGrp, Doc) \
836 ETYPE(PackageDoc, Doc) \
837 ETYPE(DirDoc, Doc) \
838 ETYPE(Variable, None) \
839 ETYPE(Function, None) \
840 ETYPE(Typedef, None) \
841 ETYPE(Include, None) \
842 ETYPE(Enum, None) \
843 ETYPE(Define, None) \
844 ETYPE(UsingDir, None) \
845 ETYPE(UsingDecl, None) \
846 ETYPE(Package, None) \
847 ETYPE(ObjcImpl, None) \
848 ETYPE(ExportedInterface, None) \
849 ETYPE(IncludedService, None) \
850 ETYPE(ExampleLineno, Doc) \
851
852/** Wrapper class for the Entry type. Can be set only during construction.
853 * Packs the type together with category flags.
854 */
856{
857 public:
858#define ETYPE(x,bits) \
859 static constexpr EntryType make##x() noexcept { return EntryType(static_cast<int>(x)|static_cast<int>(bits)); } \
860 constexpr bool is##x() const noexcept { return (m_type&TypeMask)==x; }
862#undef ETYPE
863 constexpr bool isCompound() const noexcept { return (m_type & Compound)!=0; }
864 constexpr bool isScope() const noexcept { return (m_type & Scope)!=0; }
865 constexpr bool isFile() const noexcept { return (m_type & File)!=0; }
866 constexpr bool isCompoundDoc() const noexcept { return (m_type & CompoundDoc)!=0; }
867 constexpr bool isDoc() const noexcept { return (m_type & Doc)!=0; }
868 std::string to_string() const
869 {
870 switch (type())
871 {
872#define ETYPE(x,bits) \
873 case x : return "["+std::string(#x)+bits_to_string()+"]";
875#undef ETYPE
876 }
877 return "[unknown]";
878 }
879 friend inline bool operator==(const EntryType &t1,const EntryType &t2) { return t1.m_type==t2.m_type; }
880 friend inline bool operator!=(const EntryType &t1,const EntryType &t2) { return !(operator==(t1,t2)); }
881
882 private:
884 {
885#define ETYPE(x,bits) \
886 x,
888#undef ETYPE
889 };
890
892 {
893 None = 0,
894 Compound = (1<<16),
895 Scope = (1<<17),
896 File = (1<<18),
897 CompoundDoc = (1<<19),
898 Doc = (1<<20),
899 TypeMask = 0x0000FFFF,
900 CategoryMask = 0xFFFF0000
901 };
902 explicit constexpr EntryType(int t) noexcept : m_type(t) {}
903 std::string bits_to_string() const
904 {
905 std::string result;
906 if (m_type&Compound) result+=",Compound";
907 if (m_type&Scope) result+=",Scope";
908 if (m_type&File) result+=",File";
909 if (m_type&CompoundDoc) result+=",CompoundDoc";
910 return result;
911 }
912 constexpr TypeName type() const noexcept { return static_cast<TypeName>(m_type & TypeMask); }
913 unsigned int m_type = Empty;
914};
915
916
917#endif
A class representing a macro definition.
Definition define.h:31
unsigned int m_type
Definition types.h:913
TypeName
Definition types.h:884
@ ENTRY_TYPES
Definition types.h:887
constexpr bool isCompoundDoc() const noexcept
Definition types.h:866
constexpr bool isFile() const noexcept
Definition types.h:865
constexpr bool isDoc() const noexcept
Definition types.h:867
ENTRY_TYPES constexpr bool isCompound() const noexcept
Definition types.h:863
std::string to_string() const
Definition types.h:868
friend bool operator!=(const EntryType &t1, const EntryType &t2)
Definition types.h:880
constexpr EntryType(int t) noexcept
Definition types.h:902
CategoryBits
Definition types.h:892
@ None
Definition types.h:893
@ Scope
Definition types.h:895
@ File
Definition types.h:896
@ CategoryMask
Definition types.h:900
@ Compound
Definition types.h:894
@ TypeMask
Definition types.h:899
@ Doc
Definition types.h:898
@ CompoundDoc
Definition types.h:897
constexpr TypeName type() const noexcept
Definition types.h:912
friend bool operator==(const EntryType &t1, const EntryType &t2)
Definition types.h:879
std::string bits_to_string() const
Definition types.h:903
constexpr bool isScope() const noexcept
Definition types.h:864
constexpr int docbookLevel() const noexcept
Definition types.h:662
constexpr void enableHtml(int level) noexcept
Definition types.h:632
constexpr int latexLevel() const noexcept
Definition types.h:660
constexpr bool isXmlEnabled() const noexcept
Definition types.h:656
constexpr void enableLatex(int level) noexcept
Definition types.h:637
constexpr void enableDocbook(int level) noexcept
Definition types.h:647
@ Xml
Definition types.h:626
@ None
Definition types.h:623
@ Html
Definition types.h:624
@ Docbook
Definition types.h:627
@ Latex
Definition types.h:625
@ numTocTypes
Definition types.h:628
int m_level[numTocTypes]
Definition types.h:667
constexpr bool nothingEnabled() const noexcept
Definition types.h:658
int m_mask
Definition types.h:666
constexpr int mask() const noexcept
Definition types.h:663
constexpr void enableXml(int level) noexcept
Definition types.h:642
constexpr bool isDocbookEnabled() const noexcept
Definition types.h:657
constexpr bool isLatexEnabled() const noexcept
Definition types.h:655
constexpr int htmlLevel() const noexcept
Definition types.h:659
constexpr int xmlLevel() const noexcept
Definition types.h:661
constexpr bool isHtmlEnabled() const noexcept
Definition types.h:654
constexpr bool isDocumentation() const noexcept
Definition types.h:385
constexpr bool isOnlyPublic() const noexcept
Definition types.h:379
constexpr const char * toLabel() const noexcept
Definition types.h:402
constexpr int to_int() const noexcept
Definition types.h:398
constexpr bool isPrivate() const noexcept
Definition types.h:382
constexpr MemberListType toPublic() const noexcept
Definition types.h:426
constexpr bool isInvalid() const noexcept
Definition types.h:372
constexpr bool isPackage() const noexcept
Definition types.h:381
constexpr const char * toXML() const noexcept
Definition types.h:414
static constexpr MemberListType Invalid() noexcept
Definition types.h:371
friend bool operator==(const MemberListType &t1, const MemberListType &t2)
Definition types.h:450
constexpr TypeName type() const noexcept
Definition types.h:467
friend bool operator!=(const MemberListType &t1, const MemberListType &t2)
Definition types.h:451
constexpr bool isDeclaration() const noexcept
Definition types.h:384
std::string to_string() const
Definition types.h:386
constexpr MemberListType toProtected() const noexcept
Definition types.h:438
constexpr bool isProtected() const noexcept
Definition types.h:380
constexpr bool isDetailed() const noexcept
Definition types.h:383
std::string bits_to_string() const
Definition types.h:455
constexpr MemberListType(int t) noexcept
Definition types.h:454
ML_TYPES constexpr bool isPublic() const noexcept
Definition types.h:378
This is an alternative implementation of QCString.
Definition qcstring.h:103
std::string to_string() const
Definition types.h:738
constexpr TypeSpecifier() noexcept
Definition types.h:696
friend bool operator!=(const TypeSpecifier &t1, const TypeSpecifier &t2)
Definition types.h:733
bool operator==(const DirIterator &it1, const DirIterator &it2)
Definition dir.cpp:160
QCString groupname
name of the group
Definition types.h:257
static constexpr const char * getGroupPriName(GroupPri_t priority) noexcept
Definition types.h:240
GroupPri_t
Grouping priority.
Definition types.h:230
@ GROUPING_LOWEST
Definition types.h:231
@ GROUPING_AUTO_ADD
membership in group was defined via @add[to]group
Definition types.h:233
@ GROUPING_INGROUP
membership in group was defined by @ingroup
Definition types.h:236
@ GROUPING_AUTO_WEAK
membership in group was defined via @weakgroup
Definition types.h:232
@ GROUPING_AUTO_HIGHEST
Definition types.h:235
@ GROUPING_AUTO_DEF
membership in group was defined via @defgroup
Definition types.h:234
@ GROUPING_HIGHEST
Definition types.h:237
Grouping(const QCString &gn, GroupPri_t p)
Definition types.h:256
GroupPri_t pri
priority of this definition
Definition types.h:258
MethodTypes
Definition types.h:119
#define ML_TYPES
Definition types.h:263
static constexpr const char * to_string_lower_class(Protection prot) noexcept
Definition types.h:62
#define PROTECTION_SPECIFICATIONS
Protection level of members.
Definition types.h:26
constexpr const char * codeSymbolType2Str(CodeSymbolType type) noexcept
Definition types.h:515
#define SRCLANGEXT_SPECIFICATIONS
Language as given by extension.
Definition types.h:186
#define MEMBERTYPE_SPECIFICATIONS
Definition types.h:551
#define TYPE_SPECIFIERS
Definition types.h:673
#define RELATIONSHIP_SPECIFICATIONS
Kind of member relationship.
Definition types.h:162
CodeSymbolType
Definition types.h:481
static constexpr bool to_isFunction(MemberType mt) noexcept
Definition types.h:599
MemberType
Definition types.h:569
MemberListContainer
Definition types.h:472
#define ENTRY_TYPES
Definition types.h:803
Protection
Definition types.h:32
SrcLangExt
Definition types.h:207
Relationship
Definition types.h:167
RelatesType
Definition types.h:143
#define METHODTYPE_SPECIFICATIONS
Kind of method.
Definition types.h:111
Specifier
Definition types.h:80
static constexpr const char * to_string_lower(Protection prot) noexcept
Definition types.h:50
VhdlSpecifier
Definition types.h:770
@ INSTANTIATION
Definition types.h:791
@ MISCELLANEOUS
Definition types.h:797
@ SHAREDVARIABLE
Definition types.h:794
FortranFormat
Definition types.h:612
#define SPECIFIER_SPECIFICATIONS
Virtualness of a member.
Definition types.h:75
static constexpr const char * to_string(Protection prot) noexcept
Definition types.h:38
#define RELATESTYPE_SPECIFICATIONS
Type of member relation.
Definition types.h:138