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

TypeManager Class Reference

This is just a collection of static methods that perform useful operations on CPPTypes for interrogate. More...

#include <typeManager.h>

List of all members.

Static Public Member Functions

CPPTyperesolve_type (CPPType *type, CPPScope *scope=(CPPScope *) NULL)
 A horrible hack around a CPPParser bug.

bool is_assignable (CPPType *type)
 Returns true if the indicated type is something we can legitimately assign a value to, or false otherwise.

bool is_reference (CPPType *type)
 Returns true if the indicated type is some kind of a reference or const reference type to something useful, false otherwise.

bool is_ref_to_anything (CPPType *type)
 Returns true if the indicated type is some kind of a reference or const reference type at all, false otherwise.

bool is_const_ref_to_anything (CPPType *type)
 Returns true if the indicated type is a const reference to something, false otherwise.

bool is_pointer (CPPType *type)
 Returns true if the indicated type is some kind of a pointer or const pointer type, false otherwise.

bool is_const (CPPType *type)
 Returns true if the indicated type is some kind of a const type, false otherwise.

bool is_struct (CPPType *type)
 Returns true if the indicated type is a concrete struct, class, or union type, or false otherwise.

bool is_enum (CPPType *type)
 Returns true if the indicated type is some kind of enumerated type, const or otherwise.

bool is_const_enum (CPPType *type)
 Returns true if the indicated type is a const enumerated type.

bool is_const_ref_to_enum (CPPType *type)
 Returns true if the indicated type is a const reference to an enumerated type.

bool is_simple (CPPType *type)
 Returns true if the indicated type is something that a scripting language can handle directly as a concrete, like an int or float, either const or non-const.

bool is_const_simple (CPPType *type)
 Returns true if the indicated type is a const wrapper around some simple type like int.

bool is_const_ref_to_simple (CPPType *type)
 Returns true if the indicated type is a const reference to something that a scripting language can handle directly as a concrete.

bool is_pointable (CPPType *type)
 Returns true if the indicated type is something ordinary that a scripting language can handle a pointer to, e.g.

bool is_char (CPPType *type)
 Returns true if the indicated type is char or const char, but not signed or unsigned char.

bool is_char_pointer (CPPType *type)
 Returns true if the indicated type is char * or const char * or some such.

bool is_basic_string_char (CPPType *type)
 Returns true if the type is basic_string<char>.

bool is_const_basic_string_char (CPPType *type)
 Returns true if the indicated type is a const wrapper around basic_string<char>.

bool is_const_ref_to_basic_string_char (CPPType *type)
 Returns true if the indicated type is a const reference to basic_string<char>.

bool is_bool (CPPType *type)
 Returns true if the indicated type is bool, or some trivial variant.

bool is_integer (CPPType *type)
 Returns true if the indicated type is one of the basic integer types: bool, char, short, int, or long, signed or unsigned, as well as enumerated types.

bool is_float (CPPType *type)
 Returns true if the indicated type is one of the basic floating-point types: float, double, or some similar variant.

bool is_void (CPPType *type)
 Returns true if the indicated type is void.

bool is_reference_count (CPPType *type)
 Returns true if the indicated type is some class that derives from ReferenceCount, or false otherwise.

bool is_reference_count_pointer (CPPType *type)
 Returns true if the indicated type is a pointer to a class that derives from ReferenceCount.

bool is_pointer_to_base (CPPType *type)
 Returns true if the indicated type is some class that derives from PointerToBase, or false otherwise.

bool is_const_pointer_to_base (CPPType *type)
 Returns true if the indicated type is a const PointerToBase or some derivative.

bool is_const_ref_to_pointer_to_base (CPPType *type)
 Returns true if the indicated type is a const reference to a class that derives from PointerToBase.

bool involves_unpublished (CPPType *type)
 Returns true if the type is an unpublished type, e.g.

bool involves_protected (CPPType *type)
 Returns true if the type is an protected type, e.g.

CPPTypeunwrap_pointer (CPPType *type)
 Returns the type this pointer type points to.

CPPTypeunwrap_reference (CPPType *type)
 Returns the type this reference type points to.

CPPTypeunwrap_const (CPPType *type)
 Removes the const declaration from the outside of the type.

CPPTypeunwrap_const_reference (CPPType *type)
 Removes a reference or a const reference from the type.

CPPTypeunwrap (CPPType *type)
 Removes all const, pointer, and reference wrappers, to get to the thing we're talking about.

CPPTypeget_pointer_type (CPPStructType *pt_type)
 Returns the type of pointer the given PointerTo class emulates.

CPPTypewrap_pointer (CPPType *type)
 Returns the type corresponding to a pointer to the given type.

CPPTypewrap_const_pointer (CPPType *type)
 Returns the type corresponding to a const pointer to the given type.

CPPTypewrap_const_reference (CPPType *type)
 Returns the type corresponding to a const reference to the given type.

CPPTypeget_basic_string_char_type ()
 Returns a CPPType that represents basic_string<char>, or NULL if the type is unknown.

CPPTypeget_reference_count_type ()
 Returns a CPPType that represents ReferenceCount, or NULL if the type is unknown.

CPPTypeget_void_type ()
 Returns a CPPType that represents void.

CPPTypeget_int_type ()
 Returns a CPPType that represents int.

string get_function_signature (CPPInstance *function, int num_default_parameters=0)
 Returns a string corresponding to the given function signature.

string get_function_name (CPPInstance *function)
 Returns a string corresponding to the given function name.

bool has_protected_destructor (CPPType *type)
 Returns true if the destructor for the given class or struct is protected or private, or false if the destructor is public or absent.


Detailed Description

This is just a collection of static methods that perform useful operations on CPPTypes for interrogate.

The class is really just a namespace that groups these functions together.

Definition at line 55 of file typeManager.h.


Member Function Documentation

CPPType * TypeManager::get_basic_string_char_type  )  [static]
 

Returns a CPPType that represents basic_string<char>, or NULL if the type is unknown.

Definition at line 1217 of file typeManager.cxx.

Referenced by is_pointable().

string TypeManager::get_function_name CPPInstance function  )  [static]
 

Returns a string corresponding to the given function name.

This is not necessarily unique to the particular overloaded function instance, but is common among all overloaded functions of the same name.

Definition at line 1385 of file typeManager.cxx.

string TypeManager::get_function_signature CPPInstance function,
int  num_default_parameters = 0
[static]
 

Returns a string corresponding to the given function signature.

This is a unique string per each uniquely-callable C++ function or method. Basically it's the function prototype, sans the return type.

If num_default_parameters is nonzero, it is the number of parameters to omit from the end of the parameter list. This in effect gets the function signature for an equivalent function with n parameters assuming default values.

Definition at line 1313 of file typeManager.cxx.

CPPType * TypeManager::get_int_type  )  [static]
 

Returns a CPPType that represents int.

Definition at line 1276 of file typeManager.cxx.

CPPType * TypeManager::get_pointer_type CPPStructType pt_type  )  [static]
 

Returns the type of pointer the given PointerTo class emulates.

Essentially this just checks the return type of the method called 'p()'. Returns NULL if the PointerTo class has no method p().

Definition at line 1120 of file typeManager.cxx.

CPPType * TypeManager::get_reference_count_type  )  [static]
 

Returns a CPPType that represents ReferenceCount, or NULL if the type is unknown.

Definition at line 1238 of file typeManager.cxx.

CPPType * TypeManager::get_void_type  )  [static]
 

Returns a CPPType that represents void.

Definition at line 1257 of file typeManager.cxx.

bool TypeManager::has_protected_destructor CPPType type  )  [static]
 

Returns true if the destructor for the given class or struct is protected or private, or false if the destructor is public or absent.

Definition at line 1402 of file typeManager.cxx.

bool TypeManager::involves_protected CPPType type  )  [static]
 

Returns true if the type is an protected type, e.g.

a protected or private nested class, or if the type is a pointer or reference to such a protected type, or even if the type is a function type that includes a parameter of such a protected type.

Definition at line 953 of file typeManager.cxx.

Referenced by is_const_pointer_to_base().

bool TypeManager::involves_unpublished CPPType type  )  [static]
 

Returns true if the type is an unpublished type, e.g.

a protected or private nested class, or simply a type not marked as 'published', or if the type is a pointer or reference to such an unpublished type, or even if the type is a function type that includes a parameter of such an unpublished type.

Definition at line 868 of file typeManager.cxx.

References CPPReferenceType::_pointing_at, CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::as_reference_type(), CPPDeclaration::ST_const, CPPDeclaration::ST_reference, and unwrap_reference().

bool TypeManager::is_assignable CPPType type  )  [static]
 

Returns true if the indicated type is something we can legitimately assign a value to, or false otherwise.

Definition at line 88 of file typeManager.cxx.

bool TypeManager::is_basic_string_char CPPType type  )  [static]
 

Returns true if the type is basic_string<char>.

This is the standard C++ string class.

Definition at line 506 of file typeManager.cxx.

References CPPSimpleType::_type, CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::as_simple_type(), CPPDeclaration::get_subtype(), is_integer(), NULL, CPPDeclaration::ST_const, CPPDeclaration::ST_enum, CPPDeclaration::ST_simple, CPPSimpleType::T_bool, CPPSimpleType::T_char, and CPPSimpleType::T_int.

Referenced by is_pointable(), and InterfaceMaker::write_functions().

bool TypeManager::is_bool CPPType type  )  [static]
 

Returns true if the indicated type is bool, or some trivial variant.

Definition at line 577 of file typeManager.cxx.

bool TypeManager::is_char CPPType type  )  [static]
 

Returns true if the indicated type is char or const char, but not signed or unsigned char.

Definition at line 449 of file typeManager.cxx.

Referenced by is_const_ref_to_simple(), is_const_simple(), and is_simple().

bool TypeManager::is_char_pointer CPPType type  )  [static]
 

Returns true if the indicated type is char * or const char * or some such.

Definition at line 482 of file typeManager.cxx.

References CPPSimpleType::_type, CPPDeclaration::as_simple_type(), NULL, CPPDeclaration::ST_simple, and CPPSimpleType::T_bool.

Referenced by is_const_ref_to_simple(), InterfaceMakerPythonObj::write_function_for(), and InterfaceMaker::write_prototypes().

bool TypeManager::is_const CPPType type  )  [static]
 

Returns true if the indicated type is some kind of a const type, false otherwise.

Definition at line 230 of file typeManager.cxx.

References CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::get_subtype(), is_enum(), CPPDeclaration::ST_const, and CPPDeclaration::ST_enum.

bool TypeManager::is_const_basic_string_char CPPType type  )  [static]
 

Returns true if the indicated type is a const wrapper around basic_string<char>.

Definition at line 535 of file typeManager.cxx.

References CPPSimpleType::_type, CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::as_simple_type(), CPPDeclaration::get_subtype(), is_float(), NULL, CPPDeclaration::ST_const, CPPDeclaration::ST_simple, CPPSimpleType::T_double, and CPPSimpleType::T_float.

bool TypeManager::is_const_enum CPPType type  )  [static]
 

Returns true if the indicated type is a const enumerated type.

Definition at line 300 of file typeManager.cxx.

References CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::get_subtype(), is_simple(), and CPPDeclaration::ST_const.

bool TypeManager::is_const_pointer_to_base CPPType type  )  [static]
 

Returns true if the indicated type is a const PointerToBase or some derivative.

Definition at line 815 of file typeManager.cxx.

References CPPParameterList::_parameters, CPPFunctionType::_parameters, CPPFunctionType::_return_type, CPPDeclaration::as_function_type(), involves_protected(), and CPPDeclaration::ST_function.

Referenced by is_reference_count().

bool TypeManager::is_const_ref_to_anything CPPType type  )  [static]
 

Returns true if the indicated type is a const reference to something, false otherwise.

Definition at line 182 of file typeManager.cxx.

bool TypeManager::is_const_ref_to_basic_string_char CPPType type  )  [static]
 

Returns true if the indicated type is a const reference to basic_string<char>.

Definition at line 556 of file typeManager.cxx.

Referenced by InterfaceMaker::write_functions().

bool TypeManager::is_const_ref_to_enum CPPType type  )  [static]
 

Returns true if the indicated type is a const reference to an enumerated type.

Definition at line 321 of file typeManager.cxx.

