ROSE  0.11.145.0
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Rose::BinaryAnalysis::Strings::LengthEncodedString Class Reference

Description

Length-prefixed string encoding scheme.

A string encoding where the octets for the characters are prefixed with an encoded length.

Definition at line 629 of file String.h.

#include <Rose/BinaryAnalysis/String.h>

Inheritance diagram for Rose::BinaryAnalysis::Strings::LengthEncodedString:
Inheritance graph
[legend]
Collaboration diagram for Rose::BinaryAnalysis::Strings::LengthEncodedString:
Collaboration graph
[legend]

Public Types

typedef Sawyer::SharedPointer< LengthEncodedStringPtr
 Shared ownership pointer to a LengthEncodedString. More...
 
- Public Types inherited from Rose::BinaryAnalysis::Strings::StringEncodingScheme
typedef Sawyer::SharedPointer< StringEncodingSchemePtr
 Shared ownership pointer to a StringEncodingScheme. More...
 

Public Member Functions

virtual StringEncodingScheme::Ptr clone () const override
 Create a new copy of this encoder. More...
 
virtual std::string name () const override
 Name of encoding.
 
virtual Octets encode (const CodePoints &) override
 Encode a string into a sequence of octets. More...
 
virtual State decode (Octet) override
 Decode one octet. More...
 
virtual void reset () override
 Reset the state machine to an initial state. More...
 
Sawyer::Optional< size_t > declaredLength () const
 Returns the declared length, if any. More...
 
LengthEncodingScheme::Ptr lengthEncodingScheme () const
 Property: Lengh encoding scheme. More...
 
void lengthEncodingScheme (const LengthEncodingScheme::Ptr &les)
 Property: Lengh encoding scheme. More...
 
- Public Member Functions inherited from Rose::BinaryAnalysis::Strings::StringEncodingScheme
State state () const
 Decoder state. More...
 
CodePoints consume ()
 Consume pending decoded code points. More...
 
const CodePointscodePoints () const
 Return pending decoded code points without consuming them. More...
 
size_t length () const
 Number of code points decoded since reset. More...
 
CharacterEncodingForm::Ptr characterEncodingForm () const
 Property: Character encoding format. More...
 
void characterEncodingForm (const CharacterEncodingForm::Ptr &cef)
 Property: Character encoding format. More...
 
CharacterEncodingScheme::Ptr characterEncodingScheme () const
 Property: Character encoding scheme. More...
 
void characterEncodingScheme (const CharacterEncodingScheme::Ptr &ces)
 Property: Character encoding scheme. More...
 
CodePointPredicate::Ptr codePointPredicate () const
 Property: Code point predicate. More...
 
void codePointPredicate (const CodePointPredicate::Ptr &cpp)
 Property: Code point predicate. More...
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor. More...
 
 SharedObject (const SharedObject &)
 Copy constructor. More...
 
virtual ~SharedObject ()
 Virtual destructor. More...
 
SharedObjectoperator= (const SharedObject &)
 Assignment. More...
 

Static Public Member Functions

static Ptr instance (const LengthEncodingScheme::Ptr &les, const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp)
 

Protected Member Functions

 LengthEncodedString (const LengthEncodingScheme::Ptr &les, const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp)
 
- Protected Member Functions inherited from Rose::BinaryAnalysis::Strings::StringEncodingScheme
 StringEncodingScheme (const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp)
 

Additional Inherited Members

- Protected Attributes inherited from Rose::BinaryAnalysis::Strings::StringEncodingScheme
State state_ = INITIAL_STATE
 
CodePoints codePoints_
 
size_t nCodePoints_ = 0
 
CharacterEncodingForm::Ptr cef_
 
CharacterEncodingScheme::Ptr ces_
 
CodePointPredicate::Ptr cpp_
 

Member Typedef Documentation

Shared ownership pointer to a LengthEncodedString.

See Shared ownership.

Definition at line 638 of file String.h.

Member Function Documentation

virtual StringEncodingScheme::Ptr Rose::BinaryAnalysis::Strings::LengthEncodedString::clone ( ) const
inlineoverridevirtual

Create a new copy of this encoder.

Implements Rose::BinaryAnalysis::Strings::StringEncodingScheme.

Definition at line 644 of file String.h.

virtual Octets Rose::BinaryAnalysis::Strings::LengthEncodedString::encode ( const CodePoints )
overridevirtual

Encode a string into a sequence of octets.

Implements Rose::BinaryAnalysis::Strings::StringEncodingScheme.

virtual State Rose::BinaryAnalysis::Strings::LengthEncodedString::decode ( Octet  )
overridevirtual

Decode one octet.

Processes a single octet and updates the decoder state machine. Returns the new state. See documentation for State for restrictions on state transitions.

Implements Rose::BinaryAnalysis::Strings::StringEncodingScheme.

virtual void Rose::BinaryAnalysis::Strings::LengthEncodedString::reset ( )
overridevirtual

Reset the state machine to an initial state.

Reimplemented from Rose::BinaryAnalysis::Strings::StringEncodingScheme.

Sawyer::Optional<size_t> Rose::BinaryAnalysis::Strings::LengthEncodedString::declaredLength ( ) const
inline

Returns the declared length, if any.

The declared length is the value of the decoded length prefix, not necessarily the number of code points that have been decoded. This can be called from any state except it will always return nothing in the INITIAL_STATE. Therefore, this method should be called prior to the consume call.

Definition at line 666 of file String.h.

LengthEncodingScheme::Ptr Rose::BinaryAnalysis::Strings::LengthEncodedString::lengthEncodingScheme ( ) const
inline

Property: Lengh encoding scheme.

The length encoding scheme is responsible for encoding the string length as a sequence of octets.

Definition at line 673 of file String.h.

void Rose::BinaryAnalysis::Strings::LengthEncodedString::lengthEncodingScheme ( const LengthEncodingScheme::Ptr les)
inline

Property: Lengh encoding scheme.

The length encoding scheme is responsible for encoding the string length as a sequence of octets.

Definition at line 674 of file String.h.


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