Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

CPPExpression Class Reference

#include <cppExpression.h>

Inheritance diagram for CPPExpression:

CPPDeclaration List of all members.

Public Types

enum  ResultType { RT_integer, RT_real, RT_pointer, RT_error }
enum  Type {
  T_integer, T_real, T_string, T_variable,
  T_function, T_unknown_ident, T_typecast, T_construct,
  T_default_construct, T_new, T_default_new, T_sizeof,
  T_unary_operation, T_binary_operation, T_trinary_operation
}
typedef map< CPPDeclaration *,
CPPDeclaration * > 
SubstDecl
typedef set< CPPDeclaration * > Instantiations
enum  SubType {
  ST_instance, ST_typedef, ST_type_declaration, ST_expression,
  ST_type, ST_namespace, ST_using, ST_simple,
  ST_pointer, ST_reference, ST_array, ST_const,
  ST_function, ST_function_group, ST_extension, ST_struct,
  ST_enum, ST_class_template_parameter, ST_tbd, ST_type_proxy
}

Public Member Functions

 CPPExpression (int value)
 CPPExpression (const string &value)
 CPPExpression (double value)
 CPPExpression (CPPIdentifier *ident, CPPScope *current_scope, CPPScope *global_scope, CPPPreprocessor *error_sink=NULL)
 CPPExpression (int unary_operator, CPPExpression *op1)
 CPPExpression (int binary_operator, CPPExpression *op1, CPPExpression *op2)
 CPPExpression (int trinary_operator, CPPExpression *op1, CPPExpression *op2, CPPExpression *op3)
 ~CPPExpression ()
Result evaluate () const
CPPTypedetermine_type () const
 Returns the type of the expression, if it is known, or NULL if the type cannot be determined.

bool is_tbd () const
 Returns true if any type within the expression list is a CPPTBDType and thus isn't fully determined right now.

virtual CPPDeclarationsubstitute_decl (SubstDecl &subst, CPPScope *current_scope, CPPScope *global_scope)
virtual void output (ostream &out, int indent_level, CPPScope *scope, bool complete) const
virtual SubType get_subtype () const
virtual CPPExpression * as_expression ()
bool operator== (const CPPDeclaration &other) const
bool operator!= (const CPPDeclaration &other) const
bool operator< (const CPPDeclaration &other) const
bool is_template () const
 Returns true if this is a template declaration of some kind: a template function or a template class, typically.

CPPTemplateScopeget_template_scope () const
 If is_template(), above, returns true, this returns the CPPTemplateScope in which this particular template declaration is defined.

virtual bool is_fully_specified () const
 Returns true if this declaration is an actual, factual declaration, or false if some part of the declaration depends on a template parameter which has not yet been instantiated.

virtual CPPDeclarationinstantiate (const CPPTemplateParameterList *actual_params, CPPScope *current_scope, CPPScope *global_scope, CPPPreprocessor *error_sink=NULL) const
virtual CPPDeclarationsubstitute_decl (SubstDecl &subst, CPPScope *current_scope, CPPScope *global_scope)
virtual CPPInstanceas_instance ()
virtual CPPClassTemplateParameteras_class_template_parameter ()
virtual CPPTypedefas_typedef ()
virtual CPPTypeDeclarationas_type_declaration ()
virtual CPPTypeas_type ()
virtual CPPNamespaceas_namespace ()
virtual CPPUsingas_using ()
virtual CPPSimpleTypeas_simple_type ()
virtual CPPPointerTypeas_pointer_type ()
virtual CPPReferenceTypeas_reference_type ()
virtual CPPArrayTypeas_array_type ()
virtual CPPConstTypeas_const_type ()
virtual CPPFunctionTypeas_function_type ()
virtual CPPFunctionGroupas_function_group ()
virtual CPPExtensionTypeas_extension_type ()
virtual CPPStructTypeas_struct_type ()
virtual CPPEnumTypeas_enum_type ()
virtual CPPTBDTypeas_tbd_type ()
virtual CPPTypeProxyas_type_proxy ()

Static Public Member Functions

CPPExpression typecast_op (CPPType *type, CPPExpression *op1)
 Creates an expression that represents a typecast operation.

CPPExpression construct_op (CPPType *type, CPPExpression *op1)
 Creates an expression that represents a constructor call.

CPPExpression new_op (CPPType *type, CPPExpression *op1=NULL)
 Creates an expression that represents a use of the new operator.

CPPExpression sizeof_func (CPPType *type)

Public Attributes

Type _type
string _str
union {
   int   _integer
   double   _real
   CPPInstance *   _variable
   CPPFunctionGroup *   _fgroup
   CPPIdentifier *   _ident
   class {
      CPPType *   _to
      CPPExpression *   _op1
   }   _typecast
   class {
      int   _operator
      CPPExpression *   _op1
      CPPExpression *   _op2
      CPPExpression *   _op3
   }   _op
_u
Instantiations _instantiations
CPPVisibility _vis
CPPTemplateScope_template_scope
CPPFile _file
CPPCommentBlock_leading_comment

Protected Member Functions

virtual bool is_equal (const CPPDeclaration *other) const
 Called by CPPDeclaration to determine whether this expr is equivalent to another expr.

virtual bool is_less (const CPPDeclaration *other) const
 Called by CPPDeclaration to determine whether this expr should be ordered before another expr of the same type, in an arbitrary but fixed ordering.


Static Protected Member Functions

CPPTypeelevate_type (CPPType *t1, CPPType *t2)
 Returns the most general of the two given types.


Member Typedef Documentation

typedef set<CPPDeclaration *> CPPDeclaration::Instantiations [inherited]
 

Reimplemented in CPPInstance.

Definition at line 118 of file cppDeclaration.h.

typedef map<CPPDeclaration *, CPPDeclaration *> CPPDeclaration::SubstDecl [inherited]
 

Definition at line 113 of file cppDeclaration.h.

Referenced by CPPScope::is_fully_specified().


Member Enumeration Documentation

enum CPPExpression::ResultType
 

Enumeration values:
RT_integer 
RT_real 
RT_pointer 
RT_error 

Definition at line 58 of file cppExpression.h.

enum CPPDeclaration::SubType [inherited]
 

Enumeration values:
ST_instance 
ST_typedef 
ST_type_declaration 
ST_expression 
ST_type 
ST_namespace 
ST_using 
ST_simple 
ST_pointer 
ST_reference 
ST_array 
ST_const 
ST_function 
ST_function_group 
ST_extension 
ST_struct 
ST_enum 
ST_class_template_parameter 
ST_tbd 
ST_type_proxy 

Definition at line 71 of file cppDeclaration.h.

Referenced by CPPUsing::output(), CPPFunctionGroup::output(), CPPClassTemplateParameter::output(), and CPPFunctionType::output_instance().

enum CPPExpression::Type
 

Enumeration values:
T_integer 
T_real 
T_string 
T_variable 
T_function 
T_unknown_ident 
T_typecast 
T_construct 
T_default_construct 
T_new 
T_default_new 
T_sizeof 
T_unary_operation 
T_binary_operation 
T_trinary_operation 

Definition at line 101 of file cppExpression.h.


Constructor & Destructor Documentation

CPPExpression::CPPExpression int  value  ) 
 

Definition at line 208 of file cppExpression.cxx.

References _str, _type, and T_string.

CPPExpression::CPPExpression const string &  value  ) 
 

Definition at line 238 of file cppExpression.cxx.

CPPExpression::CPPExpression double  value  ) 
 

Definition at line 223 of file cppExpression.cxx.

References _type, _u, CPPDeclaration::as_instance(), current_scope, CPPIdentifier::find_symbol(), global_scope, NULL, and T_variable.

CPPExpression::CPPExpression CPPIdentifier ident,
CPPScope current_scope,
CPPScope global_scope,
CPPPreprocessor error_sink = NULL
 

Definition at line 253 of file cppExpression.cxx.

References _type, _u, NULL, and T_unary_operation.

CPPExpression::CPPExpression int  unary_operator,
CPPExpression *  op1
 

Definition at line 287 of file cppExpression.cxx.

References _type, _u, and T_trinary_operation.

CPPExpression::CPPExpression int  binary_operator,
CPPExpression *  op1,
CPPExpression *  op2
 

