Doxygen
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 "qcstring.h"
21
22/*! \brief This class contains the information about the argument of a
23 * function or template
24 *
25 */
27{
28 /*! return TRUE if this argument is documentation and the argument has a
29 * non empty name.
30 */
31 bool hasDocumentation() const
32 {
33 return !name.isEmpty() && !docs.isEmpty();
34 }
35
36 QCString attrib; /*!< Argument's attribute (IDL only) */
37 QCString type; /*!< Argument's type */
38 QCString canType; /*!< Cached value of canonical type (after type resolution). Empty initially. */
39 QCString name; /*!< Argument's name (may be empty) */
40 QCString array; /*!< Argument's array specifier (may be empty) */
41 QCString defval; /*!< Argument's default value (may be empty) */
42 QCString docs; /*!< Argument's documentation (may be empty) */
43 QCString typeConstraint; /*!< Used for Java generics: <T extends C> */
44};
45
52
53/*! \brief This class represents an function or template argument list.
54 *
55 * This class also stores some information about member that is typically
56 * put after the argument list, such as whether the member is const,
57 * volatile or pure virtual.
58 */
60{
61 public:
62 using Vec = std::vector<Argument>;
63 using iterator = typename Vec::iterator;
64 using const_iterator = typename Vec::const_iterator;
65
66 /*! Does any argument of this list have documentation? */
67 bool hasDocumentation() const;
68 /*! Does this list have zero or more parameters */
69 bool hasParameters() const
70 {
71 return !empty() || m_noParameters;
72 }
84
85 // make vector accessible
86 iterator begin() { return m_args.begin(); }
87 iterator end() { return m_args.end(); }
88 const_iterator begin() const { return m_args.cbegin(); }
89 const_iterator end() const { return m_args.cend(); }
90 const_iterator cbegin() const { return m_args.cbegin(); }
91 const_iterator cend() const { return m_args.cend(); }
92 bool empty() const { return m_args.empty(); }
93 size_t size() const { return m_args.size(); }
94 void clear() { m_args.clear(); }
95 void push_back(const Argument &a) { m_args.push_back(a); }
96 Argument &back() { return m_args.back(); }
97 const Argument &back() const { return m_args.back(); }
98 Argument &front() { return m_args.front(); }
99 const Argument &front() const { return m_args.front(); }
100 Argument &at(size_t i) { return m_args.at(i); }
101 const Argument &at(size_t i) const { return m_args.at(i); }
102
103 // getters for list wide attributes
104 bool constSpecifier() const { return m_constSpecifier; }
105 bool volatileSpecifier() const { return m_volatileSpecifier; }
106 bool pureSpecifier() const { return m_pureSpecifier; }
107 QCString trailingReturnType() const { return m_trailingReturnType; }
108 bool isDeleted() const { return m_isDeleted; }
110 bool noParameters() const { return m_noParameters; }
111
114 void setPureSpecifier(bool b) { m_pureSpecifier = b; }
115 void setTrailingReturnType(const QCString &s) { m_trailingReturnType = s; }
116 void setIsDeleted(bool b) { m_isDeleted = b; }
118 void setNoParameters(bool b) { m_noParameters = b; }
119
120 private:
121 std::vector<Argument> m_args;
122 /*! Does the member modify the state of the class? */
124 /*! Is the member volatile? */
126 /*! Is this a pure virtual member? */
128 /*! C++11 style Trailing return type? */
130 /*! method with =delete */
132 /*! C++11 ref qualifier */
134 /*! is it an explicit empty list */
136};
137
138using ArgumentLists = std::vector<ArgumentList>;
139
140#endif
RefQualifierType
Definition arguments.h:47
std::vector< ArgumentList > ArgumentLists
Definition arguments.h:138
This class represents an function or template argument list.
Definition arguments.h:60
Argument & back()
Definition arguments.h:96
bool m_isDeleted
Definition arguments.h:131
RefQualifierType refQualifier() const
Definition arguments.h:109
QCString m_trailingReturnType
Definition arguments.h:129
bool noParameters() const
Definition arguments.h:110
const_iterator end() const
Definition arguments.h:89
bool pureSpecifier() const
Definition arguments.h:106
iterator end()
Definition arguments.h:87
void setTrailingReturnType(const QCString &s)
Definition arguments.h:115
bool hasParameters() const
Definition arguments.h:69
bool m_constSpecifier
Definition arguments.h:123
const Argument & at(size_t i) const
Definition arguments.h:101
Argument & front()
Definition arguments.h:98
bool hasDocumentation() const
Definition arguments.cpp:21
const_iterator cend() const
Definition arguments.h:91
const_iterator cbegin() const
Definition arguments.h:90
bool isDeleted() const
Definition arguments.h:108
std::vector< Argument > m_args
Definition arguments.h:121
const Argument & back() const
Definition arguments.h:97
QCString trailingReturnType() const
Definition arguments.h:107
size_t size() const
Definition arguments.h:93
void setPureSpecifier(bool b)
Definition arguments.h:114
typename Vec::const_iterator const_iterator
Definition arguments.h:64
RefQualifierType m_refQualifier
Definition arguments.h:133
bool constSpecifier() const
Definition arguments.h:104
bool m_noParameters
Definition arguments.h:135
bool m_volatileSpecifier
Definition arguments.h:125
bool m_pureSpecifier
Definition arguments.h:127
void push_back(const Argument &a)
Definition arguments.h:95
std::vector< Argument > Vec
Definition arguments.h:62
bool empty() const
Definition arguments.h:92
void setConstSpecifier(bool b)
Definition arguments.h:112
void setRefQualifier(RefQualifierType t)
Definition arguments.h:117
void clear()
Definition arguments.h:94
void setIsDeleted(bool b)
Definition arguments.h:116
typename Vec::iterator iterator
Definition arguments.h:63
Argument & at(size_t i)
Definition arguments.h:100
iterator begin()
Definition arguments.h:86
bool volatileSpecifier() const
Definition arguments.h:105
const_iterator begin() const
Definition arguments.h:88
void setNoParameters(bool b)
Definition arguments.h:118
const Argument & front() const
Definition arguments.h:99
void setVolatileSpecifier(bool b)
Definition arguments.h:113
void reset()
Definition arguments.h:73
#define FALSE
Definition qcstring.h:34
This class contains the information about the argument of a function or template.
Definition arguments.h:27
QCString type
Definition arguments.h:37
QCString name
Definition arguments.h:39
QCString defval
Definition arguments.h:41
QCString docs
Definition arguments.h:42
QCString array
Definition arguments.h:40
QCString canType
Definition arguments.h:38
bool hasDocumentation() const
Definition arguments.h:31
QCString typeConstraint
Definition arguments.h:43
QCString attrib
Definition arguments.h:36