EDoc::Type Class Reference

#include <include/EDoc/Type.h>

Inheritance diagram for EDoc::Type:

EDoc::StringIdentifiedObject EDoc::DictionarySpecific

Detailed Description

Represents a type in C/C++ code that has been encounterd during compilation.

Definition at line 47 of file Type.h.

Public Member Functions

 Type (Dictionary &dict_in, std::string key_name_in)
 See StringIdentifiedObject::(Dictionary& dict_in, std::string key_name_in, bool populated_in=false).
 Type (Dictionary &dict_in, int32_t index_in)
 See StringIdentifiedObject(Dictionary& dict_in, int32_t index_in, bool populated_in=false).
Typeoperator= (const Type &right)
 Copies data from another object into this one.
void Read (PersistenceIFace &file, IndexedDictionary &idict)
 See StringIdentifiedObject::Read().
void Write (PersistenceIFace &file) const
 See StringIdentifiedObject::Write().
virtual void Merge (const StringIdentifiedObject &right)
 See StringIdentifiedObject::Merge().
virtual size_t ReplaceReferences (PStack &stack, void *remove, void *replace)
 DictionarySpecific::ReplaceReferences().
virtual std::ostream & Print (std::ostream &out, std::string prefix="") const
 See DictionarySpecific::Print().
virtual void Validate (PStack &stack, const Dictionary &dict_in) const
 See DictionarySpecific::Validate().
bool operator== (const Type &right) const
 Returns true if the two types are the same.
bool operator!= (const Type &right) const
 See operator==().
virtual uint8_t GetRecordType () const
 See StringIdentifiedObject::GetRecordType().
std::string GetNormalisedName () const
 Returns the root name of this type.
std::string GetDeclaredName () const
 Returns the name of this type as declared by the user in the source code.
std::string GetBestName () const
 Will return one of GetKeyName() or GetDeclaredName() depending upon how much information is available in the object (I.e.
bool IsCaughtBy (const Type &right) const
 True if an exception of this type is thrown and it can be caught by the type passed into right.
bool IsEquivilant (const Type &right) const
 See FunctionType::IsEquivilant().
std::string GetNameInternal () const
 Returns the name of the type with translation unit info appended if it is provate to the translation unit.
const std::string & GetKeyName () const
 Returns the string key that identifies this object.
ssize_t GetIndex () const
 Returns the integer key that identifies this object.
bool IsPopulated () const
 Returns true if this object has been completely populated from a file source or manually or false if the object is incomplete.
std::string ToString (std::string prefix="") const
 Returns a string representing the current object in a user readable manner.

Data Fields

std::string name
 Name of the type as declared by the user.
bool external_linkage
 True if this type has external linkage identification or false if defined privatly to the translation unit.
TranslationUnittranslation_unit
 A reference to the translation unit this type belongs to.
Typethrow_type
 If this type is thrown what is a base type that will be used in all exception calculations.
Typeroot_type
 This is usually the base type (followed back typedefs) with equivilant const/volatile qualifiers.
std::vector< Type * > identical
 A list of other types that are considered identical to this one.
std::vector< Type * > catchable
 A list of other types that can be used to catch this type.
Location loc
 The source Location where this type was defined.
std::list< File * > referenced_in_files
 A list of source files that this type is used in.
bool visible
 True if this type is visible to the user for exceptions or false if any exceptions of this type will never be shown to the user.

Protected Member Functions

void SetKeyName (std::string key_name_in)
 Used by derived class to set the string key once it is able to determine it.

Protected Attributes

bool populated
 True if this object has been completely populated.
int32_t index
 Set to the integer index used to identify this object or -1 if the key_name is used to identify this object.
std::string key_name
 Set to the string key used to identify this object.
bool writing
 USED ONLY FROM Dictionary::Write().
Dictionarydict
 A reference to the dictionary this object belongs to.


Constructor & Destructor Documentation

EDoc::Type::Type ( EDoc::Dictionary dict_in,
std::string  key_name_in 
)

See StringIdentifiedObject::(Dictionary& dict_in, std::string key_name_in, bool populated_in=false).

Note:
EDoc++ data included.

Definition at line 52 of file Type.cpp.

EDoc::Type::Type ( EDoc::Dictionary dict_in,
int32_t  index_in 
)

See StringIdentifiedObject(Dictionary& dict_in, int32_t index_in, bool populated_in=false).

Note:
EDoc++ data included.

Definition at line 63 of file Type.cpp.


Member Function Documentation

EDoc::Type::operator= ( const Type right  ) 

Copies data from another object into this one.

This can be used across different dictionaries and will only copy object data but not identification information used in the StringIdentifiedObject such as the key name.

Definition at line 74 of file Type.cpp.

References catchable, EDoc::DictionarySpecific::dict, EDOC_Finer, EDOC_FOREACH_CONST, EDoc::Erase(), external_linkage, EDoc::Dictionary::files, identical, loc, name, EDoc::StringIdentifiedObject::populated, referenced_in_files, root_type, throw_type, translation_unit, EDoc::Dictionary::types, and visible.

EDoc::Type::Read ( EDoc::PersistenceIFace file,
EDoc::IndexedDictionary idict 
) [virtual]

See StringIdentifiedObject::Read().

Note:
EDoc++ data included.
Exceptions:
EDoc::EOFException 
EDoc::FileIOException 

Implements EDoc::StringIdentifiedObject.

Definition at line 123 of file Type.cpp.

References catchable, EDoc::IndexedDictionary::dict, external_linkage, EDoc::IndexedDictionary::files, EDoc::Dictionary::GetIndexedTranslationUnit(), GetNameInternal(), identical, KEY_CANONICAL_NAME, KEY_CATCHABLE_TYPE_LI, KEY_CATCHABLE_TYPE_LS, KEY_EXTERNAL_LINKAGE, KEY_IDENTICAL_TYPE_LI, KEY_IDENTICAL_TYPE_LS, KEY_REFERENCE_FILE, KEY_REFERENCE_FILES_LS, KEY_ROOT_TYPE, KEY_THROW_TYPE, KEY_TRANSLATION_UNIT, loc, name, EDoc::StringIdentifiedObject::populated, EDoc::Location::Read(), EDoc::PersistenceIFace::ReadBoolean(), EDoc::PersistenceIFace::ReadString(), EDoc::PersistenceIFace::ReadUInt32(), referenced_in_files, root_type, EDoc::StringIdentifiedObject::SetKeyName(), throw_type, translation_unit, and EDoc::IndexedDictionary::types.

EDoc::Type::Write ( EDoc::PersistenceIFace file  )  const [virtual]

See StringIdentifiedObject::Write().

Note:
EDoc++ data included.
Exceptions:
EDoc::FileIOException 

Implements EDoc::StringIdentifiedObject.

Definition at line 458 of file Type.cpp.

References catchable, EDoc::DictionarySpecific::dict, EDOC_FOREACH_CONST, external_linkage, EDoc::StringIdentifiedObject::GetIndex(), EDoc::TranslationUnit::GetName(), EDoc::Dictionary::GetTranslationUnitIndex(), identical, KEY_CANONICAL_NAME, KEY_CATCHABLE_TYPE_LI, KEY_CATCHABLE_TYPE_LS, KEY_EXTERNAL_LINKAGE, KEY_IDENTICAL_TYPE_LI, KEY_IDENTICAL_TYPE_LS, KEY_REFERENCE_FILE, KEY_REFERENCE_FILES_LS, KEY_ROOT_TYPE, KEY_THROW_TYPE, KEY_TRANSLATION_UNIT, loc, name, referenced_in_files, root_type, throw_type, translation_unit, EDoc::Location::Write(), EDoc::PersistenceIFace::WriteBoolean(), EDoc::PersistenceIFace::WriteString(), EDoc::PersistenceIFace::WriteUInt32(), and EDoc::PersistenceIFace::WriteUInt32Debug().

EDoc::Type::Merge ( const StringIdentifiedObject right  )  [virtual]

See StringIdentifiedObject::Merge().

Note:
EDoc++ data included.
Exceptions:
EDoc::MergeException 

Implements EDoc::StringIdentifiedObject.

Definition at line 232 of file Type.cpp.

References catchable, EDoc::DictionarySpecific::dict, EDOC_ASSERT, EDOC_Error, EDOC_Finer, EDOC_FOREACH, EDOC_FOREACH_CONST, EDOC_MERGE_ERROR, external_linkage, EDoc::Dictionary::files, EDoc::TranslationUnit::GetID(), EDoc::StringIdentifiedObject::GetKeyName(), EDoc::TranslationUnit::GetName(), GetNormalisedName(), identical, loc, EDoc::Location::Merge(), name, EDoc::StringIdentifiedObject::populated, Print(), EDoc::PushBackUnique(), referenced_in_files, root_type, throw_type, translation_unit, and EDoc::Dictionary::types.

EDoc::Type::ReplaceReferences ( EDoc::PStack stack,
void *  remove,
void *  replace 
) [virtual]

DictionarySpecific::ReplaceReferences().

Note:
EDoc++ data included.

Implements EDoc::DictionarySpecific.

Definition at line 531 of file Type.cpp.

References catchable, EDOC_FOREACH, EDOC_REPLACE, identical, loc, EDoc::PStack::Push(), referenced_in_files, EDoc::Location::ReplaceReferences(), root_type, and throw_type.

EDoc::Type::Print ( std::ostream &  out,
std::string  prefix = "" 
) const [virtual]

See DictionarySpecific::Print().

Note:
EDoc++ data included.

Implements EDoc::DictionarySpecific.

Definition at line 163 of file Type.cpp.

References catchable, GetNormalisedName(), identical, loc, name, EDoc::Location::Print(), root_type, and throw_type.

Referenced by Merge().

EDoc::Type::Validate ( EDoc::PStack stack,
const Dictionary dict_in 
) const [virtual]

See DictionarySpecific::Validate().

Note:
EDoc++ data included.

Implements EDoc::DictionarySpecific.

Definition at line 570 of file Type.cpp.

References catchable, EDoc::DictionarySpecific::dict, EDOC_ASSERT, EDOC_FOREACH_CONST, external_linkage, EDoc::StringIdentifiedObject::GetKeyName(), identical, EDoc::StringIdentifiedObject::index, EDoc::StringIdentifiedObject::key_name, loc, EDoc::StringIdentifiedObject::populated, referenced_in_files, root_type, throw_type, translation_unit, EDoc::Dictionary::types, EDoc::Location::Validate(), and Validate().

Referenced by EDoc::TypeLoc::Validate(), Validate(), and EDoc::FunctionType::Validate().

EDoc::Type::operator== ( const Type right  )  const

Returns true if the two types are the same.

Works across dictionaries.

Definition at line 191 of file Type.cpp.

References catchable, external_linkage, EDoc::TranslationUnit::GetID(), identical, loc, name, root_type, throw_type, and translation_unit.

EDoc::Type::operator!= ( const Type right  )  const [inline]

See operator==().

Note:
EDoc++ data included.

Definition at line 114 of file Type.h.

EDoc::Type::GetRecordType (  )  const [virtual]

See StringIdentifiedObject::GetRecordType().

Note:
EDoc++ data included.

Implements EDoc::StringIdentifiedObject.

Definition at line 47 of file Type.cpp.

References VALUE_RECORD_TYPE_TYPE.

EDoc::Type::GetNormalisedName (  )  const [inline]

Returns the root name of this type.

Note:
EDoc++ data included.

Definition at line 136 of file Type.h.

References name, and root_type.

Referenced by EDoc::FunctionType::GetNameInternal(), Merge(), EDoc::FunctionType::Merge(), EDoc::TypeLoc::operator==(), and Print().

EDoc::Type::GetDeclaredName (  )  const [inline]

Returns the name of this type as declared by the user in the source code.

Note:
EDoc++ data included.

Definition at line 145 of file Type.h.

References name.

Referenced by EDoc::AddPException(), EDoc::AddRethrow(), EDoc::FunctionType::Print(), EDoc::PropogatingException::Validate(), and EDoc::TypeLoc::Write().

EDoc::Type::GetBestName (  )  const [inline]

Will return one of GetKeyName() or GetDeclaredName() depending upon how much information is available in the object (I.e.

if it has been populated yet).

Definition at line 155 of file Type.h.

References EDoc::StringIdentifiedObject::GetKeyName(), EDoc::StringIdentifiedObject::IsPopulated(), and name.

EDoc::Type::IsCaughtBy ( const Type right  )  const

True if an exception of this type is thrown and it can be caught by the type passed into right.

Note:
EDoc++ data included.

Definition at line 417 of file Type.cpp.

References catchable, EDOC_THROW_EXCEPTION, name, and throw_type.

EDoc::Type::IsEquivilant ( const Type right  )  const

See FunctionType::IsEquivilant().

Note:
EDoc++ data included.

Definition at line 498 of file Type.cpp.

References external_linkage, EDoc::StringIdentifiedObject::GetKeyName(), and root_type.

Referenced by EDoc::FunctionType::IsEquivilant().

EDoc::Type::GetNameInternal (  )  const

Returns the name of the type with translation unit info appended if it is provate to the translation unit.

Note:
EDoc++ data included.

Definition at line 630 of file Type.cpp.

References external_linkage, EDoc::TranslationUnit::GetID(), EDoc::TranslationUnit::GetName(), EDoc::Location::line, loc, name, and translation_unit.

Referenced by Read().

EDoc::StringIdentifiedObject::GetKeyName (  )  const [inherited]

Returns the string key that identifies this object.

Will assert if the object has not yet been populated OR it currently uses an integer identifier not a string identifier.

Definition at line 51 of file StringIdentifiedObject.cpp.

References EDOC_ASSERT, EDoc::StringIdentifiedObject::index, EDoc::StringIdentifiedObject::key_name, and EDoc::StringIdentifiedObject::writing.

Referenced by EDoc::ManagedObject::CAdd(), EDoc::ManagedObject::CAlwaysGet(), EDoc::ManagedObject::CRemove(), EDoc::Function::ExpandCallGraph(), EDoc::FunctionLoc::FunctionLoc(), GetBestName(), IsEquivilant(), Merge(), EDoc::Location::Merge(), EDoc::FunctionType::Merge(), EDoc::Function::Merge(), EDoc::FunctionLoc::operator<(), EDoc::TypeLoc::Print(), EDoc::PropogatingException::Print(), EDoc::FunctionTypeLoc::Print(), EDoc::FunctionLoc::Print(), EDoc::Function::Print(), EDoc::Exception::Print(), EDoc::CatchBlock::Print(), EDoc::Dictionary::ProcessCodeBlock(), EDoc::Dictionary::ProcessFunction(), EDoc::StdErrFunctionProgress::Progress(), EDoc::Dictionary::Read(), EDoc::Dictionary::UpdateFunctionAddressLists(), Validate(), EDoc::FunctionType::Validate(), EDoc::Function::Validate(), EDoc::File::Validate(), EDoc::Dictionary::Validate(), EDoc::CatchBlock::Validate(), and EDoc::Function::Write().

EDoc::StringIdentifiedObject::GetIndex (  )  const [inline, inherited]

Returns the integer key that identifies this object.

Note:
EDoc++ data included.

Definition at line 142 of file StringIdentifiedObject.h.

References EDoc::StringIdentifiedObject::index.

Referenced by EDoc::TypeLoc::Write(), Write(), EDoc::FunctionTypeLoc::Write(), EDoc::FunctionType::Write(), EDoc::FunctionLoc::Write(), and EDoc::Function::Write().

EDoc::StringIdentifiedObject::IsPopulated (  )  const [inline, inherited]

Returns true if this object has been completely populated from a file source or manually or false if the object is incomplete.

Note:
EDoc++ data included.

Definition at line 151 of file StringIdentifiedObject.h.

References EDoc::StringIdentifiedObject::populated.

Referenced by EDoc::Dictionary::GeneratePredefined(), GetBestName(), EDoc::FunctionType::GetSpecString(), EDoc::Function::GetSpecString(), and EDoc::Dictionary::Read().

EDoc::StringIdentifiedObject::SetKeyName ( std::string  key_name_in  )  [protected, inherited]

Used by derived class to set the string key once it is able to determine it.

Usually an instance is created with an integer index and then data is loaded into the object and once it has loaded it is able to determine what its string index should be. Then it will call this function which sets the integer index to -1 and sets the string key to the given value.

Definition at line 57 of file StringIdentifiedObject.cpp.

References EDOC_ASSERT, EDoc::StringIdentifiedObject::index, and EDoc::StringIdentifiedObject::key_name.

Referenced by Read(), EDoc::FunctionType::Read(), EDoc::Function::Read(), and EDoc::File::Read().

EDoc::DictionarySpecific::ToString ( std::string  prefix = ""  )  const [inherited]

Returns a string representing the current object in a user readable manner.

This will return as a string exactly what Print() would display. This is primarily here for use from within python and for debugging.

Definition at line 34 of file DictionarySpecific.cpp.

References EDoc::DictionarySpecific::Print().

Referenced by EDoc::Dictionary::Read().


Field Documentation

std::string EDoc::Type::name

Name of the type as declared by the user.

Definition at line 185 of file Type.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), GetBestName(), GetDeclaredName(), GetNameInternal(), GetNormalisedName(), IsCaughtBy(), Merge(), operator=(), operator==(), Print(), Read(), and Write().

