Imported Upstream version 1.8.2
[platform/upstream/doxygen.git] / src / arguments.h
1 /******************************************************************************
2  *
3  * Copyright (C) 1997-2012 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 "qtbc.h"
20 #include <qlist.h>
21
22 class StorageIntf;
23
24 /*! \brief This class contains the information about the argument of a
25  *         function or template
26  *
27  */
28 struct Argument
29 {
30   /*! Construct a new argument. */
31   Argument() {}
32   /*! Copy an argument (does a deep copy of all strings). */
33   Argument(const Argument &a) 
34   { 
35     attrib=a.attrib.copy();
36     type=a.type.copy(); 
37     name=a.name.copy(); 
38     defval=a.defval.copy(); 
39     docs=a.docs.copy();
40     array=a.array.copy();
41   }
42   /*! Assignment of an argument (does a deep copy of all strings). */
43   Argument &operator=(const Argument &a)
44   {
45     if (this!=&a)
46     {
47       attrib=a.attrib.copy();
48       type=a.type.copy(); 
49       name=a.name.copy(); 
50       defval=a.defval.copy(); 
51       docs=a.docs.copy();
52       array=a.array.copy();
53     }
54     return *this;
55   }
56   /*! return TRUE if this argument is documentation and the argument has a
57    *  non empty name.
58    */
59   bool hasDocumentation() const 
60   { 
61     return !name.isEmpty() && !docs.isEmpty(); 
62   }
63   
64   QCString attrib;   /*!< Argument's attribute (IDL only) */
65   QCString type;     /*!< Argument's type */
66   QCString canType;  /*!< Cached value of canonical type (after type resolution). Empty initially. */
67   QCString name;     /*!< Argument's name (may be empty) */
68   QCString array;    /*!< Argument's array specifier (may be empty) */
69   QCString defval;   /*!< Argument's default value (may be empty) */
70   QCString docs;     /*!< Argument's documentation (may be empty) */
71 };
72
73 /*! \brief This class represents an function or template argument list. 
74  *
75  *  This class also stores some information about member that is typically
76  *  put after the argument list, such as whether the member is const, 
77  *  volatile or pure virtual.
78  */
79 class ArgumentList : public QList<Argument> 
80 {
81   public:
82     /*! Creates an empty argument list */
83     ArgumentList() : QList<Argument>(), 
84                      constSpecifier(FALSE),
85                      volatileSpecifier(FALSE),
86                      pureSpecifier(FALSE)
87                      { setAutoDelete(TRUE); }
88     /*! Destroys the argument list */
89    ~ArgumentList() {}
90     /*! Makes a deep copy of this object */
91     ArgumentList *deepCopy() const;
92     /*! Does any argument of this list have documentation? */
93     bool hasDocumentation() const;
94     /*! Does the member modify the state of the class? default: FALSE. */
95     bool constSpecifier;
96     /*! Is the member volatile? default: FALSE. */
97     bool volatileSpecifier;
98     /*! Is this a pure virtual member? default: FALSE */
99     bool pureSpecifier;
100     /*! C++11 style Trailing return type? */
101     QCString trailingReturnType;
102     /*! C++11 defaulted method */
103
104     static ArgumentList *unmarshal(StorageIntf *s);
105     static void marshal(StorageIntf *s,ArgumentList *argList);
106 };
107
108 typedef QListIterator<Argument> ArgumentListIterator;
109
110 #endif