Doxygen
Loading...
Searching...
No Matches
EntryType Class Reference

Wrapper class for the Entry type. More...

#include <src/types.h>

Public Member Functions

ENTRY_TYPES constexpr bool isCompound () const noexcept
constexpr bool isScope () const noexcept
constexpr bool isFile () const noexcept
constexpr bool isCompoundDoc () const noexcept
constexpr bool isDoc () const noexcept
std::string to_string () const

Static Public Member Functions

static EntryType guessSection (const DString &name)

Private Types

enum  TypeName { ENTRY_TYPES }
enum  CategoryBits {
  None = 0 , Compound = (1<<16) , Scope = (1<<17) , File = (1<<18) ,
  CompoundDoc = (1<<19) , Doc = (1<<20) , TypeMask = 0x0000FFFF , CategoryMask = 0xFFFF0000
}

Private Member Functions

constexpr EntryType (int t) noexcept
std::string bits_to_string () const
constexpr TypeName type () const noexcept

Private Attributes

unsigned int m_type = Empty

Friends

bool operator== (const EntryType &t1, const EntryType &t2)
bool operator!= (const EntryType &t1, const EntryType &t2)

Detailed Description

Wrapper class for the Entry type.

Can be set only during construction. Packs the type together with category flags.

Definition at line 855 of file types.h.

Member Enumeration Documentation

◆ CategoryBits

Enumerator
None 
Compound 
Scope 
File 
CompoundDoc 
Doc 
TypeMask 
CategoryMask 

Definition at line 893 of file types.h.

894 {
895 None = 0,
896 Compound = (1<<16),
897 Scope = (1<<17),
898 File = (1<<18),
899 CompoundDoc = (1<<19),
900 Doc = (1<<20),
901 TypeMask = 0x0000FFFF,
902 CategoryMask = 0xFFFF0000
903 };
@ None
Definition types.h:895
@ Scope
Definition types.h:897
@ File
Definition types.h:898
@ CategoryMask
Definition types.h:902
@ Compound
Definition types.h:896
@ TypeMask
Definition types.h:901
@ Doc
Definition types.h:900
@ CompoundDoc
Definition types.h:899

◆ TypeName

enum EntryType::TypeName
private
Enumerator
ENTRY_TYPES 

Definition at line 885 of file types.h.

886 {
887#define ETYPE(x,bits) \
888 x,
890#undef ETYPE
891 };
@ ENTRY_TYPES
Definition types.h:889

Constructor & Destructor Documentation

◆ EntryType()

EntryType::EntryType ( int t)
inlineexplicitconstexprprivatenoexcept

Definition at line 904 of file types.h.

904: m_type(t) {}
unsigned int m_type
Definition types.h:915

Referenced by guessSection(), operator!=, and operator==.

Member Function Documentation

◆ bits_to_string()

std::string EntryType::bits_to_string ( ) const
inlineprivate

Definition at line 905 of file types.h.

906 {
907 std::string result;
908 if (m_type&Compound) result+=",Compound";
909 if (m_type&Scope) result+=",Scope";
910 if (m_type&File) result+=",File";
911 if (m_type&CompoundDoc) result+=",CompoundDoc";
912 return result;
913 }

References Compound, CompoundDoc, File, m_type, and Scope.

◆ guessSection()

EntryType EntryType::guessSection ( const DString & name)
static

Definition at line 22 of file types.cpp.

