Update all parsers and related files to ctags p6.1.20240421.0
[geany-mirror.git] / ctags / parsers / cxx / cxx_scope.h
blobcc186dfd0018e69d4a4b725665ef7f37998f2285
1 #ifndef ctags_cxx_scope_h_
2 #define ctags_cxx_scope_h_
3 /*
4 * Copyright (c) 2016, Szymon Tomasz Stefanek
6 * This source code is released for free distribution under the terms of the
7 * GNU General Public License version 2 or (at your option) any later version.
9 * This module contains functions for parsing and scanning C++ source files
12 #include "general.h"
14 #include "cxx_token.h"
16 enum CXXScopeAccess
18 CXXScopeAccessUnknown,
19 CXXScopeAccessPublic,
20 CXXScopeAccessPrivate,
21 CXXScopeAccessProtected
24 enum CXXScopeType
26 CXXScopeTypeFunction,
27 CXXScopeTypeNamespace,
28 CXXScopeTypeClass,
29 CXXScopeTypeEnum,
30 CXXScopeTypeUnion,
31 CXXScopeTypeStruct,
32 CXXScopeTypeVariable, // template variables, mainly
33 CXXScopeTypePrototype,
34 CXXScopeTypeTypedef, // template variables used in "using A = B<T>"
35 CXXScopeTypeModule, // Just for filling the scope field of partitions
36 CXXScopeTypeLAST
39 void cxxScopeInit(void);
40 void cxxScopeDone(void);
41 void cxxScopeClear(void);
43 // Returns the full current scope name or NULL if there
44 // is no scope currently.
45 const char * cxxScopeGetFullName(void);
47 // Returns the current scope name of NULL if there is no
48 // scope currently. This name does not include namespaces so
49 // it is always a single identifier.
50 const char * cxxScopeGetName(void);
52 // Return the corkIndex of the token representing currently scope.
53 // This can be CORK_NIL.
54 int cxxScopeGetDefTag(void);
56 // Return the number of components of the scope name.
57 int cxxScopeGetSize(void);
59 // Returns the current scope name or NULL if there is no scope
60 // currently. Ownership of the string is transferred.
61 vString * cxxScopeGetFullNameAsString(void);
63 // Returns the current scope name with the exception of the
64 // last component or NULL if there is either no scope or there
65 // are less than two components. Ownership of the string is transferred.
66 vString * cxxScopeGetFullNameExceptLastComponentAsString(void);
68 enum CXXScopeType cxxScopeGetType(void);
69 // Returns the current scope kind
70 unsigned int cxxScopeGetKind(void);
71 unsigned int cxxScopeGetVariableKind(void);
72 enum CXXScopeAccess cxxScopeGetAccess(void);
73 // Are we in global scope?
74 bool cxxScopeIsGlobal(void);
76 // Add a token to the scope chain. The token ownership is transferred.
77 void cxxScopePush(
78 CXXToken * t,
79 enum CXXScopeType eScopeType,
80 enum CXXScopeAccess eInitialAccess
82 void cxxScopeSetAccess(enum CXXScopeAccess eAccess);
83 // Remove the last token from the scope chain
84 void cxxScopePop(void);
86 // Special management: pop one scope level but keep it so it can be pushed back
87 CXXToken * cxxScopeTakeTop(void);
88 // Special management: push back a scope taken earlier via cxxScopeTakeTop()
89 void cxxScopePushTop(CXXToken * t);
91 #endif //!ctags_cxx_scope_h_