Definition at line 305 of file cppExpression.cxx.

References _type, _u, and T_typecast.

CPPExpression::CPPExpression int  trinary_operator,
CPPExpression *  op1,
CPPExpression *  op2,
CPPExpression *  op3
 

Definition at line 323 of file cppExpression.cxx.

References _type, _u, NULL, T_construct, and T_default_construct.

CPPExpression::~CPPExpression  ) 
 

Definition at line 431 of file cppExpression.cxx.

References _u, T_binary_operation, T_default_construct, T_default_new, T_new, and T_sizeof.


Member Function Documentation

CPPArrayType * CPPDeclaration::as_array_type  )  [virtual, inherited]
 

Reimplemented in CPPArrayType, and CPPTypeProxy.

Definition at line 339 of file cppDeclaration.cxx.

References NULL.

Referenced by InterrogateBuilder::insert_param_list().

CPPClassTemplateParameter * CPPDeclaration::as_class_template_parameter  )  [virtual, inherited]
 

Reimplemented in CPPClassTemplateParameter.

Definition at line 219 of file cppDeclaration.cxx.

References NULL.

CPPConstType * CPPDeclaration::as_const_type  )  [virtual, inherited]
 

Reimplemented in CPPConstType, and CPPTypeProxy.

Definition at line 351 of file cppDeclaration.cxx.

Referenced by InterrogateBuilder::insert_param_list(), TypeManager::involves_unpublished(), TypeManager::is_basic_string_char(), TypeManager::is_const(), TypeManager::is_const_basic_string_char(), TypeManager::is_const_enum(), TypeManager::is_const_ref_to_simple(), TypeManager::is_const_simple(), TypeManager::is_pointable(), TypeManager::is_pointer(), TypeManager::is_reference(), TypeManager::is_reference_count(), TypeManager::is_simple(), TypeManager::is_struct(), and TypeManager::is_void().

CPPEnumType * CPPDeclaration::as_enum_type  )  [virtual, inherited]
 

Reimplemented in CPPEnumType, and CPPTypeProxy.

Definition at line 411 of file cppDeclaration.cxx.

Referenced by CPPTypeProxy::as_reference_type().

CPPExpression * CPPExpression::as_expression  )  [virtual]
 

Reimplemented from CPPDeclaration.

Definition at line 1291 of file cppExpression.cxx.

References _type.

Referenced by get_subtype().

CPPExtensionType * CPPDeclaration::as_extension_type  )  [virtual, inherited]
 

Reimplemented in CPPExtensionType, and CPPTypeProxy.

Definition at line 387 of file cppDeclaration.cxx.

Referenced by TypeManager::is_simple().

CPPFunctionGroup * CPPDeclaration::as_function_group  )  [virtual, inherited]
 

Reimplemented in CPPFunctionGroup.

Definition at line 375 of file cppDeclaration.cxx.

CPPFunctionType * CPPDeclaration::as_function_type  )  [virtual, inherited]
 

Reimplemented in CPPFunctionType, and CPPTypeProxy.

Definition at line 363 of file cppDeclaration.cxx.

Referenced by CPPStructType::check_virtual(), CPPInstanceIdentifier::get_scope(), CPPInstance::get_simple_name(), InterrogateBuilder::in_noinclude(), TypeManager::is_const_pointer_to_base(), CPPPointerType::output(), TypeManager::unwrap(), TypeManager::wrap_const_reference(), and CPPFunctionGroup::~CPPFunctionGroup().

CPPInstance * CPPDeclaration::as_instance  )  [virtual, inherited]
 

Reimplemented in CPPInstance.

Definition at line 207 of file cppDeclaration.cxx.

References NULL.

Referenced by CPPExpression(), and CPPTypedef::CPPTypedef().

CPPNamespace * CPPDeclaration::as_namespace  )  [virtual, inherited]
 

Reimplemented in CPPNamespace.

Definition at line 279 of file cppDeclaration.cxx.

References NULL.

CPPPointerType * CPPDeclaration::as_pointer_type  )  [virtual, inherited]
 

Reimplemented in CPPPointerType, and CPPTypeProxy.

Definition at line 315 of file cppDeclaration.cxx.

References NULL.