References CPPReferenceType::_pointing_at, CPPDeclaration::as_reference_type(), CPPDeclaration::get_subtype(), is_const_simple(), and CPPDeclaration::ST_reference.

bool TypeManager::is_const_ref_to_pointer_to_base CPPType type  )  [static]
 

Returns true if the indicated type is a const reference to a class that derives from PointerToBase.

Definition at line 836 of file typeManager.cxx.

References V_public.

bool TypeManager::is_const_ref_to_simple CPPType type  )  [static]
 

Returns true if the indicated type is a const reference to something that a scripting language can handle directly as a concrete.

Definition at line 394 of file typeManager.cxx.

References CPPPointerType::_pointing_at, CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::as_pointer_type(), CPPDeclaration::get_subtype(), is_char(), is_char_pointer(), CPPDeclaration::ST_const, and CPPDeclaration::ST_pointer.

bool TypeManager::is_const_simple CPPType type  )  [static]
 

Returns true if the indicated type is a const wrapper around some simple type like int.

Definition at line 371 of file typeManager.cxx.

References CPPSimpleType::_flags, CPPSimpleType::_type, CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::as_simple_type(), CPPDeclaration::get_subtype(), is_char(), NULL, CPPDeclaration::ST_const, CPPDeclaration::ST_simple, and CPPSimpleType::T_char.

Referenced by is_const_ref_to_enum().

bool TypeManager::is_enum CPPType type  )  [static]
 

Returns true if the indicated type is some kind of enumerated type, const or otherwise.

Definition at line 276 of file typeManager.cxx.

Referenced by is_const(), and is_struct().

bool TypeManager::is_float CPPType type  )  [static]
 

Returns true if the indicated type is one of the basic floating-point types: float, double, or some similar variant.

Definition at line 650 of file typeManager.cxx.

Referenced by is_const_basic_string_char().

bool TypeManager::is_integer CPPType type  )  [static]
 

Returns true if the indicated type is one of the basic integer types: bool, char, short, int, or long, signed or unsigned, as well as enumerated types.

Definition at line 611 of file typeManager.cxx.

Referenced by is_basic_string_char().

bool TypeManager::is_pointable CPPType type  )  [static]
 

Returns true if the indicated type is something ordinary that a scripting language can handle a pointer to, e.g.

a class or a structure, but not an int or a function.

Definition at line 419 of file typeManager.cxx.

References CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), get_basic_string_char_type(), CPPType::get_local_name(), CPPDeclaration::get_subtype(), is_basic_string_char(), NULL, parser, and CPPDeclaration::ST_const.

Referenced by is_simple().

bool TypeManager::is_pointer CPPType type  )  [static]
 

Returns true if the indicated type is some kind of a pointer or const pointer type, false otherwise.

Definition at line 206 of file typeManager.cxx.

References CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::get_subtype(), is_struct(), CPPDeclaration::ST_const, CPPDeclaration::ST_extension, and CPPDeclaration::ST_struct.

bool TypeManager::is_pointer_to_base CPPType type  )  [static]
 

Returns true if the indicated type is some class that derives from PointerToBase, or false otherwise.

Definition at line 769 of file typeManager.cxx.

References CPPType::_declaration, CPPDeclaration::_vis, min_vis, and NULL.

Referenced by is_void().

bool TypeManager::is_ref_to_anything CPPType type  )  [static]
 

Returns true if the indicated type is some kind of a reference or const reference type at all, false otherwise.

Definition at line 158 of file typeManager.cxx.

References CPPDeclaration::ST_reference.

Referenced by is_reference().

bool TypeManager::is_reference CPPType type  )  [static]
 

Returns true if the indicated type is some kind of a reference or const reference type to something useful, false otherwise.

Definition at line 132 of file typeManager.cxx.

References CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::get_subtype(), is_ref_to_anything(), CPPDeclaration::ST_const, and CPPDeclaration::ST_reference.

Referenced by is_reference_count().

bool TypeManager::is_reference_count CPPType type  )  [static]
 

Returns true if the indicated type is some class that derives from ReferenceCount, or false otherwise.

Definition at line 705 of file typeManager.cxx.

References CPPReferenceType::_pointing_at, CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::as_reference_type(), is_const_pointer_to_base(), is_reference(), CPPDeclaration::ST_const, and CPPDeclaration::ST_reference.

Referenced by FunctionRemap::get_parameter_name().

bool TypeManager::is_reference_count_pointer CPPType type  )  [static]
 

Returns true if the indicated type is a pointer to a class that derives from ReferenceCount.

Definition at line 745 of file typeManager.cxx.

bool TypeManager::is_simple CPPType type  )  [static]
 

Returns true if the indicated type is something that a scripting language can handle directly as a concrete, like an int or float, either const or non-const.

Definition at line 346 of file typeManager.cxx.

References CPPExtensionType::_type, CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::as_extension_type(), is_char(), is_pointable(), CPPDeclaration::ST_const, CPPDeclaration::ST_extension, CPPDeclaration::ST_simple, CPPDeclaration::ST_struct, and CPPExtensionType::T_enum.

Referenced by is_const_enum().

bool TypeManager::is_struct CPPType type  )  [static]
 

Returns true if the indicated type is a concrete struct, class, or union type, or false otherwise.

Definition at line 251 of file typeManager.cxx.

References CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::get_subtype(), is_enum(), and CPPDeclaration::ST_const.

Referenced by is_pointer().

bool TypeManager::is_void CPPType type  )  [static]
 

Returns true if the indicated type is void.

(Not void *, just void.)

Definition at line 683 of file typeManager.cxx.

References CPPConstType::_wrapped_around, CPPDeclaration::as_const_type(), CPPDeclaration::get_subtype(), is_pointer_to_base(), and CPPDeclaration::ST_const.

CPPType * TypeManager::resolve_type CPPType type,
CPPScope scope = (CPPScope *)NULL
[static]
 

A horrible hack around a CPPParser bug.

We don't trust the CPPType pointer we were given; instead, we ask CPPParser to parse a new type of the same name. This has a better chance of fully resolving templates.

Definition at line 53 of file typeManager.cxx.

CPPType * TypeManager::unwrap CPPType type  )  [static]
 

Removes all const, pointer, and reference wrappers, to get to the thing we're talking about.

Definition at line 1089 of file typeManager.cxx.

References CPPInstance::_type, CPPDeclaration::as_function_type(), and NULL.

CPPType * TypeManager::unwrap_const CPPType type  )  [static]
 

Removes the const declaration from the outside of the type.

Definition at line 1044 of file typeManager.cxx.

References NULL, CPPParser::parse_type(), and parser.

CPPType * TypeManager::unwrap_const_reference CPPType type  )  [static]
 

Removes a reference or a const reference from the type.

Definition at line 1065 of file typeManager.cxx.

References CPPType::new_type(), NULL, and CPPSimpleType::T_void.

CPPType * TypeManager::unwrap_pointer CPPType type  )  [static]
 

Returns the type this pointer type points to.

Definition at line 998 of file typeManager.cxx.

CPPType * TypeManager::unwrap_reference CPPType type  )  [static]
 

Returns the type this reference type points to.

Definition at line 1020 of file typeManager.cxx.

Referenced by involves_unpublished().

CPPType * TypeManager::wrap_const_pointer CPPType type  )  [static]
 

Returns the type corresponding to a const pointer to the given type.

Definition at line 1173 of file typeManager.cxx.

References CPPScope::_declarations, CPPDeclaration::as_struct_type(), CPPStructType::get_scope(), and NULL.

CPPType * TypeManager::wrap_const_reference CPPType type  )  [static]
 

Returns the type corresponding to a const reference to the given type.

Definition at line 1195 of file typeManager.cxx.

References CPPFunctionType::_flags, CPPInstance::_type, CPPDeclaration::_vis, CPPDeclaration::as_function_type(), CPPFunctionType::F_destructor, CPPDeclaration::get_subtype(), NULL, CPPDeclaration::ST_function, CPPDeclaration::ST_instance, and V_public.

CPPType * TypeManager::wrap_pointer CPPType type  )  [static]
 

Returns the type corresponding to a pointer to the given type.

Definition at line 1158 of file typeManager.cxx.

References CPPInstance::get_local_name(), and parser.


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