~ubuntu-branches/ubuntu/jaunty/aspectc++/jaunty

« back to all changes in this revision

Viewing changes to Puma/gen-release/step1/inc/Puma/CEnumInfo.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-07-07 14:41:02 UTC
  • mfrom: (1.1.3 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080707144102-lzml7t07f3sl00r5
Tags: 1.0pre4~svn.20080711-1
* new upstream snapshot.
* include all upstream documentation. Clarifying emails regarding
  licensing has been included into debian/copyright.
* reformat description following recomendations of
  http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Description
  (Closes: #480316)

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
#ifndef __CEnumInfo_h__
20
20
#define __CEnumInfo_h__
21
21
 
22
 
// enumeration info 
23
 
// knows its enumerators (enumeration constants)
 
22
/** \file 
 
23
 *  Semantic information about an enumeration. */
24
24
 
25
25
#include "Puma/CEnumeratorInfo.h"
26
26
#include "Puma/CTypeInfo.h"
30
30
namespace Puma {
31
31
 
32
32
 
33
 
/** \file 
34
 
 *  Representation of a C/C++ 'enum'.
35
 
 *  \see Puma::CEnumInfo */
36
 
 
37
 
/** \class CEnumInfo CEnumInfo.h Puma/infos/CEnumInfo.h
38
 
 *  A CEnumInfo object represents a C++ 'enum'. */
 
33
/** \class CEnumInfo CEnumInfo.h Puma/CEnumInfo.h
 
34
 *  Semantic information about an enumeration. */
39
35
class CEnumInfo : public CScopeRequest {
40
36
  Array<CEnumeratorInfo*> _Enumerators;
41
37
  CTypeInfo *_UnderlyingType;
42
38
 
43
39
public: 
44
 
  /** Construct a new enumeration info object. */
 
40
  /** Constructor. */
45
41
  CEnumInfo ();
46
 
  /** Destroy the enum info object. If the object id is 
47
 
   *  \c ENUM_INFO, Puma::CObjectInfo::CleanUp() is called. */
 
42
  /** Destructor. If the object type is CObjectInfo::ENUM_INFO, 
 
43
   *  then CObjectInfo::CleanUp() is called. */
48
44
  ~CEnumInfo ();
49
45
 
50
46
  /** Get the number of enumerators in this enumeration. */
51
47
  unsigned Enumerators () const;
52
 
  /** Get the n-th enumerator info.
53
 
   *  \param n The number of the enumerator.
54
 
   *  \return The enumerator info or \c NULL if \e n is invalid. */
 
48
  /** Get the n-th enumerator.
 
49
   *  \param n The index of the enumerator.
 
50
   *  \return The enumerator or NULL if \e n is invalid. */
55
51
  CEnumeratorInfo *Enumerator (unsigned n) const;
56
 
  /** Get the info of the enumerator with the given name. 
 
52
  /** Get the enumerator with the given name. 
57
53
   *  \param name The name of the enumerator.
58
 
   *  \return The enumerator info or \c NULL if no enumerator with that name. */
 
54
   *  \return The enumerator or NULL if no enumerator with that name. */
59
55
  CEnumeratorInfo *Enumerator (const char *name) const;
60
56
 
61
 
  /** Get the base info object of the info object. <b>The 
62
 
   *  corresponding information is not yet set!</b>
63
 
   *  \return This method always returns \c NULL.
64
 
   *  \warning Do not use this method. */
65
 
  CEnumInfo *BaseObject () const;
66
 
  /** Get the info object of the enumeration definition. 
67
 
   *  \return The info or \e this if the enumeration is not defined. */
 
57
  /** Get the semantic object of the enumeration definition. 
 
58
   *  \see CObjectInfo::DefObject() */
68
59
  CEnumInfo *DefObject () const;
69
 
  /** Get the type information object for the enumeration. */
 
60
  /** Get the type information for the enumeration. */
70
61
  CTypeEnum *TypeInfo () const;
71
62
 
72
63
  /** Add a new enumerator to the enumeration.
73
 
   *  \param ei The enumerator info to add. */
 
64
   *  \param ei The enumerator. */
74
65
  void addEnumerator (CEnumeratorInfo *ei);
75
66
  /** Remove the given enumerator from the enumeration.
76
 
   *  \param ei The enumerator info to remove. */
 
67
   *  \param ei The enumerator. */
77
68
  void removeEnumerator (const CEnumeratorInfo *ei);
78
69
 
79
 
  /** Create a new enumerator info. The enumerator info is
80
 
   *  added to the enumeration. */
 
70
  /** Create a semantic object for an enumerator. The new 
 
71
   *  enumerator is added to the enumeration. */
81
72
  CEnumeratorInfo *newEnumerator ();
82
 
  /** Destroy the given enumerator info. The enumerator info is
 
73
  /** Destroy the given enumerator. The enumerator is
83
74
   *  removed from the enumeration.
84
 
   *  \param ei The enumerator info to destroy. */
 
75
   *  \param ei The enumerator. */
85
76
  void deleteEnumerator (const CEnumeratorInfo *ei);
86
77
  
87
 
  /** Return \e true if the enumeration is defined. */
 
78
  /** Check if the enumeration is defined. */
88
79
  bool isDefined () const;
89
 
  /** Return \e true if the enumeration is complete (defined)
90
 
   *  at the given position.
91
 
   *  \param pos The current source code position. */
 
80
  /** Check if the enumeration is complete (defined)
 
81
   *  at the given source code position. The position
 
82
   *  is specified by the unique number of the CT_Token
 
83
   *  tree node representing the name of the enumeration.
 
84
   *  \param pos The source code position. */
92
85
  bool isComplete (unsigned long pos = 0) const;
93
86
 
94
 
  /** Return the underlying data type. */
 
87
  /** Return the underlying data type of the enumeration. 
 
88
   *  This is implementation-defined and defaults to \e int. */
95
89
  CTypeInfo *UnderlyingType () const;
96
 
  /** Set the underlying data type.
 
90
  /** Set the underlying data type of the enumeration.
 
91
   *  This is implementation-defined and defaults to \e int.
97
92
   *  \param type The underlying type. */
98
93
  void UnderlyingType (CTypeInfo *type);
99
94
};
108
103
inline CEnumeratorInfo *CEnumInfo::Enumerator (unsigned n) const
109
104
 { return _Enumerators.lookup (n); }
110
105
 
111
 
inline CEnumInfo *CEnumInfo::BaseObject () const
112
 
 { return (CEnumInfo*)CObjectInfo::BaseObject (); }
113
106
inline CTypeEnum *CEnumInfo::TypeInfo () const
114
107
 { return (CTypeEnum*)CObjectInfo::TypeInfo (); }
115
108
//inline CT_EnumSpec *CEnumInfo::Tree () const