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

Description

Terminated string encoding scheme.

A string whose character octets are followed by octets for a special code point that marks the end of the string but is not included as part of the string's characters. An example is C-style NUL-terminated ASCII.

Definition at line 690 of file BinaryString.h.

#include <BinaryString.h>

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

Public Types

typedef Sawyer::SharedPointer< TerminatedStringPtr
 Shared ownership pointer to a TerminatedString. 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 ROSE_OVERRIDE
 Create a new copy of this encoder. More...
 
virtual std::string name () const ROSE_OVERRIDE
 Name of encoding.
 
virtual Octets encode (const CodePoints &) ROSE_OVERRIDE
 Encode a string into a sequence of octets. More...
 
virtual State decode (Octet) ROSE_OVERRIDE
 Decode one octet. More...
 
virtual void reset () ROSE_OVERRIDE
 Reset the state machine to an initial state. More...
 
Sawyer::Optional< CodePointterminated () const
 Returns the decoded termination character, if any. More...
 
const CodePointsterminators () const
 Property: string termination code points. More...
 
CodePointsterminators ()
 Property: string termination code points. 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 CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp, const CodePoints &terminators)
 
static Ptr instance (const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp, CodePoint terminator=0)
 

Protected Member Functions

 TerminatedString (const CharacterEncodingForm::Ptr &cef, const CharacterEncodingScheme::Ptr &ces, const CodePointPredicate::Ptr &cpp, const CodePoints &terminators)
 
- 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_
 
CodePoints codePoints_
 
size_t nCodePoints_
 
CharacterEncodingForm::Ptr cef_
 
CharacterEncodingScheme::Ptr ces_
 
CodePointPredicate::Ptr cpp_
 

Member Typedef Documentation

Shared ownership pointer to a TerminatedString.

See Shared ownership.

Definition at line 699 of file BinaryString.h.

Member Function Documentation

virtual StringEncodingScheme::Ptr Rose::BinaryAnalysis::Strings::TerminatedString::clone ( ) const
inlinevirtual

Create a new copy of this encoder.

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

Definition at line 709 of file BinaryString.h.

virtual Octets Rose::BinaryAnalysis::Strings::TerminatedString::encode ( const CodePoints )
virtual

Encode a string into a sequence of octets.

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

virtual State Rose::BinaryAnalysis::Strings::TerminatedString::decode ( Octet  )
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.

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

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

Reset the state machine to an initial state.

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

Sawyer::Optional<CodePoint> Rose::BinaryAnalysis::Strings::TerminatedString::terminated ( ) const
inline

Returns the decoded termination character, if any.

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 729 of file BinaryString.h.

const CodePoints& Rose::BinaryAnalysis::Strings::TerminatedString::terminators ( ) const
inline

Property: string termination code points.

A list of code points (characters) that cause a string to be terminated. When decoding a string, if a terminating code point is encountered then the string ends at the previous code point even if the terminating code point also satisfies the code point predicate.

Definition at line 738 of file BinaryString.h.

CodePoints& Rose::BinaryAnalysis::Strings::TerminatedString::terminators ( )
inline

Property: string termination code points.

A list of code points (characters) that cause a string to be terminated. When decoding a string, if a terminating code point is encountered then the string ends at the previous code point even if the terminating code point also satisfies the code point predicate.

Definition at line 739 of file BinaryString.h.


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