ROSE  0.9.9.139
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Rose::BinaryAnalysis::Strings::StringEncodingScheme Class Referenceabstract

Description

String encoding scheme.

A string encoding scheme indicates how a string (sequence of code points) is encoded as a sequence of octets and vice versa.

Definition at line 529 of file BinaryString.h.

#include <BinaryString.h>

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

Public Types

typedef Sawyer::SharedPointer< StringEncodingSchemePtr
 Shared ownership pointer to a StringEncodingScheme. More...
 

Public Member Functions

virtual std::string name () const =0
 Name of encoding.
 
virtual Ptr clone () const =0
 Create a new copy of this encoder. More...
 
virtual Octets encode (const CodePoints &)=0
 Encode a string into a sequence of octets. More...
 
State state () const
 Decoder state. More...
 
virtual State decode (Octet)=0
 Decode one octet. 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...
 
virtual void reset ()
 Reset the state machine to an initial state. 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...
 

Protected Member Functions

 StringEncodingScheme (const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp)
 

Protected Attributes

State state_
 
CodePoints codePoints_
 
size_t nCodePoints_
 
CharacterEncodingForm::Ptr cef_
 
CharacterEncodingScheme::Ptr ces_
 
CodePointPredicate::Ptr cpp_
 

Member Typedef Documentation

Shared ownership pointer to a StringEncodingScheme.

See Shared ownership.

Definition at line 549 of file BinaryString.h.

Member Function Documentation

virtual Ptr Rose::BinaryAnalysis::Strings::StringEncodingScheme::clone ( ) const
pure virtual
virtual Octets Rose::BinaryAnalysis::Strings::StringEncodingScheme::encode ( const CodePoints )
pure virtual

Encode a string into a sequence of octets.

Implemented in Rose::BinaryAnalysis::Strings::TerminatedString, and Rose::BinaryAnalysis::Strings::LengthEncodedString.

State Rose::BinaryAnalysis::Strings::StringEncodingScheme::state ( ) const
inline

Decoder state.

Definition at line 561 of file BinaryString.h.

virtual State Rose::BinaryAnalysis::Strings::StringEncodingScheme::decode ( Octet  )
pure virtual

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.

Implemented in Rose::BinaryAnalysis::Strings::TerminatedString, and Rose::BinaryAnalysis::Strings::LengthEncodedString.

CodePoints Rose::BinaryAnalysis::Strings::StringEncodingScheme::consume ( )

Consume pending decoded code points.

Returns code points that haven't been consume yet, and then removes them from the decoder. This can be called from any state because we want the caller to be able to consume code points as they're decoded, which is a little bit different than how consume methods operate in the decoders that return scalar values. A reset will discard pending code points.

const CodePoints& Rose::BinaryAnalysis::Strings::StringEncodingScheme::codePoints ( ) const
inline

Return pending decoded code points without consuming them.

Definition at line 578 of file BinaryString.h.

size_t Rose::BinaryAnalysis::Strings::StringEncodingScheme::length ( ) const
inline

Number of code points decoded since reset.

Definition at line 581 of file BinaryString.h.

virtual void Rose::BinaryAnalysis::Strings::StringEncodingScheme::reset ( )
virtual

Reset the state machine to an initial state.

Reimplemented in Rose::BinaryAnalysis::Strings::TerminatedString, and Rose::BinaryAnalysis::Strings::LengthEncodedString.

CharacterEncodingForm::Ptr Rose::BinaryAnalysis::Strings::StringEncodingScheme::characterEncodingForm ( ) const
inline

Property: Character encoding format.

The character encoding format is responsible for converting each code point to a sequence of code values. For instance, a UTF-16 encoding will convert each code point (a number between zero and about 1.2 million) into a sequence of 16-bit code values. Each code value will eventually be converted to a pair of octets by the character encoding scheme.

Definition at line 594 of file BinaryString.h.

void Rose::BinaryAnalysis::Strings::StringEncodingScheme::characterEncodingForm ( const CharacterEncodingForm::Ptr cef)
inline

Property: Character encoding format.

The character encoding format is responsible for converting each code point to a sequence of code values. For instance, a UTF-16 encoding will convert each code point (a number between zero and about 1.2 million) into a sequence of 16-bit code values. Each code value will eventually be converted to a pair of octets by the character encoding scheme.

Definition at line 595 of file BinaryString.h.

CharacterEncodingScheme::Ptr Rose::BinaryAnalysis::Strings::StringEncodingScheme::characterEncodingScheme ( ) const
inline

Property: Character encoding scheme.

The character encoding scheme is responsible for converting each code value to a sequence of one or more octets. The code value is part of a sequence of code values generated by the character encoding format for a single code point. For instance, a character encoding scheme for UTF-16 will need to know whether the octets are stored in bit- or little-endian order.

Definition at line 606 of file BinaryString.h.

void Rose::BinaryAnalysis::Strings::StringEncodingScheme::characterEncodingScheme ( const CharacterEncodingScheme::Ptr ces)
inline

Property: Character encoding scheme.

The character encoding scheme is responsible for converting each code value to a sequence of one or more octets. The code value is part of a sequence of code values generated by the character encoding format for a single code point. For instance, a character encoding scheme for UTF-16 will need to know whether the octets are stored in bit- or little-endian order.

Definition at line 607 of file BinaryString.h.

CodePointPredicate::Ptr Rose::BinaryAnalysis::Strings::StringEncodingScheme::codePointPredicate ( ) const
inline

Property: Code point predicate.

The code point predicate tests whether a specific code point is allowed as part of a string. For instance, when decoding NUL-terminated ASCII strings one might want to consider only those strings that contain printable characters and white space in order to limit the number of false positives when searching for strings in memory.

Definition at line 617 of file BinaryString.h.

void Rose::BinaryAnalysis::Strings::StringEncodingScheme::codePointPredicate ( const CodePointPredicate::Ptr cpp)
inline

Property: Code point predicate.

The code point predicate tests whether a specific code point is allowed as part of a string. For instance, when decoding NUL-terminated ASCII strings one might want to consider only those strings that contain printable characters and white space in order to limit the number of false positives when searching for strings in memory.

Definition at line 618 of file BinaryString.h.


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