bool EDoc::Type::external_linkage

True if this type has external linkage identification or false if defined privatly to the translation unit.

Definition at line 191 of file Type.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), GetNameInternal(), IsEquivilant(), Merge(), operator=(), operator==(), Read(), Validate(), EDoc::CatchBlock::Validate(), and Write().

TranslationUnit* EDoc::Type::translation_unit

A reference to the translation unit this type belongs to.

This may change in the future, or not... It is NON-NULL if the type has external linkage. Possible remove the boolean value and just have the pointer. If NULL then is external if not null then internal.

Definition at line 200 of file Type.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), GetNameInternal(), Merge(), operator=(), operator==(), Read(), Validate(), and Write().

Type* EDoc::Type::throw_type

If this type is thrown what is a base type that will be used in all exception calculations.

This is usually the base type (followed back typedefs) stripped of top level const/volatile qualifiers.

Definition at line 209 of file Type.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), IsCaughtBy(), Merge(), operator=(), operator==(), Print(), Read(), ReplaceReferences(), Validate(), EDoc::CatchBlock::Validate(), and Write().

Type* EDoc::Type::root_type

This is usually the base type (followed back typedefs) with equivilant const/volatile qualifiers.

Definition at line 215 of file Type.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), GetNormalisedName(), IsEquivilant(), Merge(), operator=(), operator==(), Print(), Read(), ReplaceReferences(), Validate(), and Write().

