decompiler
1.0.0
|
A class for writing structured data to a stream. More...
#include <marshal.hh>
Public Member Functions | |
virtual | ~Encoder (void) |
Destructor. | |
virtual void | openElement (const ElementId &elemId)=0 |
Begin a new element in the encoding. More... | |
virtual void | closeElement (const ElementId &elemId)=0 |
End the current element in the encoding. More... | |
virtual void | writeBool (const AttributeId &attribId, bool val)=0 |
Write an annotated boolean value into the encoding. More... | |
virtual void | writeSignedInteger (const AttributeId &attribId, intb val)=0 |
Write an annotated signed integer value into the encoding. More... | |
virtual void | writeUnsignedInteger (const AttributeId &attribId, uintb val)=0 |
Write an annotated unsigned integer value into the encoding. More... | |
virtual void | writeString (const AttributeId &attribId, const string &val)=0 |
Write an annotated string into the encoding. More... | |
virtual void | writeStringIndexed (const AttributeId &attribId, uint4 index, const string &val)=0 |
Write an annotated string, using an indexed attribute, into the encoding. More... | |
virtual void | writeSpace (const AttributeId &attribId, const AddrSpace *spc)=0 |
Write an address space reference into the encoding. More... | |
A class for writing structured data to a stream.
The resulting encoded data is structured similarly to an XML document. The document contains a nested set of elements, with labels corresponding to the ElementId class. A single element can hold zero or more attributes and zero or more child elements. An attribute holds a primitive data element (bool, integer, string) and is labeled by an AttributeId. The document is written using a sequence of openElement() and closeElement() calls, intermixed with write*() calls to encode the data primitives. All primitives written using a write*() call are associated with current open element, and all write*() calls for one element must come before opening any child element. The traditional XML element text content can be written using the special ATTRIB_CONTENT AttributeId, which must be the last write*() call associated with the specific element.
|
pure virtual |
End the current element in the encoding.
The current element must match the given annotation or an exception is thrown.
elemId | is the given (expected) annotation for the current element |
Implemented in ghidra::PackedEncode, and ghidra::XmlEncode.
Referenced by ghidra::InjectContextGhidra::encode(), ghidra::LoadImageXml::encode(), ghidra::XmlArchitecture::encode(), ghidra::RawBinaryArchitecture::encode(), ghidra::BfdArchitecture::encode(), ghidra::BlockEdge::encode(), ghidra::LoadTable::encode(), ghidra::StringManager::encode(), ghidra::Comment::encode(), ghidra::TrackedContext::encode(), ghidra::Override::encode(), ghidra::CPoolRecord::encode(), ghidra::Address::encode(), ghidra::SymbolEntry::encode(), ghidra::SeqNum::encode(), ghidra::CommentDatabaseInternal::encode(), ghidra::ConstantPoolInternal::CheapSorter::encode(), ghidra::FlowBlock::encode(), ghidra::Funcdata::encode(), ghidra::ConstantPoolInternal::encode(), ghidra::Range::encode(), ghidra::Datatype::encode(), ghidra::HighVariable::encode(), ghidra::ScopeLocal::encode(), ghidra::PcodeOp::encode(), ghidra::TypeField::encode(), ghidra::Architecture::encode(), ghidra::RangeList::encode(), ghidra::Symbol::encode(), ghidra::FunctionSymbol::encode(), ghidra::TypeChar::encode(), ghidra::ContextInternal::encode(), ghidra::EquateSymbol::encode(), ghidra::TypeUnicode::encode(), ghidra::UnionFacetSymbol::encode(), ghidra::LabSymbol::encode(), ghidra::TypeVoid::encode(), ghidra::Varnode::encode(), ghidra::ExternRefSymbol::encode(), ghidra::TypePointer::encode(), ghidra::TypeArray::encode(), ghidra::TypeEnum::encode(), ghidra::TypeStruct::encode(), ghidra::JumpBasicOverride::encode(), ghidra::TypeUnion::encode(), ghidra::TypePartialUnion::encode(), ghidra::TypePointerRel::encode(), ghidra::JumpTable::encode(), ghidra::TypeCode::encode(), ghidra::TypeSpacebase::encode(), ghidra::TypeFactory::encode(), ghidra::ScopeInternal::encode(), ghidra::Database::encode(), ghidra::ProtoStoreInternal::encode(), ghidra::FuncProto::encode(), ghidra::BlockGraph::encodeBody(), ghidra::BlockGoto::encodeBody(), ghidra::BlockMultiGoto::encodeBody(), ghidra::BlockIf::encodeBody(), ghidra::ContextInternal::encodeContext(), ghidra::TypeFactory::encodeCoreTypes(), ghidra::FuncProto::encodeEffect(), ghidra::Funcdata::encodeHigh(), ghidra::Funcdata::encodeJumpTable(), ghidra::FuncProto::encodeLikelyTrash(), ghidra::Datatype::encodeRef(), ghidra::ContextDatabase::encodeTracked(), ghidra::Funcdata::encodeTree(), and ghidra::Datatype::encodeTypedef().
|
pure virtual |
Begin a new element in the encoding.
The element will have the given ElementId annotation and becomes the current element.
elemId | is the given ElementId annotation |
Implemented in ghidra::PackedEncode, and ghidra::XmlEncode.
Referenced by ghidra::InjectContextGhidra::encode(), ghidra::LoadImageXml::encode(), ghidra::XmlArchitecture::encode(), ghidra::RawBinaryArchitecture::encode(), ghidra::BfdArchitecture::encode(), ghidra::BlockEdge::encode(), ghidra::LoadTable::encode(), ghidra::StringManager::encode(), ghidra::Comment::encode(), ghidra::TrackedContext::encode(), ghidra::Override::encode(), ghidra::CPoolRecord::encode(), ghidra::Address::encode(), ghidra::SymbolEntry::encode(), ghidra::SeqNum::encode(), ghidra::CommentDatabaseInternal::encode(), ghidra::ConstantPoolInternal::CheapSorter::encode(), ghidra::FlowBlock::encode(), ghidra::Funcdata::encode(), ghidra::ConstantPoolInternal::encode(), ghidra::Range::encode(), ghidra::Datatype::encode(), ghidra::HighVariable::encode(), ghidra::ScopeLocal::encode(), ghidra::PcodeOp::encode(), ghidra::TypeField::encode(), ghidra::Architecture::encode(), ghidra::RangeList::encode(), ghidra::Symbol::encode(), ghidra::FunctionSymbol::encode(), ghidra::TypeChar::encode(), ghidra::ContextInternal::encode(), ghidra::EquateSymbol::encode(), ghidra::TypeUnicode::encode(), ghidra::UnionFacetSymbol::encode(), ghidra::LabSymbol::encode(), ghidra::TypeVoid::encode(), ghidra::Varnode::encode(), ghidra::ExternRefSymbol::encode(), ghidra::TypePointer::encode(), ghidra::TypeArray::encode(), ghidra::TypeEnum::encode(), ghidra::TypeStruct::encode(), ghidra::JumpBasicOverride::encode(), ghidra::TypeUnion::encode(), ghidra::TypePartialUnion::encode(), ghidra::TypePointerRel::encode(), ghidra::JumpTable::encode(), ghidra::TypeCode::encode(), ghidra::TypeSpacebase::encode(), ghidra::TypeFactory::encode(), ghidra::ScopeInternal::encode(), ghidra::Database::encode(), ghidra::ProtoStoreInternal::encode(), ghidra::FuncProto::encode(), ghidra::BlockGraph::encodeBody(), ghidra::BlockGoto::encodeBody(), ghidra::BlockMultiGoto::encodeBody(), ghidra::BlockIf::encodeBody(), ghidra::ContextInternal::encodeContext(), ghidra::TypeFactory::encodeCoreTypes(), ghidra::FuncProto::encodeEffect(), ghidra::Funcdata::encodeHigh(), ghidra::Funcdata::encodeJumpTable(), ghidra::FuncProto::encodeLikelyTrash(), ghidra::Datatype::encodeRef(), ghidra::ContextDatabase::encodeTracked(), ghidra::Funcdata::encodeTree(), and ghidra::Datatype::encodeTypedef().
|
pure virtual |
Write an annotated boolean value into the encoding.
The boolean data is associated with the given AttributeId annotation and the current open element.
attribId | is the given AttributeId annotation |
val | is boolean value to encode |
Implemented in ghidra::PackedEncode, and ghidra::XmlEncode.
Referenced by ghidra::LoadImageXml::encode(), ghidra::StringManager::encode(), ghidra::CPoolRecord::encode(), ghidra::Funcdata::encode(), ghidra::HighVariable::encode(), ghidra::ScopeLocal::encode(), ghidra::Architecture::encode(), ghidra::TypeChar::encode(), ghidra::TypeUnicode::encode(), ghidra::Varnode::encode(), ghidra::TypeFactory::encode(), ghidra::Database::encode(), ghidra::ProtoStoreInternal::encode(), ghidra::FuncProto::encode(), ghidra::Datatype::encodeBasic(), and ghidra::Symbol::encodeHeader().
|
pure virtual |
Write an annotated signed integer value into the encoding.
The integer is associated with the given AttributeId annotation and the current open element.
attribId | is the given AttributeId annotation |
val | is the signed integer value to encode |
Implemented in ghidra::PackedEncode, and ghidra::XmlEncode.
Referenced by ghidra::BlockEdge::encode(), ghidra::LoadTable::encode(), ghidra::Override::encode(), ghidra::CPoolRecord::encode(), ghidra::Funcdata::encode(), ghidra::HighVariable::encode(), ghidra::PcodeOp::encode(), ghidra::TypeField::encode(), ghidra::UnionFacetSymbol::encode(), ghidra::Varnode::encode(), ghidra::TypeArray::encode(), ghidra::TypePartialUnion::encode(), ghidra::TypePointerRel::encode(), ghidra::TypeFactory::encode(), ghidra::FuncProto::encode(), ghidra::AddrSpace::encodeAttributes(), ghidra::FspecSpace::encodeAttributes(), ghidra::Datatype::encodeBasic(), ghidra::BlockGraph::encodeBody(), ghidra::BlockGoto::encodeBody(), ghidra::BlockMultiGoto::encodeBody(), ghidra::BlockIf::encodeBody(), ghidra::FlowBlock::encodeHeader(), ghidra::Symbol::encodeHeader(), ghidra::BlockCopy::encodeHeader(), ghidra::Datatype::encodeRef(), and ghidra::Funcdata::encodeTree().
|
pure virtual |
Write an address space reference into the encoding.
The address space is associated with the given AttributeId annotation and the current open element.
attribId | is the given AttributeId annotation |
spc | is the address space to encode |
Implemented in ghidra::PackedEncode, and ghidra::XmlEncode.
Referenced by ghidra::Override::encode(), ghidra::Range::encode(), ghidra::ScopeLocal::encode(), ghidra::PcodeOp::encode(), ghidra::TypePointer::encode(), ghidra::TypeSpacebase::encode(), ghidra::AddrSpace::encodeAttributes(), ghidra::JoinSpace::encodeAttributes(), and ghidra::FspecSpace::encodeAttributes().
|
pure virtual |
Write an annotated string into the encoding.
The string is associated with the given AttributeId annotation and the current open element.
attribId | is the given AttributeId annotation |
val | is the string to encode |
Implemented in ghidra::PackedEncode, and ghidra::XmlEncode.
Referenced by ghidra::LoadImageXml::encode(), ghidra::StringManager::encode(), ghidra::Comment::encode(), ghidra::Override::encode(), ghidra::CPoolRecord::encode(), ghidra::Funcdata::encode(), ghidra::HighVariable::encode(), ghidra::TypeField::encode(), ghidra::FunctionSymbol::encode(), ghidra::ExternRefSymbol::encode(), ghidra::TypeEnum::encode(), ghidra::ScopeInternal::encode(), ghidra::ProtoStoreInternal::encode(), ghidra::FuncProto::encode(), ghidra::IopSpace::encodeAttributes(), ghidra::FspecSpace::encodeAttributes(), ghidra::Datatype::encodeBasic(), ghidra::BlockGraph::encodeBody(), ghidra::ContextInternal::encodeContext(), ghidra::SleighArchitecture::encodeHeader(), ghidra::Symbol::encodeHeader(), ghidra::BlockCondition::encodeHeader(), ghidra::Datatype::encodeRef(), and ghidra::Datatype::encodeTypedef().
|
pure virtual |
Write an annotated string, using an indexed attribute, into the encoding.
Multiple attributes with a shared name can be written to the same element by calling this method multiple times with a different index value. The encoding will use attribute ids up to the base id plus the maximum index passed in. Implementors must be careful to not use other attributes with ids bigger than the base id within the element taking the indexed attribute.
attribId | is the shared AttributeId |
index | is the unique index to associated with the string |
val | is the string to encode |
Implemented in ghidra::PackedEncode, and ghidra::XmlEncode.
Referenced by ghidra::JoinSpace::encodeAttributes().
|
pure virtual |
Write an annotated unsigned integer value into the encoding.
The integer is associated with the given AttributeId annotation and the current open element.
attribId | is the given AttributeId annotation |
val | is the unsigned integer value to encode |
Implemented in ghidra::PackedEncode, and ghidra::XmlEncode.
Referenced by ghidra::RawBinaryArchitecture::encode(), ghidra::XmlArchitecture::encode(), ghidra::BfdArchitecture::encode(), ghidra::TrackedContext::encode(), ghidra::CPoolRecord::encode(), ghidra::SymbolEntry::encode(), ghidra::SeqNum::encode(), ghidra::ConstantPoolInternal::CheapSorter::encode(), ghidra::Funcdata::encode(), ghidra::Range::encode(), ghidra::HighVariable::encode(), ghidra::PcodeOp::encode(), ghidra::FunctionSymbol::encode(), ghidra::EquateSymbol::encode(), ghidra::Varnode::encode(), ghidra::TypePointer::encode(), ghidra::TypeEnum::encode(), ghidra::JumpBasicOverride::encode(), ghidra::TypePointerRel::encode(), ghidra::JumpTable::encode(), ghidra::ScopeInternal::encode(), ghidra::Database::encode(), ghidra::AddrSpace::encodeAttributes(), ghidra::JoinSpace::encodeAttributes(), ghidra::FspecSpace::encodeAttributes(), ghidra::Datatype::encodeBasic(), ghidra::BlockGoto::encodeBody(), ghidra::BlockIf::encodeBody(), ghidra::ContextInternal::encodeContext(), ghidra::Symbol::encodeHeader(), ghidra::Datatype::encodeRef(), and ghidra::Datatype::encodeTypedef().