Doxygen
Toggle main menu visibility
Loading...
Searching...
No Matches
arguments.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 ARGUMENTS_H
17
#define ARGUMENTS_H
18
19
#include <vector>
20
#include "
dstring.h
"
21
22
/*! \brief This class contains the information about the argument of a
23
* function or template
24
*
25
*/
26
class
Argument
27
{
28
public
:
29
/*! return true if this argument is documentation and the argument has a
30
* non empty name.
31
*/
32
bool
hasDocumentation
(
bool
allowEmptyName=
false
)
const
33
{
34
return
(allowEmptyName || !
name
.
empty
()) && !
docs
.
empty
();
35
}
36
37
bool
hasTemplateDocumentation
()
const
38
{
39
return
(!
name
.
empty
() || !
type
.
empty
()) && !
docs
.
empty
();
40
}
41
42
DString
attrib
;
/*!< Argument's attribute (IDL only) */
43
DString
type
;
/*!< Argument's type */
44
DString
canType
;
/*!< Cached value of canonical type (after type resolution). Empty initially. */
45
DString
name
;
/*!< Argument's name (may be empty) */
46
DString
array
;
/*!< Argument's array specifier (may be empty) */
47
DString
defval
;
/*!< Argument's default value (may be empty) */
48
DString
docs
;
/*!< Argument's documentation (may be empty) */
49
DString
typeConstraint
;
/*!< Used for Java generics: <T extends C> */
50
};
51
52
enum class
RefQualifierType
53
{
54
None
,
55
LValue
,
56
RValue
57
};
58
59
/*! \brief This class represents an function or template argument list.
60
*
61
* This class also stores some information about member that is typically
62
* put after the argument list, such as whether the member is const,
63
* volatile or pure virtual.
64
*/
65
class
ArgumentList
66
{
67
public
:
68
using
Vec
= std::vector<Argument>;
69
using
iterator
=
typename
Vec::iterator;
70
using
const_iterator
=
typename
Vec::const_iterator;
71
72
/*! Does any argument of this list have documentation? */
73
bool
hasDocumentation
(
bool
allowEmptyNames=
false
)
const
;
74
/*! Does any template argument of this list have documentation? */
75
bool
hasTemplateDocumentation
()
const
;
76
/*! Does this list have zero or more parameters */
77
bool
hasParameters
()
const
78
{
79
return
!
empty
() ||
m_noParameters
;
80
}
81
void
reset
()
82
{
83
clear
();
84
m_constSpecifier
=
false
;
85
m_volatileSpecifier
=
false
;
86
m_pureSpecifier
=
false
;
87
m_trailingReturnType
.
clear
();
88
m_isDeleted
=
false
;
89
m_refQualifier
=
RefQualifierType::None
;
90
m_noParameters
=
false
;
91
}
92
93
// make vector accessible
94
iterator
begin
() {
return
m_args
.begin(); }
95
iterator
end
() {
return
m_args
.end(); }
96
const_iterator
begin
()
const
{
return
m_args
.cbegin(); }
97
const_iterator
end
()
const
{
return
m_args
.cend(); }
98
const_iterator
cbegin
()
const
{
return
m_args
.cbegin(); }
99
const_iterator
cend
()
const
{
return
m_args
.cend(); }
100
bool
empty
()
const
{
return
m_args
.empty(); }
101
size_t
size
()
const
{
return
m_args
.size(); }
102
void
clear
() {
m_args
.clear(); }
103
void
push_back
(
const
Argument
&a) {
m_args
.push_back(a); }
104
Argument
&
back
() {
return
m_args
.back(); }
105
const
Argument
&
back
()
const
{
return
m_args
.back(); }
106
Argument
&
front
() {
return
m_args
.front(); }
107
const
Argument
&
front
()
const
{
return
m_args
.front(); }
108
Argument
&
at
(
size_t
i) {
return
m_args
.at(i); }
109
const
Argument
&
at
(
size_t
i)
const
{
return
m_args
.at(i); }
110
111
// getters for list wide attributes
112
bool
constSpecifier
()
const
{
return
m_constSpecifier
; }
113
bool
volatileSpecifier
()
const
{
return
m_volatileSpecifier
; }
114
bool
pureSpecifier
()
const
{
return
m_pureSpecifier
; }
115
DString
trailingReturnType
()
const
{
return
m_trailingReturnType
; }
116
bool
isDeleted
()
const
{
return
m_isDeleted
; }
117
RefQualifierType
refQualifier
()
const
{
return
m_refQualifier
; }
118
bool
noParameters
()
const
{
return
m_noParameters
; }
119
120
void
setConstSpecifier
(
bool
b) {
m_constSpecifier
= b; }
121
void
setVolatileSpecifier
(
bool
b) {
m_volatileSpecifier
= b; }
122
void
setPureSpecifier
(
bool
b) {
m_pureSpecifier
= b; }
123
void
setTrailingReturnType
(
const
DString
&s);
124
void
appendTrailingReturnType
(
const
DString
&s);
125
void
finishTrailingReturnType
();
126
void
setIsDeleted
(
bool
b) {
m_isDeleted
= b; }
127
void
setRefQualifier
(
RefQualifierType
t) {
m_refQualifier
= t; }
128
void
setNoParameters
(
bool
b) {
m_noParameters
= b; }
129
130
private
:
131
std::vector<Argument>
m_args
;
132
/*! Does the member modify the state of the class? */
133
bool
m_constSpecifier
=
false
;
134
/*! Is the member volatile? */
135
bool
m_volatileSpecifier
=
false
;
136
/*! Is this a pure virtual member? */
137
bool
m_pureSpecifier
=
false
;
138
/*! C++11 style Trailing return type? */
139
DString
m_trailingReturnType
;
140
/*! method with =delete */
141
bool
m_isDeleted
=
false
;
142
/*! C++11 ref qualifier */
143
RefQualifierType
m_refQualifier
=
RefQualifierType::None
;
144
/*! is it an explicit empty list */
145
bool
m_noParameters
=
false
;
146
};
147
148
class
ArgumentLists
:
public
std::vector<ArgumentList>
149
{
150
};
151
152
#endif
RefQualifierType
RefQualifierType
Definition
arguments.h:53
RefQualifierType::None
@ None
Definition
arguments.h:54
RefQualifierType::LValue
@ LValue
Definition
arguments.h:55
RefQualifierType::RValue
@ RValue
Definition
arguments.h:56
Argument
This class contains the information about the argument of a function or template.
Definition
arguments.h:27
Argument::hasDocumentation
bool hasDocumentation(bool allowEmptyName=false) const
Definition
arguments.h:32
Argument::docs
DString docs
Definition
arguments.h:48
Argument::typeConstraint
DString typeConstraint
Definition
arguments.h:49
Argument::attrib
DString attrib
Definition
arguments.h:42
Argument::defval
DString defval
Definition
arguments.h:47
Argument::array
DString array
Definition
arguments.h:46
Argument::name
DString name
Definition
arguments.h:45
Argument::type
DString type
Definition
arguments.h:43
Argument::canType
DString canType
Definition
arguments.h:44
Argument::hasTemplateDocumentation
bool hasTemplateDocumentation() const
Definition
arguments.h:37
ArgumentList
This class represents an function or template argument list.
Definition
arguments.h:66
ArgumentList::back
Argument & back()
Definition
arguments.h:104
ArgumentList::m_isDeleted
bool m_isDeleted
Definition
arguments.h:141
ArgumentList::refQualifier
RefQualifierType refQualifier() const
Definition
arguments.h:117
ArgumentList::noParameters
bool noParameters() const
Definition
arguments.h:118
ArgumentList::end
const_iterator end() const
Definition
arguments.h:97
ArgumentList::pureSpecifier
bool pureSpecifier() const
Definition
arguments.h:114
ArgumentList::end
iterator end()
Definition
arguments.h:95
ArgumentList::hasParameters
bool hasParameters() const
Definition
arguments.h:77
ArgumentList::m_constSpecifier
bool m_constSpecifier
Definition
arguments.h:133
ArgumentList::at
const Argument & at(size_t i) const
Definition
arguments.h:109
ArgumentList::front
Argument & front()
Definition
arguments.h:106
ArgumentList::cend
const_iterator cend() const
Definition
arguments.h:99
ArgumentList::cbegin
const_iterator cbegin() const
Definition
arguments.h:98
ArgumentList::trailingReturnType
DString trailingReturnType() const
Definition
arguments.h:115
ArgumentList::isDeleted
bool isDeleted() const
Definition
arguments.h:116
ArgumentList::m_args
std::vector< Argument > m_args
Definition
arguments.h:131
ArgumentList::back
const Argument & back() const
Definition
arguments.h:105
ArgumentList::size
size_t size() const
Definition
arguments.h:101
ArgumentList::setPureSpecifier
void setPureSpecifier(bool b)
Definition
arguments.h:122
ArgumentList::const_iterator
typename Vec::const_iterator const_iterator
Definition
arguments.h:70
ArgumentList::m_refQualifier
RefQualifierType m_refQualifier
Definition
arguments.h:143
ArgumentList::constSpecifier
bool constSpecifier() const
Definition
arguments.h:112
ArgumentList::m_trailingReturnType
DString m_trailingReturnType
Definition
arguments.h:139
ArgumentList::m_noParameters
bool m_noParameters
Definition
arguments.h:145
ArgumentList::appendTrailingReturnType
void appendTrailingReturnType(const DString &s)
Definition
arguments.cpp:41
ArgumentList::m_volatileSpecifier
bool m_volatileSpecifier
Definition
arguments.h:135
ArgumentList::hasDocumentation
bool hasDocumentation(bool allowEmptyNames=false) const
Definition
arguments.cpp:22
ArgumentList::m_pureSpecifier
bool m_pureSpecifier
Definition
arguments.h:137
ArgumentList::setTrailingReturnType
void setTrailingReturnType(const DString &s)
Definition
arguments.cpp:36
ArgumentList::push_back
void push_back(const Argument &a)
Definition
arguments.h:103
ArgumentList::Vec
std::vector< Argument > Vec
Definition
arguments.h:68
ArgumentList::empty
bool empty() const
Definition
arguments.h:100
ArgumentList::setConstSpecifier
void setConstSpecifier(bool b)
Definition
arguments.h:120
ArgumentList::setRefQualifier
void setRefQualifier(RefQualifierType t)
Definition
arguments.h:127
ArgumentList::clear
void clear()
Definition
arguments.h:102
ArgumentList::setIsDeleted
void setIsDeleted(bool b)
Definition
arguments.h:126
ArgumentList::hasTemplateDocumentation
bool hasTemplateDocumentation() const
Definition
arguments.cpp:30
ArgumentList::iterator
typename Vec::iterator iterator
Definition
arguments.h:69
ArgumentList::finishTrailingReturnType
void finishTrailingReturnType()
Definition
arguments.cpp:46
ArgumentList::at
Argument & at(size_t i)
Definition
arguments.h:108
ArgumentList::begin
iterator begin()
Definition
arguments.h:94
ArgumentList::volatileSpecifier
bool volatileSpecifier() const
Definition
arguments.h:113
ArgumentList::begin
const_iterator begin() const
Definition
arguments.h:96
ArgumentList::setNoParameters
void setNoParameters(bool b)
Definition
arguments.h:128
ArgumentList::front
const Argument & front() const
Definition
arguments.h:107
ArgumentList::setVolatileSpecifier
void setVolatileSpecifier(bool b)
Definition
arguments.h:121
ArgumentList::reset
void reset()
Definition
arguments.h:81
ArgumentLists
Definition
arguments.h:149
DString
A String class for use with Doxygen wrapping std::string and adding some additional functionality off...
Definition
dstring.h:88
DString::clear
void clear()
Definition
dstring.h:218
DString::empty
bool empty() const
Returns true iff the string is empty (std::string compatible alias for isEmpty()).
Definition
dstring.h:152
dstring.h
src
arguments.h
Generated by
1.19.0