Package pygccxml :: Package declarations :: Module scopedef :: Class scopedef_t

type scopedef_t

source code

               object --+    
                        |    
declaration.declaration_t --+
                            |
                           scopedef_t
Known Subclasses:

Base class for namespace_t and class_t classes.

This is the base class for all declaration classes that may have children nodes. The children can be accessed via the declarations property.

Also this class provides "get/select/find" interface. Using this class you can get instance or instances of internal declaration(s).

You can find declaration(s) using next criteria:

  1. name - declaration name, could be full qualified name
  2. header_dir - directory, to which belongs file, that the declaration was declarated in. header_dir should be absolute path.
  3. header_file - file that the declaration was declarated in.
  4. function - user ( your ) custom criteria. The interesting thing is that this function will be joined with other arguments ( criteria ).
  5. recursive - the search declaration range, if True will be search in internal declarations too.

Every "select" API you can invoke and pass as first argument at declaration name or function. This class will find out correctly what argument represents.

Example:

   ns - referrers to global namespace
   ns.member_function( "do_something ) - will return reference to member
   function named "do_something". If there is no such function exception
   will be raised. If there is more then one function exception will be
   raised too.

Example 2:

   ns - referers to global namespace
   do_smths = ns.member_functions( "do_something ) - will return instance
   of L{mdecl_wrapper_t} object. This object allows you few things:

   1. To iterate on selected declarations
   2. To set some property to desired value using one line of code only:
      do_smths.call_policies = x
   3. To call some function on every instance using one line of code:
      do_smths.exclude()

   Pay attention: you can not use "get" functions or properties.
Nested Classes
declaration_not_found_t
exception, that will be raised, if the declaration could not be found
multiple_declarations_found_t
exception, that will be raised, if more than one declaration was found
Instance Methods
 
__init__(self, name='') source code
 
__eq__(self, other)
function will return true, if both declarations refers to the same object.
source code
 
remove_declaration(self, decl) source code
 
clear_optimizer(self)
Cleans query optimizer state
source code
 
init_optimizer(self)
Initializes query optimizer state.
source code
 
decl(self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None)
returns reference to declaration, that is matched defined criterias
source code
 
decls(self, name=None, function=None, decl_type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of declarations, that are matched defined criterias
source code
 
class_(self, name=None, function=None, header_dir=None, header_file=None, recursive=None)
returns reference to class declaration, that is matched defined criterias
source code
 
classes(self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of class declarations, that are matched defined criterias
source code
 
variable(self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None)
returns reference to variable declaration, that is matched defined criterias
source code
 
var(self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None)
returns reference to variable declaration, that is matched defined criterias
source code
 
variables(self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of variable declarations, that are matched defined criterias
source code
 
vars(self, name=None, function=None, type=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of variable declarations, that are matched defined criterias
source code
 
calldef(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)
returns reference to "calldef" declaration, that is matched defined criterias
source code
 
calldefs(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of calldef declarations, that are matched defined criterias
source code
 
operator(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)
returns reference to operator declaration, that is matched defined criterias
source code
 
operators(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of operator declarations, that are matched defined criterias
source code
 
member_function(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)
returns reference to member declaration, that is matched defined criterias
source code
 
mem_fun(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)
returns reference to member declaration, that is matched defined criterias
source code
 
member_functions(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of member function declarations, that are matched defined criterias
source code
 
mem_funs(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of member function declarations, that are matched defined criterias
source code
 
constructor(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)
returns reference to constructor declaration, that is matched defined criterias
source code
 
constructors(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of constructor declarations, that are matched defined criterias
source code
 
member_operator(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)
returns reference to member operator declaration, that is matched defined criterias
source code
 
mem_oper(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)
returns reference to member operator declaration, that is matched defined criterias
source code
 
member_operators(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of member operator declarations, that are matched defined criterias
source code
 
mem_opers(self, name=None, function=None, symbol=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of member operator declarations, that are matched defined criterias
source code
 
casting_operator(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None)
returns reference to casting operator declaration, that is matched defined criterias
source code
 
casting_operators(self, name=None, function=None, return_type=None, arg_types=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of casting operator declarations, that are matched defined criterias
source code
 
enumeration(self, name=None, function=None, header_dir=None, header_file=None, recursive=None)
returns reference to enumeration declaration, that is matched defined criterias
source code
 
enum(self, name=None, function=None, header_dir=None, header_file=None, recursive=None)
adding small aliase to enumeration method
source code
 
enumerations(self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of enumeration declarations, that are matched defined criterias
source code
 
enums(self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of enumeration declarations, that are matched defined criterias
source code
 
typedef(self, name=None, function=None, header_dir=None, header_file=None, recursive=None)
returns reference to typedef declaration, that is matched defined criterias
source code
 
typedefs(self, name=None, function=None, header_dir=None, header_file=None, recursive=None, allow_empty=None)
returns a set of typedef declarations, that are matched defined criterias
source code
 
__getitem__(self, name_or_function)
Allow simple name based find of decls.
source code

Inherited from declaration.declaration_t: __lt__, __ne__, __str__, create_decl_string, i_depend_on_them

Class Variables
  RECURSIVE_DEFAULT = True
  ALLOW_EMPTY_MDECL_WRAPPER = False
Properties
  declarations
list of children declarations

Inherited from declaration.declaration_t: attributes, cache, compiler, decl_string, demangled, is_artificial, location, mangled, name, parent, partial_decl_string, partial_name, top_parent

Method Details

__init__(self, name='')
(Constructor)

source code 
Overrides: declaration.declaration_t.__init__

__eq__(self, other)
(Equality operator)

source code 

function will return true, if both declarations refers to the same object. This function could be implemented in terms of _get__cmp__data, but in this case it will downgrade performance. self.mangled property is not compared, because it could be chaned from one compilation time to an other.

Overrides: declaration.declaration_t.__eq__
(inherited documentation)

init_optimizer(self)

source code 

Initializes query optimizer state. There are 4 internals hash tables:

  1. from type to declarations
  2. from type to declarations for non-recursive queries
  3. from type to name to declarations
  4. from type to name to declarations for non-recursive queries

Almost every query includes declaration type information. Also very common query is to search some declaration(s) by name or full name. Those hashtables allows to search declaration very quick.

__getitem__(self, name_or_function)
(Indexing operator)

source code 

Allow simple name based find of decls. Internally just calls decls() method. @param name_or_function Name of decl to lookup or finder function.


Property Details

declarations

list of children declarations

Get Method:
_get_declarations(self)