~ubuntu-branches/ubuntu/maverick/aspectc++/maverick

« back to all changes in this revision

Viewing changes to AspectC++/MatchTemplateArg.cc

  • 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:
47
47
  return true;
48
48
}
49
49
 
 
50
bool MatchTemplateArgList::matches (MatchTemplateArgList &sig_mtal) const {
 
51
  const_iterator iter = begin ();
 
52
  const_iterator sig_iter = sig_mtal.begin ();
 
53
  while (iter != end ()) {
 
54
    // check if the current template match arg is '...'
 
55
    if ((*iter)->is_ellipses ())
 
56
      return true;
 
57
    // check if we have more match arguments than template arguments
 
58
    if (sig_iter == sig_mtal.end ())
 
59
      return false;
 
60
    // check if the current match argument matches the template argument
 
61
    else if (!(*iter)->matches (*(*sig_iter)))
 
62
      return false;
 
63
    // go to the next argument
 
64
    ++iter;
 
65
    ++sig_iter;
 
66
  }
 
67
  // check if we have examined all deduced template arguments
 
68
  if (sig_iter != sig_mtal.end ())
 
69
    return false;
 
70
    
 
71
  // everything fine, the list matches!
 
72
  return true;
 
73
}
 
74
 
50
75
bool MTA_Type::matches (DeducedArgument *arg) const {
51
76
  return arg->Type () && _match_type.matches (arg->Type ());
52
77
}
53
78
 
 
79
bool MTA_Type::matches (MatchTemplateArg &arg) const {
 
80
  return arg.is_type () && _match_type.matches (((MTA_Type&)arg)._match_type);
 
81
}
 
82
 
54
83
bool MTA_Value::matches (DeducedArgument *arg) const {
55
84
  // TODO: more kinds of values
56
85
  CConstant *val = arg->Value ();
57
86
  return val && (val->isSigned () || val->isUnsigned ()) &&
58
87
    val->convert_to_int () == _val;
59
88
}
 
89
 
 
90
bool MTA_Value::matches (MatchTemplateArg &arg) const {
 
91
  return arg.is_value () && _val == ((MTA_Value&)arg)._val;
 
92
}
 
93