~ubuntu-branches/ubuntu/quantal/aspectc++/quantal

« back to all changes in this revision

Viewing changes to Puma/src/parser/ccparser/CCOverloading.h

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2008-04-10 17:40:52 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20080410174052-xdnsm7oi8hauyyf1
Tags: 1.0pre4~svn.20080409+dfsg-3
Fix another missing include, this time in Ag++/StdSystem.cc

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
class CFunctionInfo;
33
33
class CCNameLookup;
34
34
class CTypeFunction;
 
35
class CClassDatabase;
35
36
 
36
37
class CCOverloading {
37
38
  Array<CCandidateInfo*> _Candidates;
54
55
 
55
56
public:
56
57
  // usage: (error stream, is_operator_overloading)
57
 
  CCOverloading (ErrorSink &, bool = false);
 
58
  inline CCOverloading (ErrorSink &, bool = false);
 
59
  
 
60
  // destructor: delete all CCandidateInfos
 
61
  inline ~CCOverloading ();
58
62
  
59
63
  // set qualifiers
60
64
  void ObjectType (CTypeInfo *);
73
77
 
74
78
  unsigned Candidates () const;
75
79
  CCandidateInfo *Candidate (unsigned) const;
76
 
  void addCandidate (CCandidateInfo *);
 
80
  void addCandidate (CFunctionInfo *);
77
81
  void removeCandidate (unsigned);
78
82
 
79
83
  void collectConvFunctions (CRecord *);
80
 
  void collectConstructors (CRecord *);
 
84
  void collectConstructors (CRecord *, bool default_constr = false);
81
85
  void addCandidates (CCNameLookup &);
82
86
  
83
87
  // create built-in operators used as candidates for 
84
88
  // operator overloading, operator overloading mode
85
89
  // must be enabled (else nothing is done)
86
 
  void createBuiltinOperators (const char *, int, CTree *, CTree *);
 
90
  void createBuiltinOperators (CClassDatabase *db, const char *,
 
91
    int, CTree *, CTree *);
87
92
 
88
93
  unsigned Arguments () const;
89
94
  CTree *Argument (unsigned) const;
90
95
 
91
96
private: // built-in operators
92
 
  void createIncrOp (const char *, CTypeInfo *, CTypeInfo *);
93
 
  void createDecrOp (const char *, CTypeInfo *, CTypeInfo *);
94
 
  void createMulOp (const char *, CTypeInfo *, CTypeInfo *);
95
 
  void createPlusOp (const char *, CTypeInfo *, CTypeInfo *);
96
 
  void createMinusOp (const char *, CTypeInfo *, CTypeInfo *);
97
 
  void createTildeOp (const char *, CTypeInfo *, CTypeInfo *);
98
 
  void createMembPtrOp (const char *, CTypeInfo *, CTypeInfo *);
99
 
  void createIndexOp (const char *, CTypeInfo *, CTypeInfo *);
100
 
  void createIfThenOp (const char *, CTypeInfo *, CTypeInfo *);
101
 
  void createLogOp (const char *, CTypeInfo *, CTypeInfo *);
102
 
  void createRelOp (const char *, CTypeInfo *, CTypeInfo *);
103
 
  void createBinOp (const char *, CTypeInfo *, CTypeInfo *);
104
 
  void createEqAssOp (const char *, CTypeInfo *, CTypeInfo *);
105
 
  void createAssOp (const char *, CTypeInfo *, CTypeInfo *);
106
 
  void createDivOp (const char *, CTypeInfo *, CTypeInfo *);
107
 
  void createEqOp (const char *, CTypeInfo *, CTypeInfo *);
108
 
  void createMulAssOp (const char *, CTypeInfo *, CTypeInfo *);
109
 
  void createAddAssOp (const char *, CTypeInfo *, CTypeInfo *);
 
97
  void createIncrOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
98
  void createDecrOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
99
  void createMulOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
100
  void createPlusOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
101
  void createMinusOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
102
  void createTildeOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
103
  void createMembPtrOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
104
  void createIndexOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
105
  void createIfThenOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
106
  void createLogOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
107
  void createRelOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
108
  void createBinOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
109
  void createEqAssOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
110
  void createAssOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
111
  void createDivOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
112
  void createEqOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
113
  void createMulAssOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
 
114
  void createAddAssOp (CClassDatabase *, int, const char *, CTypeInfo *, CTypeInfo *);
110
115
 
111
116
private:
112
117
  void chooseViableFcts ();
113
118
  void chooseBestViableFct ();
114
119
  int compareCandidates (CCandidateInfo *, CCandidateInfo *) const;
115
120
 
 
121
  int moreSpecialized (CFunctionInfo *, CFunctionInfo *) const;
116
122
  bool equalOrMoreQualified (CTypeFunction *, CTypeInfo *) const;
117
 
  bool moreSpecialized (CFunctionInfo *, CFunctionInfo *) const;
118
123
  bool hasDefaultArgument (CFunctionInfo *, CTypeList *, unsigned) const;
119
124
  void collectConvFunctions (CRecord *, unsigned);
120
125
  void collectConvTypes (CRecord *, Array<CTypeInfo*> &);
121
126
  CCStandardConvSeq *implicitThisConv (CTypeInfo *, CTypeInfo *, 
122
127
                                       CFunctionInfo *) const;
123
128
  
124
 
  void createParameter (CFunctionInfo *, CTypeInfo *) const;
125
 
  void createOperator (const char *, CTypeInfo *, CTypeInfo *, 
126
 
                       CTypeInfo * = 0);
 
129
  void createOperator (CClassDatabase *, int, const char *,
 
130
    CTypeInfo *, CTypeInfo *, CTypeInfo * = 0);
127
131
};
128
132
 
129
133
inline CCOverloading::CCOverloading (ErrorSink &e, bool oovl) : 
141
145
  obj_type (0)
142
146
 {}
143
147
 
 
148
inline CCOverloading::~CCOverloading () {
 
149
  for (int c = (int)Candidates () - 1; c >= 0; c--)
 
150
    removeCandidate ((unsigned)c);
 
151
}
 
152
 
144
153
inline CFunctionInfo *CCOverloading::Function () const
145
154
 { return Candidates () ? Candidate (0)->Function () : (CFunctionInfo*)0; }
146
155
inline unsigned CCOverloading::Arguments () const 
155
164
 { return (unsigned)_Candidates.length (); }
156
165
inline CCandidateInfo *CCOverloading::Candidate (unsigned c) const
157
166
 { return _Candidates.lookup (c); }
158
 
inline void CCOverloading::removeCandidate (unsigned c)
159
 
 { _Candidates.remove (c); }
 
167
inline void CCOverloading::removeCandidate (unsigned c) {
 
168
  delete _Candidates.lookup (c);
 
169
  _Candidates.remove (c);
 
170
}
160
171
 
161
172
 
162
173
} // namespace Puma