Referenced by InterrogateBuilder::insert_param_list(), TypeManager::is_const_ref_to_simple(), and CPPTypeProxy::output_instance().

CPPReferenceType * CPPDeclaration::as_reference_type  )  [virtual, inherited]
 

Reimplemented in CPPReferenceType, and CPPTypeProxy.

Definition at line 327 of file cppDeclaration.cxx.

References NULL.

Referenced by InterrogateBuilder::insert_param_list(), TypeManager::involves_unpublished(), TypeManager::is_const_ref_to_enum(), TypeManager::is_reference_count(), and CPPTypeProxy::output().

CPPSimpleType * CPPDeclaration::as_simple_type  )  [virtual, inherited]
 

Reimplemented in CPPSimpleType, and CPPTypeProxy.

Definition at line 303 of file cppDeclaration.cxx.

References NULL.

Referenced by TypeManager::is_basic_string_char(), TypeManager::is_char_pointer(), TypeManager::is_const_basic_string_char(), and TypeManager::is_const_simple().

CPPStructType * CPPDeclaration::as_struct_type  )  [virtual, inherited]
 

Reimplemented in CPPStructType, and CPPTypeProxy.

Definition at line 399 of file cppDeclaration.cxx.

Referenced by CPPTypeProxy::as_pointer_type(), CPPScope::find_scope(), InterrogateBuilder::get_getter(), and TypeManager::wrap_const_pointer().

CPPTBDType * CPPDeclaration::as_tbd_type  )  [virtual, inherited]
 

Reimplemented in CPPTBDType, and CPPTypeProxy.

Definition at line 423 of file cppDeclaration.cxx.

Referenced by CPPTypeProxy::as_array_type().

CPPType * CPPDeclaration::as_type  )  [virtual, inherited]
 

Reimplemented in CPPType, and CPPTypeProxy.

Definition at line 267 of file cppDeclaration.cxx.

References NULL.

Referenced by CPPIdentifier::get_scope(), CPPTemplateParameterList::get_string(), CPPReferenceType::is_fully_specified(), CPPPointerType::is_fully_specified(), CPPConstType::is_fully_specified(), CPPArrayType::is_tbd(), and CPPScope::write().

CPPTypeDeclaration * CPPDeclaration::as_type_declaration  )  [virtual, inherited]
 

Reimplemented in CPPTypeDeclaration.

Definition at line 243 of file cppDeclaration.cxx.

References NULL.

CPPTypeProxy * CPPDeclaration::as_type_proxy  )  [virtual, inherited]
 

Reimplemented in CPPTypeProxy.

Definition at line 435 of file cppDeclaration.cxx.

CPPTypedef * CPPDeclaration::as_typedef  )  [virtual, inherited]
 

Reimplemented in CPPTypedef.

Definition at line 231 of file cppDeclaration.cxx.

Referenced by CPPTypedef::CPPTypedef().

CPPUsing * CPPDeclaration::as_using  )  [virtual, inherited]
 

Reimplemented in CPPUsing.

Definition at line 291 of file cppDeclaration.cxx.

CPPExpression CPPExpression::construct_op CPPType type,
CPPExpression *  op1
[static]
 

Creates an expression that represents a constructor call.

Definition at line 364 of file cppExpression.cxx.

References _type, _u, NULL, and T_sizeof.

CPPType * CPPExpression::determine_type  )  const
 

Returns the type of the expression, if it is known, or NULL if the type cannot be determined.

Definition at line 691 of file cppExpression.cxx.

References _u, NULL, T_binary_operation, T_sizeof, T_trinary_operation, and T_unary_operation.

CPPType * CPPExpression::elevate_type CPPType t1,
CPPType t2
[static, protected]
 

Returns the most general of the two given types.

Definition at line 1304 of file cppExpression.cxx.

References _type, _u, T_binary_operation, T_construct, T_default_construct, T_default_new, T_function, T_new, T_sizeof, T_trinary_operation, T_typecast, T_unary_operation, T_unknown_ident, and T_variable.

CPPExpression::Result CPPExpression::evaluate  )  const
 

Definition at line 442 of file cppExpression.cxx.

References _u, and RT_error.

CPPDeclaration::SubType CPPExpression::get_subtype  )  const [virtual]
 

Implements CPPDeclaration.

Definition at line 1279 of file cppExpression.cxx.

References as_expression(), and NULL.

CPPTemplateScope * CPPDeclaration::get_template_scope  )  const [inherited]
 

If is_template(), above, returns true, this returns the CPPTemplateScope in which this particular template declaration is defined.

This scope includes the information about the template parameters.

Definition at line 143 of file cppDeclaration.cxx.

References NULL, and CPPPreprocessor::warning().

CPPDeclaration * CPPDeclaration::instantiate const CPPTemplateParameterList actual_params,
CPPScope current_scope,
CPPScope global_scope,
CPPPreprocessor error_sink = NULL
const [virtual, inherited]
 

Reimplemented in CPPInstance, and CPPStructType.

Definition at line 174 of file cppDeclaration.cxx.

References NULL.

bool CPPExpression::is_equal const CPPDeclaration other  )  const [protected, virtual]
 

Called by CPPDeclaration to determine whether this expr is equivalent to another expr.

Reimplemented from CPPDeclaration.

Definition at line 1362 of file cppExpression.cxx.

References _str, _u, T_construct, T_function, T_new, T_real, T_string, T_typecast, T_unknown_ident, and T_variable.

bool CPPDeclaration::is_fully_specified  )  const [virtual, inherited]
 

Returns true if this declaration is an actual, factual declaration, or false if some part of the declaration depends on a template parameter which has not yet been instantiated.

Reimplemented in CPPArrayType, CPPClassTemplateParameter, CPPConstType, CPPFunctionType, CPPInstance, CPPPointerType, CPPReferenceType, and CPPStructType.

Definition at line 162 of file cppDeclaration.cxx.

References NULL.

Referenced by CPPConstType::CPPConstType(), CPPPointerType::CPPPointerType(), CPPReferenceType::CPPReferenceType(), CPPInstance::instantiate(), and CPPFunctionType::operator=().

bool CPPExpression::is_less const CPPDeclaration other  )  const [protected, virtual]
 

Called by CPPDeclaration to determine whether this expr should be ordered before another expr of the same type, in an arbitrary but fixed ordering.

Reimplemented from CPPDeclaration.

Definition at line 1431 of file cppExpression.cxx.

bool CPPExpression::is_tbd  )  const
 

Returns true if any type within the expression list is a CPPTBDType and thus isn't fully determined right now.

Definition at line 953 of file cppExpression.cxx.

bool CPPDeclaration::is_template  )  const [inherited]
 

Returns true if this is a template declaration of some kind: a template function or a template class, typically.

Definition at line 124 of file cppDeclaration.cxx.

Referenced by InterrogateBuilder::remap_indices(), and InterrogateBuilder::scan_function().

CPPExpression CPPExpression::new_op CPPType type,
CPPExpression *  op1 = NULL
[static]
 

Creates an expression that represents a use of the new operator.

Definition at line 391 of file cppExpression.cxx.

References CPPExpression::Result::_type, _u, NULL, RT_error, T_function, T_integer, T_real, T_string, T_typecast, T_unknown_ident, and T_variable.

bool CPPDeclaration::operator!= const CPPDeclaration other  )  const [inherited]
 

Definition at line 92 of file cppDeclaration.cxx.

bool CPPDeclaration::operator< const CPPDeclaration other  )  const [inherited]
 

Definition at line 104 of file cppDeclaration.cxx.

References CPPDeclaration::_template_scope, and NULL.

bool CPPDeclaration::operator== const CPPDeclaration other  )  const [inherited]
 

Definition at line 77 of file cppDeclaration.cxx.

void CPPExpression::output ostream &  out,
int  indent_level,
CPPScope scope,
bool  complete
const [virtual]
 

Implements CPPDeclaration.

Definition at line 997 of file cppExpression.cxx.

References _u, T_construct, T_default_construct, T_default_new, T_new, T_sizeof, and T_unary_operation.

Referenced by CPPParameterList::resolve_type().

CPPExpression CPPExpression::sizeof_func CPPType type  )  [static]
 

Definition at line 415 of file cppExpression.cxx.

References _u, NULL, and CPPSimpleType::T_int.

CPPDeclaration * CPPDeclaration::substitute_decl SubstDecl subst,
CPPScope current_scope,
CPPScope global_scope
[virtual, inherited]
 

Definition at line 191 of file cppDeclaration.cxx.

Referenced by CPPReferenceType::is_fully_specified(), CPPPointerType::is_fully_specified(), CPPConstType::is_fully_specified(), CPPArrayType::is_tbd(), and CPPScope::write().

CPPDeclaration * CPPExpression::substitute_decl CPPDeclaration::SubstDecl subst,
CPPScope current_scope,
CPPScope global_scope
[virtual]
 

Definition at line 859 of file cppExpression.cxx.

References _u, and T_unary_operation.

Referenced by CPPArrayType::is_tbd().

CPPExpression CPPExpression::typecast_op CPPType type,
CPPExpression *  op1
[static]
 

Creates an expression that represents a typecast operation.

Definition at line 345 of file cppExpression.cxx.

References _type, _u, NULL, T_default_new, and T_new.


Member Data Documentation

CPPFunctionGroup* CPPExpression::_fgroup
 

Definition at line 125 of file cppExpression.h.

CPPFile CPPDeclaration::_file [inherited]
 

Definition at line 149 of file cppDeclaration.h.

Referenced by InterrogateBuilder::remap_indices(), InterrogateBuilder::scan_function(), and CPPScope::write().

CPPIdentifier* CPPExpression::_ident
 

Definition at line 126 of file cppExpression.h.

Instantiations CPPDeclaration::_instantiations [inherited]
 

Reimplemented in CPPInstance.

Definition at line 119 of file cppDeclaration.h.

int CPPExpression::_integer
 

Definition at line 122 of file cppExpression.h.

CPPCommentBlock* CPPDeclaration::_leading_comment [inherited]
 

Definition at line 150 of file cppDeclaration.h.

Referenced by CPPDeclaration::CPPDeclaration(), and CPPScope::set_current_vis().

class { ... } CPPExpression::_op
 

CPPExpression* CPPExpression::_op1
 

Definition at line 137 of file cppExpression.h.

CPPExpression* CPPExpression::_op1
 

Definition at line 130 of file cppExpression.h.

CPPExpression* CPPExpression::_op2
 

Definition at line 138 of file cppExpression.h.

CPPExpression* CPPExpression::_op3
 

Definition at line 139 of file cppExpression.h.

int CPPExpression::_operator
 

Definition at line 136 of file cppExpression.h.

double CPPExpression::_real
 

Definition at line 123 of file cppExpression.h.

string CPPExpression::_str
 

Definition at line 120 of file cppExpression.h.

Referenced by CPPExpression(), and is_equal().

CPPTemplateScope* CPPDeclaration::_template_scope [inherited]
 

Definition at line 148 of file cppDeclaration.h.

Referenced by CPPTemplateScope::add_declaration(), CPPTemplateScope::add_enum_value(), CPPTemplateScope::CPPTemplateScope(), and CPPDeclaration::operator<().

CPPType* CPPExpression::_to
 

Definition at line 129 of file cppExpression.h.

Type CPPExpression::_type
 

Definition at line 119 of file cppExpression.h.

Referenced by as_expression(), construct_op(), CPPExpression(), elevate_type(), CPPParameterList::resolve_type(), and typecast_op().

class { ... } CPPExpression::_typecast
 

union { ... } CPPExpression::_u
 

Referenced by construct_op(), CPPExpression(), determine_type(), elevate_type(), evaluate(), is_equal(), new_op(), output(), sizeof_func(), substitute_decl(), typecast_op(), and ~CPPExpression().

CPPInstance* CPPExpression::_variable
 

Definition at line 124 of file cppExpression.h.

CPPVisibility CPPDeclaration::_vis [inherited]
 

Definition at line 147 of file cppDeclaration.h.

Referenced by CPPScope::get_local_name(), TypeManager::is_pointer_to_base(), InterrogateBuilder::remap_indices(), InterrogateBuilder::scan_function(), and TypeManager::wrap_const_reference().


The documentation for this class was generated from the following files:
Generated on Thu May 1 22:13:19 2003 for DTool by doxygen1.3