std::vector<Type*> EDoc::Type::identical

A list of other types that are considered identical to this one.

Determined by typedefs etc.

Definition at line 223 of file Type.h.

Referenced by Merge(), operator=(), operator==(), Print(), Read(), ReplaceReferences(), Validate(), and Write().

std::vector<Type*> EDoc::Type::catchable

A list of other types that can be used to catch this type.

Definition at line 228 of file Type.h.

Referenced by IsCaughtBy(), Merge(), operator=(), operator==(), Print(), Read(), ReplaceReferences(), Validate(), and Write().

Location EDoc::Type::loc

The source Location where this type was defined.

Definition at line 233 of file Type.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), GetNameInternal(), Merge(), operator=(), operator==(), Print(), Read(), ReplaceReferences(), Validate(), and Write().

std::list<File*> EDoc::Type::referenced_in_files

A list of source files that this type is used in.

Definition at line 238 of file Type.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), Merge(), operator=(), Read(), ReplaceReferences(), Validate(), and Write().

bool EDoc::Type::visible

True if this type is visible to the user for exceptions or false if any exceptions of this type will never be shown to the user.

This is used for suppressions.

Definition at line 252 of file Type.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), EDoc::PropogatingException::IsVisible(), and operator=().

bool EDoc::StringIdentifiedObject::populated [protected, inherited]

True if this object has been completely populated.

Definition at line 176 of file StringIdentifiedObject.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), EDoc::StringIdentifiedObject::IsPopulated(), Merge(), EDoc::FunctionType::Merge(), EDoc::Function::Merge(), EDoc::File::Merge(), operator=(), EDoc::FunctionType::operator=(), EDoc::Function::operator=(), Read(), EDoc::FunctionType::Read(), EDoc::Function::Read(), EDoc::File::Read(), Validate(), EDoc::FunctionType::Validate(), and EDoc::Function::Validate().

int32_t EDoc::StringIdentifiedObject::index [mutable, protected, inherited]

Set to the integer index used to identify this object or -1 if the key_name is used to identify this object.

Definition at line 182 of file StringIdentifiedObject.h.

Referenced by EDoc::IndexedObject::CAdd(), EDoc::Dictionary::GeneratePredefined(), EDoc::StringIdentifiedObject::GetIndex(), EDoc::StringIdentifiedObject::GetKeyName(), EDoc::StringIdentifiedObject::SetKeyName(), Validate(), EDoc::FunctionType::Validate(), EDoc::Function::Validate(), and EDoc::File::Validate().

std::string EDoc::StringIdentifiedObject::key_name [protected, inherited]

Set to the string key used to identify this object.

Definition at line 187 of file StringIdentifiedObject.h.

Referenced by EDoc::Dictionary::GeneratePredefined(), EDoc::StringIdentifiedObject::GetKeyName(), EDoc::StringIdentifiedObject::SetKeyName(), Validate(), EDoc::FunctionType::Validate(), EDoc::Function::Validate(), and EDoc::File::Validate().

bool EDoc::StringIdentifiedObject::writing [mutable, protected, inherited]

USED ONLY FROM Dictionary::Write().

While writing an object to file it is possible to use both the objects integer and string keys. This is the only time that is allowable and this flag is used to determine that.

Definition at line 204 of file StringIdentifiedObject.h.

Referenced by EDoc::StringIdentifiedObject::GetKeyName().

Dictionary& EDoc::DictionarySpecific::dict [protected, inherited]

A reference to the dictionary this object belongs to.

Definition at line 150 of file DictionarySpecific.h.

Referenced by EDoc::ManagedObject::CAlwaysGet(), EDoc::CatchBlock::CatchBlock(), EDoc::Exception::Exception(), EDoc::Function::ExpandCallGraph(), EDoc::CodeBlock::ExpandCallGraph(), EDoc::FunctionLoc::FunctionLoc(), EDoc::FunctionTypeLoc::FunctionTypeLoc(), EDoc::Function::GetSubstException(), EDoc::Location::Location(), EDoc::ManagedObject::ManagedObject(), Merge(), EDoc::Location::Merge(), EDoc::Function::Merge(), EDoc::SpecificManagedObject< EDoc::Type >::New(), EDoc::TypeLoc::operator=(), operator=(), EDoc::TryBlock::operator=(), EDoc::PropogatingException::operator=(), EDoc::Location::operator=(), EDoc::FunctionTypeLoc::operator=(), EDoc::FunctionType::operator=(), EDoc::FunctionLoc::operator=(), EDoc::Function::operator=(), EDoc::Exception::operator=(), EDoc::CodeBlock::operator=(), EDoc::PropogatingException::PropogatingException(), EDoc::TryBlock::Read(), EDoc::Function::Read(), EDoc::CodeBlock::Read(), EDoc::TryBlock::TryBlock(), EDoc::TypeLoc::TypeLoc(), EDoc::TypeLoc::Validate(), Validate(), EDoc::TryBlock::Validate(), EDoc::PropogatingException::Validate(), EDoc::ManagedObject::Validate(), EDoc::Location::Validate(), EDoc::FunctionTypeLoc::Validate(), EDoc::FunctionType::Validate(), EDoc::FunctionLoc::Validate(), EDoc::Function::Validate(), EDoc::File::Validate(), EDoc::Exception::Validate(), EDoc::CodeBlock::Validate(), EDoc::CatchBlock::Validate(), Write(), and EDoc::Function::Write().


The documentation for this class was generated from the following files:
Generated on Tue Jan 20 18:26:09 2009 for EDoc-0.2.1 by  doxygen 1.5.1