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

CPPInstance Class Reference

#include <cppInstance.h>

Inheritance diagram for CPPInstance:

CPPDeclaration CPPTypeDeclaration CPPTypedef List of all members.

Public Types

enum  StorageClass {
  SC_static = 0x001, SC_extern = 0x002, SC_c_binding = 0x004, SC_virtual = 0x008,
  SC_inline = 0x010, SC_explicit = 0x020, SC_register = 0x040, SC_pure_virtual = 0x080,
  SC_volatile = 0x100, SC_mutable = 0x200, SC_inherited_virtual = 0x400
}
typedef map< CPPDeclaration *,
CPPDeclaration * > 
SubstDecl
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

 CPPInstance (CPPType *type, const string &name, int storage_class=0)
 CPPInstance (CPPType *type, CPPIdentifier *ident, int storage_class=0)
 CPPInstance (CPPType *type, CPPInstanceIdentifier *ii, int storage_class, const CPPFile &file)
 Constructs a new CPPInstance object that defines a variable of the indicated type according to the type and the InstanceIdentifier.

 CPPInstance (const CPPInstance &copy)
 ~CPPInstance ()
bool operator== (const CPPInstance &other) const
bool operator!= (const CPPInstance &other) const
bool operator< (const CPPInstance &other) const
void set_initializer (CPPExpression *initializer)
 Sets the value of the expression that is used to initialize the variable, or the default value for a parameter.

bool is_scoped () const
CPPScope * get_scope (CPPScope *current_scope, CPPScope *global_scope, CPPPreprocessor *error_sink=NULL) const
string get_simple_name () const
string get_local_name (CPPScope *scope=NULL) const
string get_fully_scoped_name () const
void check_for_constructor (CPPScope *current_scope, CPPScope *global_scope)
 If this is a function type instance, checks whether the function name matches the class name (or ~name), and if so, flags it as a constructor (or destructor).

virtual CPPDeclaration * instantiate (const CPPTemplateParameterList *actual_params, CPPScope *current_scope, CPPScope *global_scope, CPPPreprocessor *error_sink=NULL) const
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 CPPDeclaration * substitute_decl (SubstDecl &subst, CPPScope *current_scope, CPPScope *global_scope)
virtual void output (ostream &out, int indent_level, CPPScope *scope, bool complete) const
void output (ostream &out, int indent_level, CPPScope *scope, bool complete, int num_default_parameters) const
 The extra parameter comes into play only when we happen to be outputting a function prototype.

virtual SubType get_subtype () const
virtual CPPInstance * as_instance ()
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.

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

virtual CPPDeclaration * substitute_decl (SubstDecl &subst, CPPScope *current_scope, CPPScope *global_scope)
virtual CPPClassTemplateParameter * as_class_template_parameter ()
virtual CPPTypedef * as_typedef ()
virtual CPPTypeDeclaration * as_type_declaration ()
virtual CPPExpression * as_expression ()
virtual CPPType * as_type ()
virtual CPPNamespace * as_namespace ()
virtual CPPUsing * as_using ()
virtual CPPSimpleType * as_simple_type ()
virtual CPPPointerType * as_pointer_type ()
virtual CPPReferenceType * as_reference_type ()
virtual CPPArrayType * as_array_type ()
virtual CPPConstType * as_const_type ()
virtual CPPFunctionType * as_function_type ()
virtual CPPFunctionGroup * as_function_group ()
virtual CPPExtensionType * as_extension_type ()
virtual CPPStructType * as_struct_type ()
virtual CPPEnumType * as_enum_type ()
virtual CPPTBDType * as_tbd_type ()
virtual CPPTypeProxy * as_type_proxy ()

Static Public Member Functions

CPPInstance * make_typecast_function (CPPInstance *inst, CPPIdentifier *ident, CPPParameterList *parameters, int function_flags)
 Constructs and returns a new CPPInstance object that corresponds to a function prototype declaration for a typecast method, whose return type is implicit in the identifier type.


Public Attributes

CPPType * _type
CPPIdentifier * _ident
CPPExpression * _initializer
int _storage_class
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 type is equivalent to another type of the same type.

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


Private Types

typedef map< const CPPTemplateParameterList *,
CPPInstance *, CPPTPLCompare > 
Instantiations

Private Attributes

Instantiations _instantiations

Member Typedef Documentation

typedef map<const CPPTemplateParameterList *, CPPInstance *, CPPTPLCompare> CPPInstance::Instantiations [private]
 

Reimplemented from CPPDeclaration.

Definition at line 116 of file cppInstance.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 CPPInstance::StorageClass
 

Enumeration values:
SC_static 
SC_extern 
SC_c_binding 
SC_virtual 
SC_inline 
SC_explicit 
SC_register 
SC_pure_virtual 
SC_volatile 
SC_mutable 
SC_inherited_virtual 

Definition at line 48 of file cppInstance.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().


Constructor & Destructor Documentation

CPPInstance::CPPInstance (  CPPType *  type,
const string &  name,
int  storage_class = 0
) 
 

Definition at line 46 of file cppInstance.cxx.

References _initializer, and NULL.

Referenced by CPPTypedef::CPPTypedef().

CPPInstance::CPPInstance (  CPPType *  type,
CPPIdentifier *  ident,
int  storage_class = 0
) 
 

Definition at line 63 of file cppInstance.cxx.

CPPInstance::CPPInstance (  CPPType *  type,
CPPInstanceIdentifier *  ii,
int  storage_class,
const CPPFile &  file
) 
 

Constructs a new CPPInstance object that defines a variable of the indicated type according to the type and the InstanceIdentifier.

The InstanceIdentifier pointer is deallocated.

Definition at line 87 of file cppInstance.cxx.

References _type, and NULL.

CPPInstance::CPPInstance (  const CPPInstance &  copy  ) 
 

Definition at line 107 of file cppInstance.cxx.

CPPInstance::~CPPInstance (   ) 
 

Definition at line 125 of file cppInstance.cxx.

References CPPFunctionType::F_operator_typecast.


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 * CPPDeclaration::as_expression (   )  [virtual, inherited]
 

Reimplemented in CPPExpression.

Definition at line 255 of file cppDeclaration.cxx.

References NULL.

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(), get_simple_name(), InterrogateBuilder::in_noinclude(), TypeManager::is_const_pointer_to_base(), CPPPointerType::output(), TypeManager::unwrap(), TypeManager::wrap_const_reference(), and CPPFunctionGroup::~CPPFunctionGroup().

CPPInstance * CPPInstance::as_instance (   )  [virtual]
 

Reimplemented from CPPDeclaration.

Definition at line 635 of file cppInstance.cxx.

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.

void CPPInstance::check_for_constructor (  CPPScope *  current_scope,
CPPScope *  global_scope
) 
 

If this is a function type instance, checks whether the function name matches the class name (or ~name), and if so, flags it as a constructor (or destructor).

Definition at line 377 of file cppInstance.cxx.

References _instantiations.

string CPPInstance::get_fully_scoped_name (   )  const
 

Definition at line 356 of file cppInstance.cxx.

string CPPInstance::get_local_name (  CPPScope *  scope = NULL  )  const
 

Definition at line 340 of file cppInstance.cxx.

References _type, and CPPType::new_type().

Referenced by get_simple_name(), and TypeManager::wrap_pointer().

CPPScope * CPPInstance::get_scope (  CPPScope *  current_scope,
CPPScope *  global_scope,
CPPPreprocessor *  error_sink = NULL
)  const
 

Definition at line 307 of file cppInstance.cxx.

References _ident, CPPIdentifier::get_fully_scoped_name(), and NULL.

Referenced by get_simple_name(), and InterrogateBuilder::in_noinclude().

string CPPInstance::get_simple_name (   )  const
 

Definition at line 324 of file cppInstance.cxx.

References _type, CPPDeclaration::as_function_type(), current_scope, CPPScope::get_local_name(), get_local_name(), get_scope(), global_scope, CPPType::new_type(), and NULL.

Referenced by InterfaceMakerPythonObj::write_function_for().

CPPDeclaration::SubType CPPInstance::get_subtype (   )  const [virtual]
 

Implements CPPDeclaration.

Reimplemented in CPPTypeDeclaration, and CPPTypedef.

Definition at line 623 of file cppInstance.cxx.

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 * CPPInstance::instantiate (  const CPPTemplateParameterList *  actual_params,
CPPScope *  current_scope,
CPPScope *  global_scope,
CPPPreprocessor *  error_sink = NULL
)  const [virtual]
 

Reimplemented from CPPDeclaration.

Definition at line 417 of file cppInstance.cxx.

References _ident, _initializer, _type, CPPDeclaration::is_fully_specified(), CPPIdentifier::is_fully_specified(), and NULL.

bool CPPDeclaration::is_equal (  const CPPDeclaration *  other  )  const [protected, virtual, inherited]
 

Called by CPPDeclaration to determine whether this type is equivalent to another type of the same type.

Reimplemented in CPPArrayType, CPPClassTemplateParameter, CPPConstType, CPPExpression, CPPFunctionType, CPPPointerType, CPPReferenceType, CPPSimpleType, CPPStructType, and CPPTBDType.

Definition at line 451 of file cppDeclaration.cxx.

Referenced by CPPType::get_fully_scoped_name(), and CPPDeclaration::~CPPDeclaration().

bool CPPInstance::is_fully_specified (   )  const [virtual]
 

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 from CPPDeclaration.

Definition at line 480 of file cppInstance.cxx.

bool CPPDeclaration::is_less (  const CPPDeclaration *  other  )  const [protected, virtual, inherited]
 

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

Reimplemented in CPPArrayType, CPPClassTemplateParameter, CPPConstType, CPPExpression, CPPFunctionType, CPPPointerType, CPPReferenceType, CPPSimpleType, CPPStructType, and CPPTBDType.

Definition at line 468 of file cppDeclaration.cxx.

bool CPPInstance::is_scoped (   )  const
 

Definition at line 291 of file cppInstance.cxx.

References _ident, CPPIdentifier::get_local_name(), and NULL.

Referenced by InterrogateBuilder::in_noinclude().

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().

CPPInstance * CPPInstance::make_typecast_function (  CPPInstance *  inst,
CPPIdentifier *  ident,
CPPParameterList *  parameters,
int  function_flags
)  [static]
 

Constructs and returns a new CPPInstance object that corresponds to a function prototype declaration for a typecast method, whose return type is implicit in the identifier type.

Definition at line 145 of file cppInstance.cxx.

References _storage_class.

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

Definition at line 92 of file cppDeclaration.cxx.

bool CPPInstance::operator!= (  const CPPInstance &  other  )  const
 

Definition at line 204 of file cppInstance.cxx.

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

Definition at line 104 of file cppDeclaration.cxx.

References CPPDeclaration::_template_scope, and NULL.

bool CPPInstance::operator< (  const CPPInstance &  other  )  const
 

Definition at line 216 of file cppInstance.cxx.

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

Definition at line 77 of file cppDeclaration.cxx.

bool CPPInstance::operator== (  const CPPInstance &  other  )  const
 

Definition at line 166 of file cppInstance.cxx.

void CPPInstance::output (  ostream &  out,
int  indent_level,
CPPScope *  scope,
bool  complete,
int  num_default_parameters
)  const
 

The extra parameter comes into play only when we happen to be outputting a function prototype.

See CPPFunctionType::output().

Definition at line 558 of file cppInstance.cxx.

void CPPInstance::output (  ostream &  out,
int  indent_level,
CPPScope *  scope,
bool  complete
)  const [virtual]
 

Implements CPPDeclaration.

Reimplemented in CPPTypeDeclaration, and CPPTypedef.

Definition at line 541 of file cppInstance.cxx.

References _initializer, and NULL.

Referenced by CPPTypedef::substitute_decl().

void CPPInstance::set_initializer (  CPPExpression *  initializer  ) 
 

Sets the value of the expression that is used to initialize the variable, or the default value for a parameter.

If a non-null expression is set on a function declaration, it implies that the function is pure virtual.

Definition at line 269 of file cppInstance.cxx.

References _ident, current_scope, and NULL.

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 * CPPInstance::substitute_decl (  CPPDeclaration::SubstDecl &  subst,
CPPScope *  current_scope,
CPPScope *  global_scope
)  [virtual]
 

Reimplemented in CPPTypeDeclaration, and CPPTypedef.

Definition at line 499 of file cppInstance.cxx.

References _storage_class, and SC_extern.

Referenced by CPPTypedef::CPPTypedef().


Member Data Documentation

CPPFile CPPDeclaration::_file [inherited]
 

Definition at line 149 of file cppDeclaration.h.

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

CPPIdentifier* CPPInstance::_ident
 

Definition at line 110 of file cppInstance.h.

Referenced by get_scope(), instantiate(), is_scoped(), and set_initializer().

CPPExpression* CPPInstance::_initializer
 

Definition at line 111 of file cppInstance.h.

Referenced by CPPEnumType::CPPEnumType(), CPPInstance(), instantiate(), and output().

Instantiations CPPInstance::_instantiations [private]
 

Reimplemented from CPPDeclaration.

Definition at line 117 of file cppInstance.h.

Referenced by check_for_constructor().

CPPCommentBlock* CPPDeclaration::_leading_comment [inherited]
 

Definition at line 150 of file cppDeclaration.h.

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

int CPPInstance::_storage_class
 

Definition at line 113 of file cppInstance.h.

Referenced by make_typecast_function(), and substitute_decl().

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* CPPInstance::_type
 

Definition at line 109 of file cppInstance.h.

Referenced by CPPStructType::check_virtual(), CPPInstance(), get_local_name(), get_simple_name(), InterrogateBuilder::in_noinclude(), instantiate(), CPPParameterList::substitute_decl(), TypeManager::unwrap(), and TypeManager::wrap_const_reference().

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:22 2003 for DTool by doxygen1.3