Quark  0.1
MemoryBlock Class Reference

A class representing a block of raw memory. More...

#include <MemoryBlock.h++>

Public Member Functions

 MemoryBlock (uchar *data, uint length)
 Construct a MemoryBlock for the given raw data. More...
 
virtual ~MemoryBlock ()
 Destructor. More...
 
uchar * data () const
 Returns a pointer to the data. More...
 
void setData (uchar *data)
 Sets the pointer to the data. More...
 
uint length () const
 Returns the length of the data. More...
 
void setLength (uint length)
 Sets the length of the data. More...
 
int find (uchar *sequence, uint sequenceLength) const
 Searches for the first occurrence of a sequence of bytes in the data. More...
 
int findLast (uchar *sequence, uint sequenceLength) const
 Searches for the last occurrence of a sequence of bytes in the data. More...
 

Detailed Description

A class representing a block of raw memory.

Author
Mark Lindner

Constructor & Destructor Documentation

◆ MemoryBlock()

MemoryBlock ( uchar *  data,
uint  length 
)

Construct a MemoryBlock for the given raw data.

The class does not take ownership of the data.

Parameters
dataA pointer to the data.
lengthThe length of the data.

◆ ~MemoryBlock()

virtual ~MemoryBlock ( )
virtual

Destructor.

Member Function Documentation

◆ data()

uchar* data ( ) const
inline

Returns a pointer to the data.

◆ find()

int find ( uchar *  sequence,
uint  sequenceLength 
) const

Searches for the first occurrence of a sequence of bytes in the data.

Parameters
sequenceThe sequence to search for.
sequenceLengthThe length of the sequence.
Returns
The offset of the first occurrence of the sequence, or -1 if the sequence was not found within the block.

◆ findLast()

int findLast ( uchar *  sequence,
uint  sequenceLength 
) const

Searches for the last occurrence of a sequence of bytes in the data.

Parameters
sequenceThe sequence to search for.
sequenceLengthThe length of the sequence.
Returns
The offset of the last occurrence of the sequence, or -1 if the sequence was not found within the block.

◆ length()

uint length ( ) const
inline

Returns the length of the data.

◆ setData()

void setData ( uchar *  data)
inline

Sets the pointer to the data.

◆ setLength()

void setLength ( uint  length)
inline

Sets the length of the data.


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