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