Package pygccxml :: Package declarations :: Module declaration :: Class declaration_t

# type declaration_t

source code

    object --+
             |
            declaration_t

Known Subclasses:
  - variable.variable_t
  - , enumeration.enumeration_t
  - , typedef.typedef_t
  - , class_declaration.class_declaration_t
  - , scopedef.scopedef_t
  - , calldef.calldef_t

base class for all classes that represent a C++ declaration

Instance Methods

__init__(self, name=`'````'`, location=None, is_artificial=False, mangled=None, demangled=None, attributes=None) | source code

__str__(self) Default __str__ method. | source code

__eq__(self, other) function will return true, if both declarations refers to the same object. | source code

__ne__(self, other) return not self.__eq__( other ) | source code

__lt__(self, other) `if not isinstance( other, self.__class__ ):` `return self.__class__.__name__ < other.__class__.__name__` `return self._get__cmp__data() < other._get__cmp__data()` | source code

create_decl_string(self, with_defaults=True) | source code

i_depend_on_them(self, recursive=True) return list of all types and declarations the declaration depends on | source code

Properties
str | name Declaration name
| partial_name declaration name, without template default arguments Right now std containers is the only classes that support this functionality
declaration_t | parent Reference to parent declaration
declaration_t | top_parent reference to top parent declaration
location_t | location Location of the declaration within source file
bool | is_artificial Describes whether declaration is compiler generated or not
str | mangled Compiler generated declaration name
str | demangled Demangled compiler generated declaration name
str | attributes GCCXML attributes, set using __attribute__((gccxml("...")))
| decl_string declaration full name
| partial_decl_string declaration full name
| cache implementation details
str | compiler compiler name + version

Method Details

### __init__(self, name=`'````'`, location=None, is_artificial=False, mangled=None, demangled=None, attributes=None)
(Constructor)

source code

Overrides: object.__init__
  (inherited documentation)

### __str__(self)
(Informal representation operator)

source code

Default __str__ method.

This version just returns the decl_string and the class. Derived classes may override this method to provide more detailed information.

A __str__ method for a declaration should always provide enough information so that it uniquely identifies the declaration and the user is able to find the declaration in his source code.

Overrides: object.__str__

### __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.

Property Details

### name

Declaration name

Get Method:
  _get_name(self)
Set Method:
  _set_name(self, new_name)
Type:
  str

### partial_name

declaration name, without template default arguments Right now std containers is the only classes that support this functionality

### parent

Reference to parent declaration

Get Method:
  _get_parent(self)
Set Method:
  _set_parent(self, new_parent)
Type:
  declaration_t

### top_parent

reference to top parent declaration

Get Method:
  __get_top_parent(self)
Type:
  declaration_t

### location

Location of the declaration within source file

Get Method:
  _get_location(self)
Set Method:
  _set_location(self, new_location)
Type:
  location_t

### is_artificial

Describes whether declaration is compiler generated or not

Get Method:
  _get_is_artificial(self)
Set Method:
  _set_is_artificial(self, new_artificial)
Type:
  bool

### mangled

Compiler generated declaration name

Get Method:
  _get_mangled(self)
Set Method:
  _set_mangled(self, mangled)
Type:
  str

### demangled

Demangled compiler generated declaration name

Get Method:
  _get_demangled(self)
Set Method:
  _set_demangled(self, demangled)
Type:
  str

### attributes

GCCXML attributes, set using __attribute__((gccxml("...")))

Get Method:
  _get_attributes(self)
Set Method:
  _set_attributes(self, attributes)
Type:
  str

### decl_string

declaration full name

### partial_decl_string

declaration full name

### cache

implementation details

reference to instance of `algorithms_cache.algorithms_cache_t` class.

### compiler

compiler name + version

Get Method:
  _get_compiler(self)
Set Method:
  _set_compiler(self, compiler)
Type:
  str