Doxygen
arguments.h
浏览该文件的文档.
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  */
26 struct Argument
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 
47 {
51 };
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  }
73  void reset()
74  {
75  clear();
83  }
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; }
108  bool isDeleted() const { return m_isDeleted; }
110  bool noParameters() const { return m_noParameters; }
111 
112  void setConstSpecifier(bool b) { m_constSpecifier = b; }
114  void setPureSpecifier(bool b) { m_pureSpecifier = b; }
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 
138 using ArgumentLists = std::vector<ArgumentList>;
139 
140 #endif
ArgumentList::setVolatileSpecifier
void setVolatileSpecifier(bool b)
Definition: arguments.h:113
ArgumentList::refQualifier
RefQualifierType refQualifier() const
Definition: arguments.h:109
ArgumentList::trailingReturnType
QCString trailingReturnType() const
Definition: arguments.h:107
Argument::canType
QCString canType
Definition: arguments.h:51
ArgumentList::setTrailingReturnType
void setTrailingReturnType(const QCString &s)
Definition: arguments.h:115
RefQualifierNone
@ RefQualifierNone
Definition: arguments.h:48
ArgumentList::push_back
void push_back(const Argument &a)
Definition: arguments.h:95
ArgumentList::setIsDeleted
void setIsDeleted(bool b)
Definition: arguments.h:116
ArgumentList::m_pureSpecifier
bool m_pureSpecifier
Definition: arguments.h:127
ArgumentList::back
Argument & back()
Definition: arguments.h:96
ArgumentList::Vec
std::vector< Argument > Vec
Definition: arguments.h:62
ArgumentList
This class represents an function or template argument list.
Definition: arguments.h:59
QCString::isEmpty
bool isEmpty() const
Returns TRUE iff the string is empty
Definition: qcstring.h:144
ArgumentList::m_constSpecifier
bool m_constSpecifier
Definition: arguments.h:123
ArgumentList::m_volatileSpecifier
bool m_volatileSpecifier
Definition: arguments.h:125
ArgumentList::m_refQualifier
RefQualifierType m_refQualifier
Definition: arguments.h:133
RefQualifierRValue
@ RefQualifierRValue
Definition: arguments.h:50
ArgumentList::begin
const_iterator begin() const
Definition: arguments.h:88
ArgumentList::clear
void clear()
Definition: arguments.h:94
ArgumentList::hasDocumentation
bool hasDocumentation() const
Definition: arguments.cpp:21
ArgumentList::m_noParameters
bool m_noParameters
Definition: arguments.h:135
qcstring.h
ArgumentList::volatileSpecifier
bool volatileSpecifier() const
Definition: arguments.h:105
ArgumentList::noParameters
bool noParameters() const
Definition: arguments.h:110
ArgumentList::end
iterator end()
Definition: arguments.h:87
ArgumentList::m_trailingReturnType
QCString m_trailingReturnType
Definition: arguments.h:129
RefQualifierType
RefQualifierType
Definition: arguments.h:46
ArgumentList::begin
iterator begin()
Definition: arguments.h:86
ArgumentList::hasParameters
bool hasParameters() const
Definition: arguments.h:69
ArgumentList::cend
const_iterator cend() const
Definition: arguments.h:91
Argument::type
QCString type
Definition: arguments.h:50
ArgumentList::setNoParameters
void setNoParameters(bool b)
Definition: arguments.h:118
ArgumentList::cbegin
const_iterator cbegin() const
Definition: arguments.h:90
ArgumentList::setPureSpecifier
void setPureSpecifier(bool b)
Definition: arguments.h:114
ArgumentList::pureSpecifier
bool pureSpecifier() const
Definition: arguments.h:106
ArgumentList::m_isDeleted
bool m_isDeleted
Definition: arguments.h:131
Argument::array
QCString array
Definition: arguments.h:53
RefQualifierLValue
@ RefQualifierLValue
Definition: arguments.h:49
ArgumentList::at
const Argument & at(size_t i) const
Definition: arguments.h:101
ArgumentList::setRefQualifier
void setRefQualifier(RefQualifierType t)
Definition: arguments.h:117
ArgumentList::at
Argument & at(size_t i)
Definition: arguments.h:100
ArgumentList::empty
bool empty() const
Definition: arguments.h:92
ArgumentList::setConstSpecifier
void setConstSpecifier(bool b)
Definition: arguments.h:112
Argument
This class contains the information about the argument of a function or template
Definition: arguments.h:26
Argument::attrib
QCString attrib
Definition: arguments.h:49
ArgumentList::front
Argument & front()
Definition: arguments.h:98
ArgumentList::constSpecifier
bool constSpecifier() const
Definition: arguments.h:104
ArgumentList::iterator
typename Vec::iterator iterator
Definition: arguments.h:63
ArgumentList::end
const_iterator end() const
Definition: arguments.h:89
ArgumentList::front
const Argument & front() const
Definition: arguments.h:99
ArgumentList::back
const Argument & back() const
Definition: arguments.h:97
ArgumentList::size
size_t size() const
Definition: arguments.h:93
ArgumentLists
std::vector< ArgumentList > ArgumentLists
Definition: arguments.h:138
Argument::defval
QCString defval
Definition: arguments.h:54
Argument::typeConstraint
QCString typeConstraint
Definition: arguments.h:56
ArgumentList::isDeleted
bool isDeleted() const
Definition: arguments.h:108
Argument::docs
QCString docs
Definition: arguments.h:55
Argument::name
QCString name
Definition: arguments.h:52
ArgumentList::reset
void reset()
Definition: arguments.h:73
ArgumentList::const_iterator
typename Vec::const_iterator const_iterator
Definition: arguments.h:64
ArgumentList::m_args
std::vector< Argument > m_args
Definition: arguments.h:121
Argument::hasDocumentation
bool hasDocumentation() const
Definition: arguments.h:44
QCString::resize
bool resize(size_t newlen)
Resizes the string to hold newlen characters (this value should also count the 0-terminator).
Definition: qcstring.h:164
FALSE
#define FALSE
Definition: qcstring.h:33
QCString
This is an alternative implementation of QCString.
Definition: qcstring.h:108