doxygen
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 
26 enum class Protection { Public, Protected, Private, Package } ;
27 
29 enum class Specifier { Normal, Virtual, Pure } ;
30 
32 enum class MethodTypes { Method, Signal, Slot, DCOP, Property, Event };
33 
35 enum class RelatesType { Simple, Duplicate, MemberOf };
36 
38 enum class Relationship { Member, Related, Foreign };
39 
41 enum class SrcLangExt
42 {
43  Unknown = 0x00000,
44  IDL = 0x00008,
45  Java = 0x00010,
46  CSharp = 0x00020,
47  D = 0x00040,
48  PHP = 0x00080,
49  ObjC = 0x00100,
50  Cpp = 0x00200,
51  JS = 0x00400,
52  Python = 0x00800,
53  Fortran = 0x01000,
54  VHDL = 0x02000,
55  XML = 0x04000,
56  //Tcl = 0x08000, // no longer supported
57  Markdown = 0x10000,
58  SQL = 0x20000,
59  Slice = 0x40000,
60  Lex = 0x80000
61 };
62 
64 struct Grouping
65 {
68  {
69  GROUPING_LOWEST,
70  GROUPING_AUTO_WEAK = GROUPING_LOWEST,
73  GROUPING_AUTO_HIGHEST = GROUPING_AUTO_DEF,
75  GROUPING_HIGHEST = GROUPING_INGROUP
76  };
77 
78  static const char *getGroupPriName( GroupPri_t priority )
79  {
80  switch( priority )
81  {
82  case GROUPING_AUTO_WEAK:
83  return "@weakgroup";
84  case GROUPING_AUTO_ADD:
85  return "@addtogroup";
86  case GROUPING_AUTO_DEF:
87  return "@defgroup";
88  case GROUPING_INGROUP:
89  return "@ingroup";
90  }
91  return "???";
92  }
93 
94  Grouping( const QCString &gn, GroupPri_t p ) : groupname(gn), pri(p) {}
97 
98 };
99 
100 enum MemberListType
101 {
102  MemberListType_privateLists = 0x00800,
103  MemberListType_detailedLists = 0x01000,
104  MemberListType_declarationLists = 0x02000,
105  MemberListType_documentationLists = 0x04000,
106  MemberListType_exportedLists = 0x08000,
107  MemberListType_internalLists = 0x10000,
108 
109  MemberListType_undefined = -1,
110 
111  MemberListType_pubMethods = 0,
112  MemberListType_proMethods = 1,
113  MemberListType_pacMethods = 2,
114  MemberListType_priMethods = 3 + MemberListType_privateLists,
115  MemberListType_pubStaticMethods = 4,
116  MemberListType_proStaticMethods = 5,
117  MemberListType_pacStaticMethods = 6,
118  MemberListType_priStaticMethods = 7 + MemberListType_privateLists,
119  MemberListType_pubSlots = 8,
120  MemberListType_proSlots = 9,
121  MemberListType_priSlots = 10 + MemberListType_privateLists,
122  MemberListType_pubAttribs = 11,
123  MemberListType_proAttribs = 12,
124  MemberListType_pacAttribs = 13,
125  MemberListType_priAttribs = 14 + MemberListType_privateLists,
126  MemberListType_pubStaticAttribs = 15,
127  MemberListType_proStaticAttribs = 16,
128  MemberListType_pacStaticAttribs = 17,
129  MemberListType_priStaticAttribs = 18 + MemberListType_privateLists,
130  MemberListType_pubTypes = 19,
131  MemberListType_proTypes = 20,
132  MemberListType_pacTypes = 21,
133  MemberListType_priTypes = 22 + MemberListType_privateLists,
134  MemberListType_related = 23,
135  MemberListType_signals = 24,
136  MemberListType_friends = 25,
137  MemberListType_dcopMethods = 26,
138  MemberListType_properties = 27,
139  MemberListType_events = 28,
140 
141  MemberListType_typedefMembers = 29 + MemberListType_detailedLists,
142  MemberListType_enumMembers = 30 + MemberListType_detailedLists,
143  MemberListType_enumValMembers = 31 + MemberListType_detailedLists,
144  MemberListType_functionMembers = 32 + MemberListType_detailedLists,
145  MemberListType_relatedMembers = 33 + MemberListType_detailedLists,
146  MemberListType_variableMembers = 34 + MemberListType_detailedLists,
147  MemberListType_propertyMembers = 35 + MemberListType_detailedLists,
148  MemberListType_eventMembers = 36 + MemberListType_detailedLists,
149  MemberListType_constructors = 37 + MemberListType_detailedLists,
150 
151  MemberListType_allMembersList = 38,
152 
153  MemberListType_decDefineMembers = 39 + MemberListType_declarationLists,
154  MemberListType_decProtoMembers = 40 + MemberListType_declarationLists,
155  MemberListType_decTypedefMembers = 41 + MemberListType_declarationLists,
156  MemberListType_decEnumMembers = 42 + MemberListType_declarationLists,
157  MemberListType_decFuncMembers = 43 + MemberListType_declarationLists,
158  MemberListType_decVarMembers = 44 + MemberListType_declarationLists,
159  MemberListType_decEnumValMembers = 45 + MemberListType_declarationLists,
160  MemberListType_decPubSlotMembers = 46 + MemberListType_declarationLists,
161  MemberListType_decProSlotMembers = 47 + MemberListType_declarationLists,
162  MemberListType_decPriSlotMembers = 48 + MemberListType_declarationLists,
163  MemberListType_decSignalMembers = 49 + MemberListType_declarationLists,
164  MemberListType_decEventMembers = 50 + MemberListType_declarationLists,
165  MemberListType_decFriendMembers = 51 + MemberListType_declarationLists,
166  MemberListType_decPropMembers = 52 + MemberListType_declarationLists,
167 
168  MemberListType_docDefineMembers = 53 + MemberListType_documentationLists,
169  MemberListType_docProtoMembers = 54 + MemberListType_documentationLists,
170  MemberListType_docTypedefMembers = 55 + MemberListType_documentationLists,
171  MemberListType_docEnumMembers = 56 + MemberListType_documentationLists,
172  MemberListType_docFuncMembers = 57 + MemberListType_documentationLists,
173  MemberListType_docVarMembers = 58 + MemberListType_documentationLists,
174  MemberListType_docEnumValMembers = 59 + MemberListType_documentationLists,
175  MemberListType_docPubSlotMembers = 60 + MemberListType_documentationLists,
176  MemberListType_docProSlotMembers = 61 + MemberListType_documentationLists,
177  MemberListType_docPriSlotMembers = 62 + MemberListType_documentationLists,
178  MemberListType_docSignalMembers = 63 + MemberListType_documentationLists,
179  MemberListType_docEventMembers = 64 + MemberListType_documentationLists,
180  MemberListType_docFriendMembers = 65 + MemberListType_documentationLists,
181  MemberListType_docPropMembers = 66 + MemberListType_documentationLists,
182 
183  MemberListType_redefinedBy = 67,
184  MemberListType_enumFields = 68,
185  MemberListType_memberGroup = 69,
186 
187  // this one is for the summary section on the class page
188  MemberListType_interfaces = 70,
189  // this one is for the detailed section on the class page
190  MemberListType_interfaceMembers = 71 + MemberListType_detailedLists,
191  MemberListType_services = 72,
192  MemberListType_serviceMembers = 73 + MemberListType_detailedLists,
193 
194  MemberListType_decSequenceMembers = 74 + MemberListType_declarationLists,
195  MemberListType_docSequenceMembers = 75 + MemberListType_documentationLists,
196  MemberListType_decDictionaryMembers = 76 + MemberListType_declarationLists,
197  MemberListType_docDictionaryMembers = 77 + MemberListType_documentationLists,
198 };
199 
200 enum class MemberListContainer
201 {
202  File,
203  Namespace,
204  Group,
205  Class,
206  Module
207 };
208 
209 enum class CodeSymbolType
210 {
211  Default,
212  // Class types
213  Class,
214  Struct,
215  Union,
216  Interface,
217  Protocol,
218  Category,
219  Exception,
220  Service,
221  Singleton,
222  // Other container types
223  Concept,
224  Namespace,
225  Package,
226  Module,
227  // Member types
228  Define,
229  Function,
230  Variable,
231  Typedef,
232  EnumValue,
233  Enumeration,
234  Signal,
235  Slot,
236  Friend,
237  DCOP,
238  Property,
239  Event,
240  Sequence,
241  Dictionary
242 };
243 
244 constexpr const char *codeSymbolType2Str(CodeSymbolType type)
245 {
246  switch (type)
247  {
248  case CodeSymbolType::Class: return "class";
249  case CodeSymbolType::Struct: return "struct";
250  case CodeSymbolType::Union: return "union";
251  case CodeSymbolType::Interface: return "interface";
252  case CodeSymbolType::Protocol: return "protocol";
253  case CodeSymbolType::Category: return "category";
254  case CodeSymbolType::Exception: return "exception";
255  case CodeSymbolType::Service: return "service";
256  case CodeSymbolType::Singleton: return "singleton";
257  case CodeSymbolType::Concept: return "concept";
258  case CodeSymbolType::Namespace: return "namespace";
259  case CodeSymbolType::Package: return "package";
260  case CodeSymbolType::Define: return "define";
261  case CodeSymbolType::Function: return "function";
262  case CodeSymbolType::Variable: return "variable";
263  case CodeSymbolType::Typedef: return "typedef";
264  case CodeSymbolType::EnumValue: return "enumvalue";
265  case CodeSymbolType::Enumeration: return "enumeration";
266  case CodeSymbolType::Signal: return "signal";
267  case CodeSymbolType::Slot: return "slot";
268  case CodeSymbolType::Friend: return "friend";
269  case CodeSymbolType::DCOP: return "dcop";
270  case CodeSymbolType::Property: return "property";
271  case CodeSymbolType::Event: return "event";
272  case CodeSymbolType::Sequence: return "sequence";
273  case CodeSymbolType::Dictionary: return "dictionary";
274  default:
275  return nullptr;
276  }
277 }
278 
279 
280 enum MemberType
281 {
282  MemberType_Define,
283  MemberType_Function,
284  MemberType_Variable,
285  MemberType_Typedef,
286  MemberType_Enumeration,
287  MemberType_EnumValue,
288  MemberType_Signal,
289  MemberType_Slot,
290  MemberType_Friend,
291  MemberType_DCOP,
292  MemberType_Property,
293  MemberType_Event,
294  MemberType_Interface,
295  MemberType_Service,
296  MemberType_Sequence,
297  MemberType_Dictionary
298 };
299 
300 enum FortranFormat
301 {
302  FortranFormat_Unknown,
303  FortranFormat_Free,
304  FortranFormat_Fixed
305 };
306 
307 
308 class LocalToc
309 {
310  public:
311  enum Type {
312  None = 0, // initial value
313  Html = 0, // index / also to be used as bit position in mask (1 << Html)
314  Latex = 1, // ...
315  Xml = 2, // ...
316  Docbook = 3, // ...
317  numTocTypes = 4 // number of enum values
318  };
319  LocalToc() : m_mask(None) { memset(m_level,0,sizeof(m_level)); }
320 
321  // setters
322  void enableHtml(int level)
323  {
324  m_mask|=(1<<Html);
325  m_level[Html]=level;
326  }
327  void enableLatex(int level)
328  {
329  m_mask|=(1<<Latex);
330  m_level[Latex]=level;
331  }
332  void enableXml(int level)
333  {
334  m_mask|=(1<<Xml);
335  m_level[Xml]=level;
336  }
337  void enableDocbook(int level)
338  {
339  m_mask|=(1<<Docbook);
340  m_level[Docbook]=level;
341  }
342 
343  // getters
344  bool isHtmlEnabled() const { return (m_mask & (1<<Html))!=0; }
345  bool isLatexEnabled() const { return (m_mask & (1<<Latex))!=0; }
346  bool isXmlEnabled() const { return (m_mask & (1<<Xml))!=0; }
347  bool isDocbookEnabled() const { return (m_mask & (1<<Docbook))!=0; }
348  bool nothingEnabled() const { return m_mask == None; }
349  int htmlLevel() const { return m_level[Html]; }
350  int latexLevel() const { return m_level[Latex]; }
351  int xmlLevel() const { return m_level[Xml]; }
352  int docbookLevel() const { return m_level[Docbook]; }
353  int mask() const { return m_mask; }
354 
355  private:
356  int m_mask;
357  int m_level[numTocTypes];
358 };
359 
360 //---------------------------------------------------------------------------------------
361 
362 
363 #define TYPE_SPECIFIERS \
364 /* 0 */ TSPEC(Template) TSPEC(Generic) TSPEC(Ref) TSPEC(Value) TSPEC(Interface) \
365 /* 5 */ TSPEC(Struct) TSPEC(Union) TSPEC(Exception) TSPEC(Protocol) TSPEC(Category) \
366 /* 10 */ TSPEC(SealedClass) TSPEC(AbstractClass) TSPEC(Enum) TSPEC(Service) TSPEC(Singleton) \
367 /* 15 */ TSPEC(ForwardDecl) TSPEC(Local) TSPEC(EnumStruct) TSPEC(ConstExpr) TSPEC(PrivateGettable) \
368 /* 20 */ TSPEC(ProtectedGettable) TSPEC(PrivateSettable) TSPEC(ProtectedSettable) TSPEC(Inline) TSPEC(Explicit) \
369 /* 25 */ TSPEC(Mutable) TSPEC(Settable) TSPEC(Gettable) TSPEC(Readable) TSPEC(Writable) \
370 /* 30 */ TSPEC(Final) TSPEC(Abstract) TSPEC(Addable) TSPEC(Removable) TSPEC(Raisable) \
371 /* 35 */ TSPEC(Override) TSPEC(New) TSPEC(Sealed) TSPEC(Initonly) TSPEC(Optional) \
372 /* 40 */ TSPEC(Required) TSPEC(NonAtomic) TSPEC(Copy) TSPEC(Retain) TSPEC(Assign) \
373 /* 45 */ TSPEC(Strong) TSPEC(Weak) TSPEC(Unretained) TSPEC(Alias) TSPEC(ConstExp) \
374 /* 50 */ TSPEC(Default) TSPEC(Delete) TSPEC(NoExcept) TSPEC(Attribute) TSPEC(Property) \
375 /* 55 */ TSPEC(Readonly) TSPEC(Bound) TSPEC(Constrained) TSPEC(Transient) TSPEC(MaybeVoid) \
376 /* 60 */ TSPEC(MaybeDefault) TSPEC(MaybeAmbiguous) TSPEC(Published) TSPEC(ConstEval) TSPEC(ConstInit) \
377 /* 65 */ TSPEC(NoDiscard)
378 
383 {
384  public:
385  TypeSpecifier() { reset(); }
386 
387  void reset() { std::memset(this, 0, sizeof(*this)); }
388 
389  void merge(const TypeSpecifier &other)
390  {
391 #define TSPEC(x) m_is##x = m_is##x || other.is##x();
392  TYPE_SPECIFIERS
393 #undef TSPEC
394  }
395 
396  friend inline bool operator==(const TypeSpecifier &t1,const TypeSpecifier &t2)
397  {
398  bool eq = true;
399 #define TSPEC(x) eq = eq && (t1.m_is##x == t2.m_is##x);
400  TYPE_SPECIFIERS
401 #undef TSPEC
402  return eq;
403  }
404 
405  friend inline bool operator!=(const TypeSpecifier &t1,const TypeSpecifier &t2)
406  {
407  return !(operator==(t1,t2));
408  }
409 
410 
411  std::string to_string() const
412  {
413  std::string result="[";
414  bool first=true;
415 #define TSPEC(x) \
416  if (m_is##x) { \
417  if (!first) result+=","; \
418  result+=#x; first=false; \
419  }
420  TYPE_SPECIFIERS
421 #undef TSPEC
422  result+="]";
423  return result;
424  }
425 
426  // generate getter and setter for each property
427 #define TSPEC(x) \
428  public: \
429  TypeSpecifier &set##x(bool b) { m_is##x = b; return *this; } \
430  bool is##x() const { return m_is##x; } \
431  private: \
432  bool m_is##x : 1;
433  TYPE_SPECIFIERS
434 #undef TSPEC
435 
436 };
437 
438 enum class VhdlSpecifier
439 {
440  UNKNOWN=0,
441  LIBRARY,
442  ENTITY,
443  PACKAGE_BODY,
444  ARCHITECTURE,
445  PACKAGE,
446  ATTRIBUTE,
447  SIGNAL,
448  COMPONENT,
449  CONSTANT,
450  TYPE,
451  SUBTYPE,
452  FUNCTION,
453  RECORD,
454  PROCEDURE,
455  USE,
456  PROCESS,
457  PORT,
458  UNITS,
459  GENERIC,
460  INSTANTIATION,
461  GROUP,
462  VFILE,
463  SHAREDVARIABLE,
464  CONFIG,
465  ALIAS,
466  MISCELLANEOUS,
467  UCF_CONST
468 };
469 
470 
471 // Type Categories (or'ed)
472 #define ENTRY_TYPES \
473  ETYPE(Empty, None) \
474  ETYPE(Class, Compound|Scope) \
475  ETYPE(Namespace, Scope) \
476  ETYPE(Concept, None) \
477  ETYPE(ClassDoc, CompoundDoc|Doc) \
478  ETYPE(StructDoc, CompoundDoc|Doc) \
479  ETYPE(UnionDoc, CompoundDoc|Doc) \
480  ETYPE(ExceptionDoc, CompoundDoc|Doc) \
481  ETYPE(InterfaceDoc, CompoundDoc|Doc) \
482  ETYPE(ProtocolDoc, CompoundDoc|Doc) \
483  ETYPE(CategoryDoc, CompoundDoc|Doc) \
484  ETYPE(ServiceDoc, CompoundDoc|Doc) \
485  ETYPE(SingletonDoc, CompoundDoc|Doc) \
486  ETYPE(Source, File) \
487  ETYPE(Header, File) \
488  ETYPE(ModuleDoc, Doc) \
489  ETYPE(ConceptDoc, Doc) \
490  ETYPE(NamespaceDoc, Doc) \
491  ETYPE(EnumDoc, Doc) \
492  ETYPE(PageDoc, Doc) \
493  ETYPE(MemberDoc, Doc) \
494  ETYPE(OverloadDoc, Doc) \
495  ETYPE(Example, Doc) \
496  ETYPE(VariableDoc, Doc) \
497  ETYPE(FileDoc, Doc) \
498  ETYPE(DefineDoc, Doc) \
499  ETYPE(GroupDoc, Doc) \
500  ETYPE(MainpageDoc, Doc) \
501  ETYPE(MemberGrp, Doc) \
502  ETYPE(PackageDoc, Doc) \
503  ETYPE(DirDoc, Doc) \
504  ETYPE(Variable, None) \
505  ETYPE(Function, None) \
506  ETYPE(Typedef, None) \
507  ETYPE(Include, None) \
508  ETYPE(Enum, None) \
509  ETYPE(Define, None) \
510  ETYPE(UsingDir, None) \
511  ETYPE(UsingDecl, None) \
512  ETYPE(Package, None) \
513  ETYPE(ObjcImpl, None) \
514  ETYPE(ExportedInterface, None) \
515  ETYPE(IncludedService, None) \
516  ETYPE(ExampleLineno, None) \
517 
518 
522 {
523  public:
524 #define ETYPE(x,bits) \
525  static EntryType make##x() { return EntryType(static_cast<int>(x)|static_cast<int>(bits)); } \
526  bool is##x() const { return (m_type&TypeMask)==x; }
527  ENTRY_TYPES
528 #undef ETYPE
529  bool isCompound() const { return (m_type & Compound)!=0; }
530  bool isScope() const { return (m_type & Scope)!=0; }
531  bool isFile() const { return (m_type & File)!=0; }
532  bool isCompoundDoc() const { return (m_type & CompoundDoc)!=0; }
533  bool isDoc() const { return (m_type & Doc)!=0; }
534  std::string to_string() const
535  {
536  switch (type())
537  {
538 #define ETYPE(x,bits) \
539  case x : return "["+std::string(#x)+bits_to_string()+"]";
540  ENTRY_TYPES
541 #undef ETYPE
542  }
543  return "[unknown]";
544  }
545  friend inline bool operator==(const EntryType &t1,const EntryType &t2) { return t1.m_type==t2.m_type; }
546  friend inline bool operator!=(const EntryType &t1,const EntryType &t2) { return !(operator==(t1,t2)); }
547 
548  private:
549  enum TypeName
550  {
551 #define ETYPE(x,bits) \
552  x,
553  ENTRY_TYPES
554 #undef ETYPE
555  };
556 
557  enum CategoryBits
558  {
559  None = 0,
560  Compound = (1<<16),
561  Scope = (1<<17),
562  File = (1<<18),
563  CompoundDoc = (1<<19),
564  Doc = (1<<20),
565  TypeMask = 0x0000FFFF,
566  CategoryMask = 0xFFFF0000
567  };
568  explicit EntryType(int t) : m_type(t) {}
569  std::string bits_to_string() const
570  {
571  std::string result;
572  if (m_type&Compound) result+=",Compound";
573  if (m_type&Scope) result+=",Scope";
574  if (m_type&File) result+=",File";
575  if (m_type&CompoundDoc) result+=",CompoundDoc";
576  return result;
577  }
578  TypeName type() const { return static_cast<TypeName>(m_type & TypeMask); }
579  unsigned int m_type = Empty;
580 };
581 
582 
583 #endif
Grouping info.
Definition: types.h:64
membership in group was defined via @defgroup
Definition: types.h:72
GroupPri_t
Grouping priority.
Definition: types.h:67
GroupPri_t pri
priority of this definition
Definition: types.h:96
SrcLangExt
Language as given by extension.
Definition: types.h:41
Relationship
Kind of member relationship.
Definition: types.h:38
Definition: types.h:308
membership in group was defined by @ingroup
Definition: types.h:74
A class representing a macro definition.
Definition: define.h:30
Specifier
Virtualness of a member.
Definition: types.h:29
Wrapper class for a number of boolean properties.
Definition: types.h:382
QCString groupname
name of the group
Definition: types.h:95
MethodTypes
Kind of method.
Definition: types.h:32
Protection
Protection level of members.
Definition: types.h:26
RelatesType
Type of member relation.
Definition: types.h:35
This is an alternative implementation of QCString.
Definition: qcstring.h:93
membership in group was defined via @add[to]group
Definition: types.h:71
Helper class to process markdown formatted text.
Definition: markdown.h:31
Wrapper class for the Entry type.
Definition: types.h:521