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

CPPScope Class Reference

#include <cppScope.h>

Inheritance diagram for CPPScope:

CPPParser CPPTemplateScope List of all members.

Public Types

typedef vector< CPPDeclaration * > Declarations
typedef map< string, CPPType * > ExtensionTypes
typedef map< string, CPPNamespace * > Namespaces
typedef map< string, CPPTypedef * > Typedefs
typedef map< string, CPPInstance * > Variables
typedef map< string, CPPFunctionGroup * > Functions
typedef map< string, CPPDeclaration * > Templates

Public Member Functions

 CPPScope (CPPScope *parent_scope, const CPPNameComponent &name, CPPVisibility starting_vis)
virtual ~CPPScope ()
void set_current_vis (CPPVisibility current_vis)
CPPVisibility get_current_vis () const
void set_struct_type (CPPStructType *struct_type)
 Sets the struct or class that owns this scope.

CPPStructTypeget_struct_type () const
 Returns the class or struct that defines this scope, if any.

CPPScope * get_parent_scope () const
 Returns the parent scope of this scope, if any.

virtual void add_declaration (CPPDeclaration *decl, CPPScope *global_scope, CPPPreprocessor *preprocessor, const cppyyltype &pos)
virtual void add_enum_value (CPPInstance *inst)
virtual void define_extension_type (CPPExtensionType *type)
virtual void define_namespace (CPPNamespace *scope)
virtual void add_using (CPPUsing *using_decl, CPPScope *global_scope, CPPPreprocessor *error_sink=NULL)
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.

CPPScope * instantiate (const CPPTemplateParameterList *actual_params, CPPScope *current_scope, CPPScope *global_scope, CPPPreprocessor *error_sink=NULL) const
CPPScope * substitute_decl (CPPDeclaration::SubstDecl &subst, CPPScope *current_scope, CPPScope *global_scope) const
CPPTypefind_type (const string &name, bool recurse=true) const
CPPTypefind_type (const string &name, CPPDeclaration::SubstDecl &subst, CPPScope *global_scope, bool recurse=true) const
CPPScope * find_scope (const string &name, bool recurse=true) const
CPPScope * find_scope (const string &name, CPPDeclaration::SubstDecl &subst, CPPScope *global_scope, bool recurse=true) const
CPPDeclarationfind_symbol (const string &name, bool recurse=true) const
CPPDeclarationfind_template (const string &name, bool recurse=true) const
virtual string get_simple_name () const
virtual string get_local_name (CPPScope *scope=NULL) const
virtual string get_fully_scoped_name () const
virtual void output (ostream &out, CPPScope *scope) const
void write (ostream &out, int indent, CPPScope *scope) const
CPPTemplateScopeget_template_scope ()
 Returns the nearest ancestor of this scope that is a template scope, or NULL if the scope is fully specified.

virtual CPPTemplateScopeas_template_scope ()

Public Attributes

Declarations _declarations
ExtensionTypes _structs
ExtensionTypes _classes
ExtensionTypes _unions
ExtensionTypes _enums
Namespaces _namespaces
Typedefs _typedefs
Variables _variables
Variables _enum_values
Functions _functions
Templates _templates
CPPNameComponent _name

Protected Types

typedef set< CPPScope * > Using

Protected Attributes

CPPScope * _parent_scope
CPPStructType_struct_type
Using _using
CPPVisibility _current_vis

Private Types

typedef map< const CPPTemplateParameterList *,
CPPScope *, CPPTPLCompare
Instantiations

Private Member Functions

bool copy_substitute_decl (CPPScope *to_scope, CPPDeclaration::SubstDecl &subst, CPPScope *global_scope) const
 This is in support of both substitute_decl() and instantiate().

void handle_declaration (CPPDeclaration *decl, CPPScope *global_scope)
 Does the right thing with a newly given declaration: adds it to the typedef list, or variables or functions, or whatever.


Private Attributes

Instantiations _instantiations
bool _is_fully_specified
bool _fully_specified_known
bool _is_fully_specified_recursive_protect
bool _subst_decl_recursive_protect

Member Typedef Documentation

typedef vector<CPPDeclaration *> CPPScope::Declarations
 

Definition at line 126 of file cppScope.h.

typedef map<string, CPPType *> CPPScope::ExtensionTypes
 

Definition at line 129 of file cppScope.h.

typedef map<string, CPPFunctionGroup *> CPPScope::Functions
 

Definition at line 143 of file cppScope.h.

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

Definition at line 157 of file cppScope.h.

typedef map<string, CPPNamespace *> CPPScope::Namespaces
 

Definition at line 135 of file cppScope.h.

typedef map<string, CPPDeclaration *> CPPScope::Templates
 

Definition at line 145 of file cppScope.h.

typedef map<string, CPPTypedef *> CPPScope::Typedefs
 

Definition at line 138 of file cppScope.h.

typedef set<CPPScope *> CPPScope::Using [protected]
 

Definition at line 152 of file cppScope.h.

typedef map<string, CPPInstance *> CPPScope::Variables
 

Definition at line 140 of file cppScope.h.


Constructor & Destructor Documentation

CPPScope::CPPScope CPPScope *  parent_scope,
const CPPNameComponent name,
CPPVisibility  starting_vis
 

Definition at line 50 of file cppScope.cxx.

References _fully_specified_known, _is_fully_specified, _is_fully_specified_recursive_protect, _struct_type, _subst_decl_recursive_protect, and NULL.

CPPScope::~CPPScope  )  [virtual]
 

Definition at line 71 of file cppScope.cxx.

References _struct_type.


Member Function Documentation

void CPPScope::add_declaration CPPDeclaration decl,
CPPScope *  global_scope,
CPPPreprocessor preprocessor,
const cppyyltype pos
[virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 155 of file cppScope.cxx.

References _enum_values.

Referenced by CPPTemplateScope::CPPTemplateScope().

void CPPScope::add_enum_value CPPInstance inst  )  [virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 181 of file cppScope.cxx.

References _enums, _unions, and CPPExtensionType::T_enum.

Referenced by CPPTemplateScope::add_declaration().

void CPPScope::add_using CPPUsing using_decl,
CPPScope *  global_scope,
CPPPreprocessor error_sink = NULL
[virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 279 of file cppScope.cxx.

References _is_fully_specified.

CPPTemplateScope * CPPScope::as_template_scope  )  [virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 907 of file cppScope.cxx.

Referenced by get_fully_scoped_name(), and is_fully_specified().

bool CPPScope::copy_substitute_decl CPPScope *  to_scope,
CPPDeclaration::SubstDecl subst,
CPPScope *  global_scope
const [private]
 

This is in support of both substitute_decl() and instantiate().

It's similar in purpose to substitute_decl(), but this function assumes the caller has already created a new, empty scope. All of the declarations in this scope are copied to the new scope, filtering through the subst decl.

The return value is true if the scope is changed, false if it is not.

Definition at line 936 of file cppScope.cxx.

void CPPScope::define_extension_type CPPExtensionType type  )  [virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 198 of file cppScope.cxx.

Referenced by CPPTemplateScope::add_enum_value().

void CPPScope::define_namespace CPPNamespace scope  )  [virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 265 of file cppScope.cxx.

Referenced by CPPTemplateScope::define_extension_type().

CPPScope * CPPScope::find_scope const string &  name,
CPPDeclaration::SubstDecl subst,
CPPScope *  global_scope,
bool  recurse = true
const
 

Definition at line 642 of file cppScope.cxx.

CPPScope * CPPScope::find_scope const string &  name,
bool  recurse = true
const
 

Definition at line 587 of file cppScope.cxx.

References CPPStructType::_scope, CPPDeclaration::as_struct_type(), find_type(), global_scope, and NULL.

Referenced by CPPIdentifier::get_scope(), and CPPIdentifier::is_fully_specified().

CPPDeclaration * CPPScope::find_symbol const string &  name,
bool  recurse = true
const
 

Definition at line 663 of file cppScope.cxx.

References NULL.

CPPDeclaration * CPPScope::find_template const string &  name,
bool  recurse = true
const
 

Definition at line 729 of file cppScope.cxx.

References _parent_scope, get_local_name(), CPPNameComponent::get_name_with_templ(), and NULL.

CPPType * CPPScope::find_type const string &  name,
CPPDeclaration::SubstDecl subst,
CPPScope *  global_scope,
bool  recurse = true
const
 

Definition at line 538 of file cppScope.cxx.

References _namespaces.

CPPType * CPPScope::find_type const string &  name,
bool  recurse = true
const
 

Definition at line 493 of file cppScope.cxx.

References _typedefs, current_scope, global_scope, and substitute_decl().

Referenced by find_scope(), CPPIdentifier::get_scope(), and substitute_decl().

CPPVisibility CPPScope::get_current_vis  )  const
 

Definition at line 143 of file cppScope.cxx.

string CPPScope::get_fully_scoped_name  )  const [virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 814 of file cppScope.cxx.

References _parent_scope, as_template_scope(), get_template_scope(), and NULL.

Referenced by CPPIdentifier::get_scope(), and CPPIdentifier::is_tbd().

string CPPScope::get_local_name CPPScope *  scope = NULL  )  const [virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 791 of file cppScope.cxx.

References CPPDeclaration::_vis, and indent().

Referenced by find_template(), CPPInstance::get_simple_name(), and is_fully_specified().

CPPScope * CPPScope::get_parent_scope  )  const
 

Returns the parent scope of this scope, if any.

Definition at line 119 of file cppScope.cxx.

References _current_vis.

string CPPScope::get_simple_name  )  const [virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 774 of file cppScope.cxx.

References _parent_scope, NULL, and output().

CPPStructType * CPPScope::get_struct_type  )  const
 

Returns the class or struct that defines this scope, if any.

Definition at line 106 of file cppScope.cxx.

References _current_vis.

CPPTemplateScope * CPPScope::get_template_scope  ) 
 

Returns the nearest ancestor of this scope that is a template scope, or NULL if the scope is fully specified.

Definition at line 889 of file cppScope.cxx.

Referenced by get_fully_scoped_name().

void CPPScope::handle_declaration CPPDeclaration decl,
CPPScope *  global_scope
[private]
 

Does the right thing with a newly given declaration: adds it to the typedef list, or variables or functions, or whatever.

Definition at line 1098 of file cppScope.cxx.

CPPScope * CPPScope::instantiate const CPPTemplateParameterList actual_params,
CPPScope *  current_scope,
CPPScope *  global_scope,
CPPPreprocessor error_sink = NULL
const
 

Definition at line 359 of file cppScope.cxx.

References NULL.

Referenced by CPPIdentifier::get_scope().

bool CPPScope::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 in CPPParser, and CPPTemplateScope.

Definition at line 318 of file cppScope.cxx.

References _instantiations, _name, CPPTemplateScope::_parameters, _parent_scope, as_template_scope(), CPPTemplateParameterList::build_subst_decl(), current_scope, get_local_name(), global_scope, NULL, CPPDeclaration::SubstDecl, and CPPPreprocessor::warning().

void CPPScope::output ostream &  out,
CPPScope *  scope
const [virtual]
 

Reimplemented in CPPTemplateScope.

Definition at line 837 of file cppScope.cxx.

Referenced by get_simple_name(), and CPPIdentifier::substitute_decl().

void CPPScope::set_current_vis CPPVisibility  current_vis  ) 
 

Definition at line 131 of file cppScope.cxx.

References CPPDeclaration::_leading_comment, cppyyltype::file, cppyyltype::first_line, CPPPreprocessor::get_comment_before(), and NULL.

void CPPScope::set_struct_type CPPStructType struct_type  ) 
 

Sets the struct or class that owns this scope.

This should only be done once, when the scope and its associated struct are created. It's provided so the scope can check the struct's ancestry for inherited symbols.

Definition at line 91 of file cppScope.cxx.

References _parent_scope.

CPPScope * CPPScope::substitute_decl CPPDeclaration::SubstDecl subst,
CPPScope *  current_scope,
CPPScope *  global_scope
const
 

Definition at line 440 of file cppScope.cxx.

References CPPStructType::_derivation, _parent_scope, CPPStructType::_scope, _struct_type, _typedefs, _using, find_type(), and NULL.

Referenced by find_type().

void CPPScope::write ostream &  out,
int  indent,
CPPScope *  scope
const
 

Definition at line 854 of file cppScope.cxx.

References CPPStructType::Base::_base, CPPStructType::_derivation, CPPDeclaration::_file, CPPExtensionType::_ident, CPPStructType::_incomplete, _name, CPPIdentifier::_native_scope, _struct_type, CPPExtensionType::_type, CPPDeclaration::as_type(), global_scope, NULL, and CPPDeclaration::substitute_decl().


Member Data Documentation

ExtensionTypes CPPScope::_classes
 

Definition at line 131 of file cppScope.h.

CPPVisibility CPPScope::_current_vis [protected]
 

Definition at line 154 of file cppScope.h.

Referenced by get_parent_scope(), and get_struct_type().

Declarations CPPScope::_declarations
 

Definition at line 127 of file cppScope.h.

Referenced by InterrogateBuilder::remap_indices(), and TypeManager::wrap_const_pointer().

Variables CPPScope::_enum_values
 

Definition at line 142 of file cppScope.h.

Referenced by add_declaration().

ExtensionTypes CPPScope::_enums
 

Definition at line 133 of file cppScope.h.

Referenced by add_enum_value().

bool CPPScope::_fully_specified_known [private]
 

Definition at line 161 of file cppScope.h.

Referenced by CPPScope().

Functions CPPScope::_functions
 

Definition at line 144 of file cppScope.h.

Referenced by CPPStructType::check_virtual().

Instantiations CPPScope::_instantiations [private]
 

Definition at line 158 of file cppScope.h.

Referenced by is_fully_specified().

bool CPPScope::_is_fully_specified [private]
 

Definition at line 160 of file cppScope.h.

Referenced by add_using(), and CPPScope().

bool CPPScope::_is_fully_specified_recursive_protect [private]
 

Definition at line 162 of file cppScope.h.

Referenced by CPPScope().

CPPNameComponent CPPScope::_name
 

Definition at line 147 of file cppScope.h.

Referenced by is_fully_specified(), and write().

Namespaces CPPScope::_namespaces
 

Definition at line 136 of file cppScope.h.

Referenced by find_type().

CPPScope* CPPScope::_parent_scope [protected]
 

Definition at line 150 of file cppScope.h.

Referenced by CPPTemplateScope::add_declaration(), CPPTemplateScope::add_enum_value(), CPPTemplateScope::CPPTemplateScope(), CPPTemplateScope::define_extension_type(), CPPTemplateScope::define_namespace(), find_template(), get_fully_scoped_name(), get_simple_name(), CPPTemplateScope::is_fully_specified(), is_fully_specified(), set_struct_type(), and substitute_decl().

CPPStructType* CPPScope::_struct_type [protected]
 

Definition at line 151 of file cppScope.h.

Referenced by CPPScope(), substitute_decl(), write(), and ~CPPScope().

ExtensionTypes CPPScope::_structs
 

Definition at line 130 of file cppScope.h.

bool CPPScope::_subst_decl_recursive_protect [private]
 

Definition at line 163 of file cppScope.h.

Referenced by CPPScope().

Templates CPPScope::_templates
 

Definition at line 146 of file cppScope.h.

Typedefs CPPScope::_typedefs
 

Definition at line 139 of file cppScope.h.

Referenced by CPPTemplateScope::add_using(), find_type(), and substitute_decl().

ExtensionTypes CPPScope::_unions
 

Definition at line 132 of file cppScope.h.

Referenced by add_enum_value().

Using CPPScope::_using [protected]
 

Definition at line 153 of file cppScope.h.

Referenced by substitute_decl().

Variables CPPScope::_variables
 

Definition at line 141 of file cppScope.h.


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