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 
26 struct Argument
27 {
31  bool hasDocumentation() const
32  {
33  return !name.isEmpty() && !docs.isEmpty();
34  }
35 
44 };
45 
46 enum RefQualifierType
47 {
48  RefQualifierNone,
49  RefQualifierLValue,
50  RefQualifierRValue
51 };
52 
60 {
61  public:
62  using Vec = std::vector<Argument>;
63  using iterator = typename Vec::iterator;
64  using const_iterator = typename Vec::const_iterator;
65 
67  bool hasDocumentation() const;
69  bool hasParameters() const
70  {
71  return !empty() || m_noParameters;
72  }
73  void reset()
74  {
75  clear();
76  m_constSpecifier = FALSE;
77  m_volatileSpecifier = FALSE;
78  m_pureSpecifier = FALSE;
79  m_trailingReturnType.resize(0);
80  m_isDeleted = FALSE;
81  m_refQualifier = RefQualifierNone;
82  m_noParameters = FALSE;
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; }
107  QCString trailingReturnType() const { return m_trailingReturnType; }
108  bool isDeleted() const { return m_isDeleted; }
109  RefQualifierType refQualifier() const { return m_refQualifier; }
110  bool noParameters() const { return m_noParameters; }
111 
112  void setConstSpecifier(bool b) { m_constSpecifier = b; }
113  void setVolatileSpecifier(bool b) { m_volatileSpecifier = b; }
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; }
117  void setRefQualifier(RefQualifierType t) { m_refQualifier = t; }
118  void setNoParameters(bool b) { m_noParameters = b; }
119 
120  private:
121  std::vector<Argument> m_args;
123  bool m_constSpecifier = FALSE;
125  bool m_volatileSpecifier = FALSE;
127  bool m_pureSpecifier = FALSE;
129  QCString m_trailingReturnType;
131  bool m_isDeleted = FALSE;
133  RefQualifierType m_refQualifier = RefQualifierNone;
135  bool m_noParameters = FALSE;
136 };
137 
138 using ArgumentLists = std::vector<ArgumentList>;
139 
140 #endif
QCString type
Definition: arguments.h:37
bool hasParameters() const
Definition: arguments.h:69
This class represents an function or template argument list.
Definition: arguments.h:59
bool hasDocumentation() const
Definition: arguments.h:31
QCString defval
Definition: arguments.h:41
QCString canType
Definition: arguments.h:38
QCString typeConstraint
Definition: arguments.h:43
This class contains the information about the argument of a function or template. ...
Definition: arguments.h:26
QCString attrib
Definition: arguments.h:36
QCString name
Definition: arguments.h:39
bool isEmpty() const
Returns TRUE iff the string is empty.
Definition: qcstring.h:141
This is an alternative implementation of QCString.
Definition: qcstring.h:92
QCString array
Definition: arguments.h:40
QCString docs
Definition: arguments.h:42