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
570
577
578
580{
581 public:
582 enum Type {
583 None = 0, // initial value
584 Html = 0, // index / also to be used as bit position in mask (1 << Html)
585 Latex = 1, // ...
586 Xml = 2, // ...
587 Docbook = 3, // ...
588 numTocTypes = 4 // number of enum values
589 };
590
591 // setters
592 constexpr void enableHtml(int level) noexcept
593 {
594 m_mask|=(1<<Html);
595 m_level[Html]=level;
596 }
597 constexpr void enableLatex(int level) noexcept
598 {
599 m_mask|=(1<<Latex);
600 m_level[Latex]=level;
601 }
602 constexpr void enableXml(int level) noexcept
603 {
604 m_mask|=(1<<Xml);
605 m_level[Xml]=level;
606 }
607 constexpr void enableDocbook(int level) noexcept
608 {
609 m_mask|=(1<<Docbook);
610 m_level[Docbook]=level;
611 }
612
613 // getters
614 constexpr bool isHtmlEnabled() const noexcept { return (m_mask & (1<<Html))!=0; }
615 constexpr bool isLatexEnabled() const noexcept { return (m_mask & (1<<Latex))!=0; }
616 constexpr bool isXmlEnabled() const noexcept { return (m_mask & (1<<Xml))!=0; }
617 constexpr bool isDocbookEnabled() const noexcept { return (m_mask & (1<<Docbook))!=0; }
618 constexpr bool nothingEnabled() const noexcept { return m_mask == None; }
619 constexpr int htmlLevel() const noexcept { return m_level[Html]; }
620 constexpr int latexLevel() const noexcept { return m_level[Latex]; }
621 constexpr int xmlLevel() const noexcept { return m_level[Xml]; }
622 constexpr int docbookLevel() const noexcept { return m_level[Docbook]; }
623 constexpr int mask() const noexcept { return m_mask; }
624
625 private:
628};
629
630//---------------------------------------------------------------------------------------
631
632// clang-format off
633#define TYPE_SPECIFIERS \
634/* 0 */ TSPEC0(Template) TSPEC(Generic) TSPEC(Ref) TSPEC(Value) TSPEC(Interface) \
635/* 5 */ TSPEC(Struct) TSPEC(Union) TSPEC(Exception) TSPEC(Protocol) TSPEC(Category) \
636/* 10 */ TSPEC(SealedClass) TSPEC(AbstractClass) TSPEC(Enum) TSPEC(Service) TSPEC(Singleton) \
637/* 15 */ TSPEC(ForwardDecl) TSPEC(Local) TSPEC(EnumStruct) TSPEC(ConstExpr) TSPEC(PrivateGettable) \
638/* 20 */ TSPEC(ProtectedGettable) TSPEC(PrivateSettable) TSPEC(ProtectedSettable) TSPEC(Inline) TSPEC(Explicit) \
639/* 25 */ TSPEC(Mutable) TSPEC(Settable) TSPEC(Gettable) TSPEC(Readable) TSPEC(Writable) \
640/* 30 */ TSPEC(Final) TSPEC(Abstract) TSPEC(Addable) TSPEC(Removable) TSPEC(Raisable) \
641/* 35 */ TSPEC(Override) TSPEC(New) TSPEC(Sealed) TSPEC(Initonly) TSPEC(Optional) \
642/* 40 */ TSPEC(Required) TSPEC(NonAtomic) TSPEC(Copy) TSPEC(Retain) TSPEC(Assign) \
643/* 45 */ TSPEC(Strong) TSPEC(Weak) TSPEC(Unretained) TSPEC(Alias) TSPEC(ConstExp) \
644/* 50 */ TSPEC(Default) TSPEC(Delete) TSPEC(NoExcept) TSPEC(Attribute) TSPEC(Property) \
645/* 55 */ TSPEC(Readonly) TSPEC(Bound) TSPEC(Constrained) TSPEC(Transient) TSPEC(MaybeVoid) \
646/* 60 */ TSPEC(MaybeDefault) TSPEC(MaybeAmbiguous) TSPEC(Published) TSPEC(ConstEval) TSPEC(ConstInit) \
647/* 65 */ TSPEC(NoDiscard) TSPEC(ThreadLocal)
648// clang-format on
649
650/** Wrapper class for a number of boolean properties.
651 * The properties are packed together, and initialized to false.
652 */
654{
655 public:
656 constexpr TypeSpecifier() noexcept :
657#define TSPEC(x) ,m_is##x(0)
658#define TSPEC0(x) m_is##x(0)
660#undef TSPEC0
661#undef TSPEC
662 {}
663
664 constexpr void reset() noexcept
665 {
666#define TSPEC(x) m_is##x = 0;
667#define TSPEC0(x) TSPEC(x)
669#undef TSPEC0
670#undef TSPEC
671 }
672
673 constexpr void merge(const TypeSpecifier &other) noexcept
674 {
675#define TSPEC(x) m_is##x = m_is##x || other.is##x();
676#define TSPEC0(x) TSPEC(x)
678#undef TSPEC0
679#undef TSPEC
680 }
681
682 friend inline bool operator==(const TypeSpecifier &t1,const TypeSpecifier &t2)
683 {
684 bool eq = true;
685#define TSPEC(x) eq = eq && (t1.m_is##x == t2.m_is##x);
686#define TSPEC0(x) TSPEC(x)
688#undef TSPEC0
689#undef TSPEC
690 return eq;
691 }
692
693 friend inline bool operator!=(const TypeSpecifier &t1,const TypeSpecifier &t2)
694 {
695 return !(operator==(t1,t2));
696 }
697
698 std::string to_string() const
699 {
700 std::string result="[";
701 bool first=true;
702#define TSPEC(x) \
703 if (m_is##x) { \
704 if (!first) result+=","; \
705 result+=#x; first=false; \
706 }
707#define TSPEC0(x) TSPEC(x)
709#undef TSPEC0
710#undef TSPEC
711 result+="]";
712 return result;
713 }
714
715 // generate getter and setter for each property
716#define TSPEC(x) \
717 public: \
718 constexpr TypeSpecifier &set##x(bool b) noexcept { m_is##x = b; return *this; } \
719 constexpr bool is##x() const noexcept { return m_is##x; } \
720 private: \
721 bool m_is##x : 1;
722#define TSPEC0(x) TSPEC(x)
724#undef TSPEC0
725#undef TSPEC
726
727};
728
760
761
762// Type Categories (or'ed)
763#define ENTRY_TYPES \
764 ETYPE(Empty, None) \
765 ETYPE(Class, Compound|Scope) \
766 ETYPE(Namespace, Scope) \
767 ETYPE(Concept, None) \
768 ETYPE(ClassDoc, CompoundDoc|Doc) \
769 ETYPE(StructDoc, CompoundDoc|Doc) \
770 ETYPE(UnionDoc, CompoundDoc|Doc) \
771 ETYPE(ExceptionDoc, CompoundDoc|Doc) \
772 ETYPE(InterfaceDoc, CompoundDoc|Doc) \
773 ETYPE(ProtocolDoc, CompoundDoc|Doc) \
774 ETYPE(CategoryDoc, CompoundDoc|Doc) \
775 ETYPE(ServiceDoc, CompoundDoc|Doc) \
776 ETYPE(SingletonDoc, CompoundDoc|Doc) \
777 ETYPE(Source, File) \
778 ETYPE(Header, File) \
779 ETYPE(ModuleDoc, Doc) \
780 ETYPE(ConceptDoc, Doc) \
781 ETYPE(NamespaceDoc, Doc) \
782 ETYPE(EnumDoc, Doc) \
783 ETYPE(PageDoc, Doc) \
784 ETYPE(MemberDoc, Doc) \
785 ETYPE(OverloadDoc, Doc) \
786 ETYPE(Example, Doc) \
787 ETYPE(VariableDoc, Doc) \
788 ETYPE(FileDoc, Doc) \
789 ETYPE(DefineDoc, Doc) \
790 ETYPE(GroupDoc, Doc) \
791 ETYPE(MainpageDoc, Doc) \
792 ETYPE(MemberGrp, Doc) \
793 ETYPE(PackageDoc, Doc) \
794 ETYPE(DirDoc, Doc) \
795 ETYPE(Variable, None) \
796 ETYPE(Function, None) \
797 ETYPE(Typedef, None) \
798 ETYPE(Include, None) \
799 ETYPE(Enum, None) \
800 ETYPE(Define, None) \
801 ETYPE(UsingDir, None) \
802 ETYPE(UsingDecl, None) \
803 ETYPE(Package, None) \
804 ETYPE(ObjcImpl, None) \
805 ETYPE(ExportedInterface, None) \
806 ETYPE(IncludedService, None) \
807 ETYPE(ExampleLineno, Doc) \
808
809/** Wrapper class for the Entry type. Can be set only during construction.
810 * Packs the type together with category flags.
811 */
813{
814 public:
815#define ETYPE(x,bits) \
816 static constexpr EntryType make##x() noexcept { return EntryType(static_cast<int>(x)|static_cast<int>(bits)); } \
817 constexpr bool is##x() const noexcept { return (m_type&TypeMask)==x; }
819#undef ETYPE
820 constexpr bool isCompound() const noexcept { return (m_type & Compound)!=0; }
821 constexpr bool isScope() const noexcept { return (m_type & Scope)!=0; }
822 constexpr bool isFile() const noexcept { return (m_type & File)!=0; }
823 constexpr bool isCompoundDoc() const noexcept { return (m_type & CompoundDoc)!=0; }
824 constexpr bool isDoc() const noexcept { return (m_type & Doc)!=0; }
825 std::string to_string() const
826 {
827 switch (type())
828 {
829#define ETYPE(x,bits) \
830 case x : return "["+std::string(#x)+bits_to_string()+"]";
832#undef ETYPE
833 }
834 return "[unknown]";
835 }
836 friend inline bool operator==(const EntryType &t1,const EntryType &t2) { return t1.m_type==t2.m_type; }
837 friend inline bool operator!=(const EntryType &t1,const EntryType &t2) { return !(operator==(t1,t2)); }
838
839 private:
841 {
842#define ETYPE(x,bits) \
843 x,
845#undef ETYPE
846 };
847
849 {
850 None = 0,
851 Compound = (1<<16),
852 Scope = (1<<17),
853 File = (1<<18),
854 CompoundDoc = (1<<19),
855 Doc = (1<<20),
856 TypeMask = 0x0000FFFF,
857 CategoryMask = 0xFFFF0000
858 };
859 explicit constexpr EntryType(int t) noexcept : m_type(t) {}
860 std::string bits_to_string() const
861 {
862 std::string result;
863 if (m_type&Compound) result+=",Compound";
864 if (m_type&Scope) result+=",Scope";
865 if (m_type&File) result+=",File";
866 if (m_type&CompoundDoc) result+=",CompoundDoc";
867 return result;
868 }
869 constexpr TypeName type() const noexcept { return static_cast<TypeName>(m_type & TypeMask); }
870 unsigned int m_type = Empty;
871};
872
873
874#endif
A class representing a macro definition.
Definition define.h:31
unsigned int m_type
Definition types.h:870
TypeName
Definition types.h:841
@ ENTRY_TYPES
Definition types.h:844
constexpr bool isCompoundDoc() const noexcept
Definition types.h:823
constexpr bool isFile() const noexcept
Definition types.h:822
constexpr bool isDoc() const noexcept
Definition types.h:824
ENTRY_TYPES constexpr bool isCompound() const noexcept
Definition types.h:820
std::string to_string() const
Definition types.h:825
friend bool operator!=(const EntryType &t1, const EntryType &t2)
Definition types.h:837
constexpr EntryType(int t) noexcept
Definition types.h:859
CategoryBits
Definition types.h:849
@ None
Definition types.h:850
@ Scope
Definition types.h:852
@ File
Definition types.h:853
@ CategoryMask
Definition types.h:857
@ Compound
Definition types.h:851
@ TypeMask
Definition types.h:856
@ Doc
Definition types.h:855
@ CompoundDoc
Definition types.h:854
constexpr TypeName type() const noexcept
Definition types.h:869
friend bool operator==(const EntryType &t1, const EntryType &t2)
Definition types.h:836
std::string bits_to_string() const
Definition types.h:860
constexpr bool isScope() const noexcept
Definition types.h:821
constexpr int docbookLevel() const noexcept
Definition types.h:622
constexpr void enableHtml(int level) noexcept
Definition types.h:592
constexpr int latexLevel() const noexcept
Definition types.h:620
constexpr bool isXmlEnabled() const noexcept
Definition types.h:616
constexpr void enableLatex(int level) noexcept
Definition types.h:597
constexpr void enableDocbook(int level) noexcept
Definition types.h:607
@ Xml
Definition types.h:586
@ None
Definition types.h:583
@ Html
Definition types.h:584
@ Docbook
Definition types.h:587
@ Latex
Definition types.h:585
@ numTocTypes
Definition types.h:588
int m_level[numTocTypes]
Definition types.h:627
constexpr bool nothingEnabled() const noexcept
Definition types.h:618
int m_mask
Definition types.h:626
constexpr int mask() const noexcept
Definition types.h:623
constexpr void enableXml(int level) noexcept
Definition types.h:602
constexpr bool isDocbookEnabled() const noexcept
Definition types.h:617
constexpr bool isLatexEnabled() const noexcept
Definition types.h:615
constexpr int htmlLevel() const noexcept
Definition types.h:619
constexpr int xmlLevel() const noexcept
Definition types.h:621
constexpr bool isHtmlEnabled() const noexcept
Definition types.h:614
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:101
std::string to_string() const
Definition types.h:698
constexpr TypeSpecifier() noexcept
Definition types.h:656
friend bool operator!=(const TypeSpecifier &t1, const TypeSpecifier &t2)
Definition types.h:693
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 TYPE_SPECIFIERS
Definition types.h:633
#define RELATIONSHIP_SPECIFICATIONS
Kind of member relationship.
Definition types.h:162
CodeSymbolType
Definition types.h:481
MemberType
Definition types.h:552
MemberListContainer
Definition types.h:472
#define ENTRY_TYPES
Definition types.h:763
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:730
@ INSTANTIATION
Definition types.h:751
@ MISCELLANEOUS
Definition types.h:757
@ SHAREDVARIABLE
Definition types.h:754
FortranFormat
Definition types.h:572
#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