23{
24 DString n=name.lower();
25 static const std::unordered_set<std::string> sourceExt = {
26 "c","cc","cxx","cpp","c++","cppm","ccm","cxxm","c++m", // C/C++
27 "java", // Java
28 "cs", // C#
29 "m","mm", // Objective-C
30 "ii","ixx","ipp","i++","inl", // C/C++ inline
31 "xml","lex","sql" // others
32 };
33 static const std::unordered_set<std::string> headerExt = {
34 "h", "hh", "hxx", "hpp", "h++", "ixx", // C/C++ header
35 "idl", "ddl", "pidl", "ice" // IDL like
36 };
37 size_t lastDot = n.rfind('.');
38 if (lastDot!=DString::npos)
39 {
40 DString extension = n.mid(lastDot+1); // part after the last dot
41 if (sourceExt.find(extension.str())!=sourceExt.end())
42 {
43 return EntryType::makeSource();
44 }
45 if (headerExt.find(extension.str())!=headerExt.end())
46 {
47 return EntryType::makeHeader();
48 }
49 }
50 else
51 {
52 if (getLanguageFromFileName(name,SrcLangExt::Unknown) == SrcLangExt::Cpp) return EntryType::makeHeader();
53 }
54 return EntryType::makeEmpty();
55}
size_t rfind(char c, size_t pos=npos) const
Definition dstring.h:248
DString mid(size_t index, size_t len=npos) const
Definition dstring.h:322
DString lower() const
Definition dstring.h:330
static constexpr size_t npos
value used to indicate 'not found' or 'to the end of the string', matching std::string::npos
Definition dstring.h:182
const std::string & str() const
Definition dstring.h:649
SrcLangExt getLanguageFromFileName(const DString &fileName, SrcLangExt defLang)
Definition util.cpp:4169

References EntryType(), getLanguageFromFileName(), DString::lower(), DString::mid(), DString::npos, DString::rfind(), and DString::str().

Referenced by addIncludeFile(), anonymous_namespace{tagreader.cpp}::TagFileParser::buildLists(), ClassDefImpl::ClassDefImpl(), computeClassRelations(), FileDefImpl::FileDefImpl(), FileDefImpl::generateSourceFile(), parseMain(), parseMain(), Preprocessor::processFile(), setFileName(), and warnUndocumentedNamespaces().

◆ isCompound()

ENTRY_TYPES constexpr bool EntryType::isCompound ( ) const
inlineconstexprnoexcept

◆ isCompoundDoc()

bool EntryType::isCompoundDoc ( ) const
inlineconstexprnoexcept

Definition at line 866 of file types.h.

866{ return (m_type & CompoundDoc)!=0; }

References CompoundDoc, and m_type.

Referenced by buildClassDocList(), and isClassSection().

◆ isDoc()

bool EntryType::isDoc ( ) const
inlineconstexprnoexcept

Definition at line 867 of file types.h.

867{ return (m_type & Doc)!=0; }

References Doc, and m_type.

Referenced by addMemberDocs().

◆ isFile()

bool EntryType::isFile ( ) const
inlineconstexprnoexcept

Definition at line 865 of file types.h.

865{ return (m_type & File)!=0; }

References File, and m_type.

Referenced by buildFileList().

◆ isScope()

bool EntryType::isScope ( ) const
inlineconstexprnoexcept

Definition at line 864 of file types.h.

864{ return (m_type & Scope)!=0; }

References m_type, and Scope.

Referenced by addClassToContext(), addConceptToContext(), addEnumValuesToEnums(), addVariable(), findEnumDocumentation(), findEnums(), and findMember().

◆ to_string()

std::string EntryType::to_string ( ) const
inline

Definition at line 868 of file types.h.

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 }
constexpr TypeName type() const noexcept
Definition types.h:914

References ENTRY_TYPES, and type().

Referenced by fmt::formatter< EntryType >::format(), and printNavTree().

◆ type()

TypeName EntryType::type ( ) const
inlineconstexprprivatenoexcept

Definition at line 914 of file types.h.

914{ return static_cast<TypeName>(m_type & TypeMask); }
TypeName
Definition types.h:886

References m_type, and TypeMask.

Referenced by to_string().

◆ operator!=

bool operator!= ( const EntryType & t1,
const EntryType & t2 )
friend

Definition at line 880 of file types.h.

880{ return !(operator==(t1,t2)); }
friend bool operator==(const EntryType &t1, const EntryType &t2)
Definition types.h:879

References EntryType(), and operator==.

◆ operator==

bool operator== ( const EntryType & t1,
const EntryType & t2 )
friend

Definition at line 879 of file types.h.

879{ return t1.m_type==t2.m_type; }

References EntryType(), and m_type.

Referenced by operator!=.

Member Data Documentation

◆ m_type

unsigned int EntryType::m_type = Empty
private

Definition at line 915 of file types.h.

Referenced by bits_to_string(), isCompound(), isCompoundDoc(), isDoc(), isFile(), isScope(), operator==, and type().


The documentation for this class was generated from the following files: