CppParser
Loading...
Searching...
No Matches
cppfunc-info-accessor.h
Go to the documentation of this file.
1/*
2The MIT License (MIT)
3
4Copyright (c) 2018 Satya Das
5
6Permission is hereby granted, free of charge, to any person obtaining a copy of
7this software and associated documentation files (the "Software"), to deal in
8the Software without restriction, including without limitation the rights to
9use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
10 the Software, and to permit persons to whom the Software is furnished to do so,
11subject to the following conditions:
12
13The above copyright notice and this permission notice shall be included in all
14copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
18 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
19 COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
20IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21 CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22 */
23
24/***************************************************************************************/
25
26#pragma once
27
28#include "cppast.h"
29#include "cppconst.h"
30
32
33 inline bool isConst(CppFunctionBase* func)
34{
35return (func->attr() & kConst) == kConst;
36}
37inline bool isVirtual(CppFunctionBase* func)
38{
39return (func->attr() & (kVirtual | kOverride)) == kVirtual;
40}
42{
43return (func->attr() & kPureVirtual) == kPureVirtual;
44}
45inline bool isStatic(CppFunctionBase* func)
46{
47return (func->attr() & kStatic) == kStatic;
48}
49inline bool isInline(CppFunctionBase* func)
50{
51return (func->attr() & kInline) == kInline;
52}
53inline bool isOverride(CppFunctionBase* func)
54{
55return (func->attr() & kOverride) == kOverride;
56}
57inline bool isDeleted(CppFunctionBase* func)
58{
59return (func->attr() & kDelete) == kDelete;
60}
61inline bool isFinal(CppFunctionBase* func)
62{
63return (func->attr() & kFinal) == kFinal;
64}
65
66inline bool isMethod(CppFunctionEPtr func)
67{
68return func->owner() && isClassLike(func->owner());
69}
Helps working with raw or unique_ptr of CppObj in a uniform way.
Definition: cppeasyptr.h:44
@ kStatic
Definition: cppconst.h:190
@ kDelete
Definition: cppconst.h:203
@ kConst
Definition: cppconst.h:189
@ kFinal
Definition: cppconst.h:201
@ kVirtual
Definition: cppconst.h:193
@ kInline
Definition: cppconst.h:192
@ kPureVirtual
Definition: cppconst.h:194
@ kOverride
Definition: cppconst.h:195
bool isOverride(CppFunctionBase *func)
bool isDeleted(CppFunctionBase *func)
bool isPureVirtual(CppFunctionBase *func)
bool isFinal(CppFunctionBase *func)
bool isConst(CppFunctionBase *func)
bool isStatic(CppFunctionBase *func)
bool isMethod(CppFunctionEPtr func)
bool isInline(CppFunctionBase *func)
bool isVirtual(CppFunctionBase *func)
bool isClassLike(CppObj *cppObj)
Base class of constructor, destructor, and functions.
Definition: cppast.h:1195
std::uint32_t attr()
Definition: cppast.h:1198