decompiler 1.0.0
Public Member Functions | List of all members
Encoder Class Referenceabstract

A class for writing structured data to a stream. More...

#include <marshal.hh>

Inheritance diagram for Encoder:
PackedEncode XmlEncode

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 writeSpace (const AttributeId &attribId, const AddrSpace *spc)=0
 Write an address space reference into the encoding. More...
 

Detailed Description

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.

Member Function Documentation

◆ closeElement()

virtual void Encoder::closeElement ( const ElementId elemId)
pure virtual

End the current element in the encoding.

The current element must match the given annotation or an exception is thrown.

Parameters
elemIdis the given (expected) annotation for the current element

Implemented in XmlEncode, and PackedEncode.

Referenced by EmitMarkup::closeParen(), Address::encode(), SeqNum::encode(), Range::encode(), RangeList::encode(), Architecture::encode(), BfdArchitecture::encode(), BlockEdge::encode(), FlowBlock::encode(), Comment::encode(), CommentDatabaseInternal::encode(), CPoolRecord::encode(), ConstantPoolInternal::CheapSorter::encode(), ConstantPoolInternal::encode(), SymbolEntry::encode(), Symbol::encode(), FunctionSymbol::encode(), EquateSymbol::encode(), UnionFacetSymbol::encode(), LabSymbol::encode(), ExternRefSymbol::encode(), ScopeInternal::encode(), Database::encode(), ProtoStoreInternal::encode(), FuncProto::encode(), TrackedContext::encode(), ContextInternal::encode(), InjectContextGhidra::encode(), LoadTable::encode(), JumpBasicOverride::encode(), JumpTable::encode(), LoadImageXml::encode(), PcodeOp::encode(), RawBinaryArchitecture::encode(), StringManager::encode(), Datatype::encode(), TypeField::encode(), TypeChar::encode(), TypeUnicode::encode(), TypeVoid::encode(), TypePointer::encode(), TypeArray::encode(), TypeEnum::encode(), TypeStruct::encode(), TypeUnion::encode(), TypePartialUnion::encode(), TypePointerRel::encode(), TypeCode::encode(), TypeSpacebase::encode(), TypeFactory::encode(), HighVariable::encode(), ScopeLocal::encode(), Varnode::encode(), XmlArchitecture::encode(), Override::encode(), Funcdata::encode(), BlockGraph::encodeBody(), BlockGoto::encodeBody(), BlockMultiGoto::encodeBody(), BlockIf::encodeBody(), ContextInternal::encodeContext(), TypeFactory::encodeCoreTypes(), FuncProto::encodeEffect(), Funcdata::encodeHigh(), Funcdata::encodeJumpTable(), FuncProto::encodeLikelyTrash(), Datatype::encodeRef(), ContextDatabase::encodeTracked(), Funcdata::encodeTree(), Datatype::encodeTypedef(), EmitMarkup::endBlock(), EmitMarkup::endDocument(), EmitMarkup::endFuncProto(), EmitMarkup::endFunction(), EmitMarkup::endReturnType(), EmitMarkup::endStatement(), EmitMarkup::endVarDecl(), EmitMarkup::openParen(), EmitMarkup::print(), EmitMarkup::tagComment(), EmitMarkup::tagField(), EmitMarkup::tagFuncName(), EmitMarkup::tagLabel(), EmitMarkup::tagLine(), EmitMarkup::tagOp(), EmitMarkup::tagType(), and EmitMarkup::tagVariable().

◆ openElement()

virtual void Encoder::openElement ( const ElementId elemId)
pure virtual

Begin a new element in the encoding.

The element will have the given ElementId annotation and becomes the current element.

Parameters
elemIdis the given ElementId annotation

Implemented in XmlEncode, and PackedEncode.

Referenced by EmitMarkup::beginBlock(), EmitMarkup::beginDocument(), EmitMarkup::beginFuncProto(), EmitMarkup::beginFunction(), EmitMarkup::beginReturnType(), EmitMarkup::beginStatement(), EmitMarkup::beginVarDecl(), EmitMarkup::closeParen(), Address::encode(), SeqNum::encode(), Range::encode(), RangeList::encode(), Architecture::encode(), BfdArchitecture::encode(), BlockEdge::encode(), FlowBlock::encode(), Comment::encode(), CommentDatabaseInternal::encode(), CPoolRecord::encode(), ConstantPoolInternal::CheapSorter::encode(), ConstantPoolInternal::encode(), SymbolEntry::encode(), Symbol::encode(), FunctionSymbol::encode(), EquateSymbol::encode(), UnionFacetSymbol::encode(), LabSymbol::encode(), ExternRefSymbol::encode(), ScopeInternal::encode(), Database::encode(), ProtoStoreInternal::encode(), FuncProto::encode(), TrackedContext::encode(), ContextInternal::encode(), InjectContextGhidra::encode(), LoadTable::encode(), JumpBasicOverride::encode(), JumpTable::encode(), LoadImageXml::encode(), PcodeOp::encode(), RawBinaryArchitecture::encode(), StringManager::encode(), Datatype::encode(), TypeField::encode(), TypeChar::encode(), TypeUnicode::encode(), TypeVoid::encode(), TypePointer::encode(), TypeArray::encode(), TypeEnum::encode(), TypeStruct::encode(), TypeUnion::encode(), TypePartialUnion::encode(), TypePointerRel::encode(), TypeCode::encode(), TypeSpacebase::encode(), TypeFactory::encode(), HighVariable::encode(), ScopeLocal::encode(), Varnode::encode(), XmlArchitecture::encode(), Override::encode(), Funcdata::encode(), BlockGraph::encodeBody(), BlockGoto::encodeBody(), BlockMultiGoto::encodeBody(), BlockIf::encodeBody(), ContextInternal::encodeContext(), TypeFactory::encodeCoreTypes(), FuncProto::encodeEffect(), Funcdata::encodeHigh(), Funcdata::encodeJumpTable(), FuncProto::encodeLikelyTrash(), Datatype::encodeRef(), ContextDatabase::encodeTracked(), Funcdata::encodeTree(), Datatype::encodeTypedef(), EmitMarkup::openParen(), EmitMarkup::print(), EmitMarkup::tagComment(), EmitMarkup::tagField(), EmitMarkup::tagFuncName(), EmitMarkup::tagLabel(), EmitMarkup::tagLine(), EmitMarkup::tagOp(), EmitMarkup::tagType(), and EmitMarkup::tagVariable().

◆ writeBool()

virtual void Encoder::writeBool ( const AttributeId attribId,
bool  val 
)
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.

Parameters
attribIdis the given AttributeId annotation
valis boolean value to encode

Implemented in XmlEncode, and PackedEncode.

Referenced by Architecture::encode(), CPoolRecord::encode(), Database::encode(), ProtoStoreInternal::encode(), FuncProto::encode(), LoadImageXml::encode(), StringManager::encode(), TypeChar::encode(), TypeUnicode::encode(), TypeFactory::encode(), HighVariable::encode(), ScopeLocal::encode(), Varnode::encode(), Funcdata::encode(), Datatype::encodeBasic(), and Symbol::encodeHeader().

◆ writeSignedInteger()

virtual void Encoder::writeSignedInteger ( const AttributeId attribId,
intb  val 
)
pure virtual

◆ writeSpace()

virtual void Encoder::writeSpace ( const AttributeId attribId,
const AddrSpace spc 
)
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.

Parameters
attribIdis the given AttributeId annotation
spcis the address space to encode

Implemented in XmlEncode, and PackedEncode.

Referenced by Range::encode(), PcodeOp::encode(), TypePointer::encode(), TypeSpacebase::encode(), ScopeLocal::encode(), Override::encode(), FspecSpace::encodeAttributes(), AddrSpace::encodeAttributes(), JoinSpace::encodeAttributes(), EmitMarkup::tagComment(), and EmitMarkup::tagLabel().

◆ writeString()

virtual void Encoder::writeString ( const AttributeId attribId,
const string &  val 
)
pure virtual

◆ writeUnsignedInteger()

virtual void Encoder::writeUnsignedInteger ( const AttributeId attribId,
uintb  val 
)
pure virtual

The documentation for this class was generated from the following file: