EpcTools
An event based multi-threaded C++ development framework.
Public Types | Public Member Functions | Static Public Attributes | Friends | List of all members
EOctetString Class Reference

Represents an OctetString as defined in RFC 6733. More...

#include <eostring.h>

Inheritance diagram for EOctetString:
ETbcdString

Public Types

typedef size_t size_type
 

Public Member Functions

 EOctetString ()
 Default constructor. More...
 
 EOctetString (size_type n)
 Class constructor. More...
 
 EOctetString (cpStr s)
 Class constructor. More...
 
 EOctetString (cpUChar data, size_type n)
 Class constructor. More...
 
 EOctetString (const EOctetString &ostr)
 Copy constructor. More...
 
 EOctetString (const EOctetString &ostr, size_type pos, size_type len=npos)
 Class constructor. Initializes this EOctetString from a subset of another EOctetString object. More...
 
 ~EOctetString ()
 Class destructor. More...
 
EOctetStringoperator= (const EOctetString &ostr)
 Assignment operator. More...
 
EOctetStringoperator= (cpStr s)
 Assignment operator. More...
 
EOctetStringoperator= (Char c)
 Assignment operator. More...
 
EOctetStringoperator= (UChar c)
 Assignment operator. More...
 
EOctetStringoperator= (EOctetString &&ostr)
 Assignment operator. Performs a move assignment. More...
 
EOctetStringoperator+= (const EOctetString &ostr)
 Append operator. More...
 
EOctetStringoperator+= (cpStr s)
 Append operator. More...
 
EOctetStringoperator+= (Char c)
 Append operator. More...
 
EOctetStringoperator+= (UChar c)
 Append operator. More...
 
bool operator== (const EOctetString &ostr) const
 Equality operator. More...
 
bool operator!= (const EOctetString &ostr) const
 Not equal operator. More...
 
bool operator< (const EOctetString &ostr) const
 Less than operator. More...
 
bool operator> (const EOctetString &ostr) const
 Greater than operator. More...
 
bool operator<= (const EOctetString &ostr) const
 Less than or equal to operator. More...
 
bool operator>= (const EOctetString &ostr) const
 Greater than or equal to operator. More...
 
bool operator== (cpStr str) const
 Equality operator. More...
 
bool operator!= (cpStr str) const
 Not equal operator. More...
 
bool operator< (cpStr str) const
 Less than operator. More...
 
bool operator> (cpStr str) const
 Greater than operator. More...
 
bool operator<= (cpStr str) const
 Less than or equal to operator. More...
 
bool operator>= (cpStr str) const
 Greater than or equal to operator. More...
 
EOctetStringappend (const EOctetString &ostr)
 Appends to this object. More...
 
EOctetStringappend (const EOctetString &ostr, size_type subpos, size_type sublen)
 Appends to this object. More...
 
EOctetStringappend (cpStr s)
 Appends to this object. More...
 
EOctetStringappend (cpStr s, size_type n)
 Appends to this object. More...
 
EOctetStringappend (cUChar c)
 Appends to this object. More...
 
EOctetStringappend (cpUChar data, size_type n)
 Appends to this object. More...
 
EOctetStringappend (size_type n, UChar c)
 Appends to this object. More...
 
EOctetStringassign (const EOctetString &ostr)
 Assigns the specified value to this object. More...
 
EOctetStringassign (const EOctetString &ostr, size_type subpos, size_type sublen)
 Assigns the specified value to this object. More...
 
EOctetStringassign (cpStr s)
 Assigns the specified value to this object. More...
 
EOctetStringassign (cpChar s, size_type n)
 Assigns the specified value to this object. More...
 
EOctetStringassign (cpUChar data, size_type n)
 Assigns the specified value to this object. More...
 
EOctetStringassign (size_type n, UChar c)
 Assigns the specified value to this object. More...
 
EOctetStringassign (EOctetString &&ostr)
 Assign the specified value to this object using move semantics. More...
 
UChar & at (size_type pos)
 Returns a reference to the data at the specified offset. More...
 
cUChar & at (size_type pos) const
 Returns a constant reference to the data at the specified offset. More...
 
UChar & back ()
 Returns a reference to the element at the end of the buffer. More...
 
cUChar & back () const
 Returns a constant reference to the element at the end of the buffer. More...
 
size_type capacity () const
 Returns the size of the currently allocated internal buffer. More...
 
Void clear ()
 Sets the internal buffer to all NULL's and sets the length to zero. More...
 
Int compare (const EOctetString &ostr) const
 Compares two EOctetString objects. More...
 
Int compare (size_type pos, size_type len, const EOctetString &ostr) const
 Compares a subset of the supplied EOctetString to this object. More...
 
Int compare (size_type pos, size_type len, const EOctetString &ostr, size_type subpos, size_type sublen) const
 Compares a subset of the supplied EOctetString to this object. More...
 
Int compare (cpStr s) const
 Compares the supplied NULL terminated string to this object. More...
 
Int compare (cpUChar data, size_type n) const
 Compares the supplied buffer to this object. More...
 
Int compare (size_type pos, size_type len, cpStr s) const
 Compares a NULL terminated string to this object starting at the supplied offset. More...
 
Int compare (size_type pos, size_type len, cpStr s, size_type n) const
 Compares a NULL terminated string to this object starting at the supplied offset. More...
 
Int compare (size_type pos, size_type len, cpUChar data, size_type n) const
 Compares buffer to this object starting at the supplied offset. More...
 
size_type copy (pUChar dst, size_type len, size_type pos=0) const
 Copies data from this object to the supplied buffer. More...
 
cpUChar data () const
 Returns a pointer to the internal data buffer. More...
 
Bool empty () const
 Returns whether this object is empty. More...
 
EOctetStringerase (size_type pos=0, size_type len=npos)
 Erases the specified number of bytes. Supports erasing bytes from the middle of the octet string. More...
 
Void pop_back ()
 Removes the last byte. More...
 
Void reserve (size_type n=0)
 Sets the internal buffer size to the specified value and reallocates the buffer if necessary. More...
 
void shrink_to_fit ()
 reduces the capacity of the buffer to match it's current length. More...
 
UChar & operator[] (size_type pos)
 Array index operator. Returns a reference to the specified array member. More...
 
cUChar & operator[] (size_type pos) const
 
size_type length () const
 Returns the length of the assigned value of this object. More...
 
size_type size () const
 
Void push_back (Char c)
 Appends the specified value to the end of the octet string. More...
 
Void push_back (UChar c)
 
Void resize (size_type n, Char c)
 Resizes the buffer to the specified and fills the "new" space with the specified value. More...
 
Void resize (size_type n, UChar c=0)
 

Static Public Attributes

static const size_type npos { std::string::npos }
 

Friends

std::ostream & operator<< (std::ostream &output, const EOctetString &ostr)
 Insertion oeprator for serialization. More...
 

Detailed Description

Represents an OctetString as defined in RFC 6733.

Member Typedef Documentation

typedef size_t EOctetString::size_type

Constructor & Destructor Documentation

EOctetString::EOctetString ( )
inline

Default constructor.

EOctetString::EOctetString ( size_type  n)
inline

Class constructor.

Parameters
ninitial internal buffer size.
EOctetString::EOctetString ( cpStr  s)
inline

Class constructor.

Parameters
sstring used to initialize this EOctetString object.
EOctetString::EOctetString ( cpUChar  data,
size_type  n 
)
inline

Class constructor.

Parameters
datapointer to buffer used to initialize this EOctetString object.
nlength of the buffer.
EOctetString::EOctetString ( const EOctetString ostr)
inline

Copy constructor.

Parameters
ostrEOctetString object to copy.
EOctetString::EOctetString ( const EOctetString ostr,
size_type  pos,
size_type  len = npos 
)
inline

Class constructor. Initializes this EOctetString from a subset of another EOctetString object.

Parameters
ostrEOctetString object to copy from.
posstarting position of data to copy.
lenlength of data to copy. A value of "npos" causes data to be from the starting position to the end of the EOctetString.
EOctetString::~EOctetString ( )
inline

Class destructor.

Member Function Documentation

EOctetString& EOctetString::append ( const EOctetString ostr)
inline

Appends to this object.

Parameters
ostra reference to the EOctetString object copy.
EOctetString& EOctetString::append ( const EOctetString ostr,
size_type  subpos,
size_type  sublen 
)
inline

Appends to this object.

Parameters
ostra reference to the EOctetString object to copy from.
subposthe position to start copying from.
sublenthe number of bytes to copy.
EOctetString& EOctetString::append ( cpStr  s)
inline

Appends to this object.

Parameters
sthe NULL terminated string to append.
EOctetString& EOctetString::append ( cpStr  s,
size_type  n 
)
inline

Appends to this object.

Parameters
sthe NULL terminated string to append.
nthe number of bytes to copy from the string.
EOctetString& EOctetString::append ( cUChar  c)
inline

Appends to this object.

Parameters
cthe unsigned character to append.
EOctetString& EOctetString::append ( cpUChar  data,
size_type  n 
)
inline

Appends to this object.

Parameters
dataa pointer to where to start appending data from.
nthe number of bytes to append.
EOctetString& EOctetString::append ( size_type  n,
UChar  c 
)
inline

Appends to this object.

Parameters
nthe number of times to append the specified value.
cthe value to repeat.
EOctetString& EOctetString::assign ( const EOctetString ostr)
inline

Assigns the specified value to this object.

Parameters
ostra reference to the EOctetString to assign to this object.
EOctetString& EOctetString::assign ( const EOctetString ostr,
size_type  subpos,
size_type  sublen 
)
inline

Assigns the specified value to this object.

Parameters
ostra reference to the EOctetString to assign from.
subposthe position in the EOctetString to start assigning from.
sublenthe number of bytes to assign.
EOctetString& EOctetString::assign ( cpStr  s)
inline

Assigns the specified value to this object.

Parameters
sa pointer to a NULL terminated string to assign to this object.
EOctetString& EOctetString::assign ( cpChar  s,
size_type  n 
)
inline

Assigns the specified value to this object.

Parameters
sa pointer to the character buffer to assign to this object.
nthe number of bytes to assign.
EOctetString& EOctetString::assign ( cpUChar  data,
size_type  n 
)
inline

Assigns the specified value to this object.

Parameters
datapointer to the unsigned character buffer to assign to this object.
nteh number of bytes to assign.
EOctetString& EOctetString::assign ( size_type  n,
UChar  c 
)
inline

Assigns the specified value to this object.

Parameters
nthe number of times to repeat the specified value.
cthe value to repeat.
EOctetString& EOctetString::assign ( EOctetString &&  ostr)
inline

Assign the specified value to this object using move semantics.

Parameters
ostrthe EOctetString object to move to this object.
UChar& EOctetString::at ( size_type  pos)
inline

Returns a reference to the data at the specified offset.

Parameters
posthe offset of the data to return.
cUChar& EOctetString::at ( size_type  pos) const
inline

Returns a constant reference to the data at the specified offset.

Parameters
posthe offset of the data to return.
UChar& EOctetString::back ( )
inline

Returns a reference to the element at the end of the buffer.

cUChar& EOctetString::back ( ) const
inline

Returns a constant reference to the element at the end of the buffer.

size_type EOctetString::capacity ( ) const
inline

Returns the size of the currently allocated internal buffer.

Void EOctetString::clear ( )
inline

Sets the internal buffer to all NULL's and sets the length to zero.

Int EOctetString::compare ( const EOctetString ostr) const
inline

Compares two EOctetString objects.

Parameters
ostrthe EOctetString to compare this object to.
Returns
an integral value indicating the relation ship between the octet strings. 0 they are equal, <0 either the value of the first byte that does not match is lower in the compared string or all compared bytes match but the compared octet string is shorter, >0 either the value of the first byte that does not match is greater in the compared object or all compared bytes match but the compared string is longer.
Int EOctetString::compare ( size_type  pos,
size_type  len,
const EOctetString ostr 
) const
inline

Compares a subset of the supplied EOctetString to this object.

Parameters
posthe offset in this object to start comparing.
lenthe number of bytes to compare.
ostrthe EOctetString to compare this object to.
Returns
an integral value indicating the relation ship between the octet strings. 0 they are equal, <0 either the value of the first byte that does not match is lower in the compared string or all compared bytes match but the compared octet string is shorter, >0 either the value of the first byte that does not match is greater in the compared object or all compared bytes match but the compared string is longer.
Int EOctetString::compare ( size_type  pos,
size_type  len,
const EOctetString ostr,
size_type  subpos,
size_type  sublen 
) const
inline

Compares a subset of the supplied EOctetString to this object.

Parameters
posthe offset in this object to start comparing.
lenthe number of bytes to compare.
ostrthe EOctetString to compare this object to.
subposthe offset in the supplied object to start comparing.
sublenthe number of bytes in the supplied object to compare.
Returns
an integral value indicating the relation ship between the octet strings. 0 they are equal, <0 either the value of the first byte that does not match is lower in the compared string or all compared bytes match but the compared octet string is shorter, >0 either the value of the first byte that does not match is greater in the compared object or all compared bytes match but the compared string is longer.
Int EOctetString::compare ( cpStr  s) const
inline

Compares the supplied NULL terminated string to this object.

Parameters
sa pointer to the NULL terminated to string to compare.
Returns
an integral value indicating the relation ship between the octet strings. 0 they are equal, <0 either the value of the first byte that does not match is lower in the compared string or all compared bytes match but the compared octet string is shorter, >0 either the value of the first byte that does not match is greater in the compared object or all compared bytes match but the compared string is longer.
Int EOctetString::compare ( cpUChar  data,
size_type  n 
) const
inline

Compares the supplied buffer to this object.

Parameters
dataa pointer to the buffer to compare.
nthe number of bytes to compare.
Returns
an integral value indicating the relation ship between the octet strings. 0 they are equal, <0 either the value of the first byte that does not match is lower in the compared string or all compared bytes match but the compared octet string is shorter, >0 either the value of the first byte that does not match is greater in the compared object or all compared bytes match but the compared string is longer.
Int EOctetString::compare ( size_type  pos,
size_type  len,
cpStr  s 
) const
inline

Compares a NULL terminated string to this object starting at the supplied offset.

Parameters
posthe offset in this object to start the comparison.
lenthe number of bytes to compare.
sa pointer to the NULL terminated string to compare against.
Returns
an integral value indicating the relation ship between the octet strings. 0 they are equal, <0 either the value of the first byte that does not match is lower in the compared string or all compared bytes match but the compared octet string is shorter, >0 either the value of the first byte that does not match is greater in the compared object or all compared bytes match but the compared string is longer.
Int EOctetString::compare ( size_type  pos,
size_type  len,
cpStr  s,
size_type  n 
) const
inline

Compares a NULL terminated string to this object starting at the supplied offset.

Parameters
posthe offset in this object to start the comparison.
lenthe number of bytes to compare.
sa pointer to the NULL terminated string to compare against.
nthe maximum number of bytes in the supplied NULL terminated string to compare.
Returns
an integral value indicating the relation ship between the octet strings. 0 they are equal, <0 either the value of the first byte that does not match is lower in the compared string or all compared bytes match but the compared octet string is shorter, >0 either the value of the first byte that does not match is greater in the compared object or all compared bytes match but the compared string is longer.
Int EOctetString::compare ( size_type  pos,
size_type  len,
cpUChar  data,
size_type  n 
) const
inline

Compares buffer to this object starting at the supplied offset.

Parameters
posthe offset in this object to start the comparison.
lenthe number of bytes to compare.
dataa pointer to the buffer to compare against.
nthe maximum number of bytes in the supplied buffer to compare.
Returns
an integral value indicating the relation ship between the octet strings. 0 they are equal, <0 either the value of the first byte that does not match is lower in the compared string or all compared bytes match but the compared octet string is shorter, >0 either the value of the first byte that does not match is greater in the compared object or all compared bytes match but the compared string is longer.
size_type EOctetString::copy ( pUChar  dst,
size_type  len,
size_type  pos = 0 
) const
inline

Copies data from this object to the supplied buffer.

Parameters
dsta pointer to the destination buffer.
lenthe maximum number of bytes to copy.
posthe array offset in the internal buffer to start copying from.
cpUChar EOctetString::data ( ) const
inline

Returns a pointer to the internal data buffer.

Returns
a pointer to the internal data buffer.
Bool EOctetString::empty ( ) const
inline

Returns whether this object is empty.

Returns
True if length is zero, False otherwise.
EOctetString& EOctetString::erase ( size_type  pos = 0,
size_type  len = npos 
)
inline

Erases the specified number of bytes. Supports erasing bytes from the middle of the octet string.

Parameters
posthe offset where to start erasing.
lenthe number of bytes to erase.
Returns
a referenc to this object.
size_type EOctetString::length ( ) const
inline

Returns the length of the assigned value of this object.

Returns
the length of the assigned value of this object.
bool EOctetString::operator!= ( const EOctetString ostr) const
inline

Not equal operator.

Parameters
ostrthe EOctetString object to compare to.
bool EOctetString::operator!= ( cpStr  str) const
inline

Not equal operator.

Parameters
strthe NULL terminated string to compare against.
EOctetString& EOctetString::operator+= ( const EOctetString ostr)
inline

Append operator.

Parameters
ostra reference to the EOctetString to append to this object.
EOctetString& EOctetString::operator+= ( cpStr  s)
inline

Append operator.

Parameters
sthe NULL terminated string to append to this object.
EOctetString& EOctetString::operator+= ( Char  c)
inline

Append operator.

Parameters
cthe character to append to this object.
EOctetString& EOctetString::operator+= ( UChar  c)
inline

Append operator.

Parameters
cthe unsigned character to append to this object.
bool EOctetString::operator< ( const EOctetString ostr) const
inline

Less than operator.

Parameters
ostrthe EOctetString object to compare to.
bool EOctetString::operator< ( cpStr  str) const
inline

Less than operator.

Parameters
strthe NULL terminated string to compare against.
bool EOctetString::operator<= ( const EOctetString ostr) const
inline

Less than or equal to operator.

Parameters
ostrthe EOctetString object to compare to.
bool EOctetString::operator<= ( cpStr  str) const
inline

Less than or equal to operator.

Parameters
strthe NULL terminated string to compare against.
EOctetString& EOctetString::operator= ( const EOctetString ostr)
inline

Assignment operator.

Parameters
ostra reference to the EOctetString object to copy.
EOctetString& EOctetString::operator= ( cpStr  s)
inline

Assignment operator.

Parameters
scopies the NULL terminated string.
EOctetString& EOctetString::operator= ( Char  c)
inline

Assignment operator.

Parameters
ca single character to assign.
EOctetString& EOctetString::operator= ( UChar  c)
inline

Assignment operator.

Parameters
ca single unsigned character to assign.
EOctetString& EOctetString::operator= ( EOctetString &&  ostr)
inline

Assignment operator. Performs a move assignment.

Parameters
ostrthe EOctetString to assign to this object.
bool EOctetString::operator== ( const EOctetString ostr) const
inline

Equality operator.

Parameters
ostrthe EOctetString object to compare to.
bool EOctetString::operator== ( cpStr  str) const
inline

Equality operator.

Parameters
strthe NULL terminated string to compare against.
bool EOctetString::operator> ( const EOctetString ostr) const
inline

Greater than operator.

Parameters
ostrthe EOctetString object to compare to.
bool EOctetString::operator> ( cpStr  str) const
inline

Greater than operator.

Parameters
strthe NULL terminated string to compare against.
bool EOctetString::operator>= ( const EOctetString ostr) const
inline

Greater than or equal to operator.

Parameters
ostrthe EOctetString object to compare to.
bool EOctetString::operator>= ( cpStr  str) const
inline

Greater than or equal to operator.

Parameters
strthe NULL terminated string to compare against.
UChar& EOctetString::operator[] ( size_type  pos)
inline

Array index operator. Returns a reference to the specified array member.

Parameters
posthe array index.
cUChar& EOctetString::operator[] ( size_type  pos) const
inline
Void EOctetString::pop_back ( )
inline

Removes the last byte.

Void EOctetString::push_back ( Char  c)
inline

Appends the specified value to the end of the octet string.

Parameters
cthe value to append.
Void EOctetString::push_back ( UChar  c)
inline
Void EOctetString::reserve ( size_type  n = 0)
inline

Sets the internal buffer size to the specified value and reallocates the buffer if necessary.

Parameters
nthe number of bytes to reserve.
Void EOctetString::resize ( size_type  n,
Char  c 
)
inline

Resizes the buffer to the specified and fills the "new" space with the specified value.

Parameters
nthe new buffer size.
cthe fill value.
Void EOctetString::resize ( size_type  n,
UChar  c = 0 
)
inline
void EOctetString::shrink_to_fit ( )
inline

reduces the capacity of the buffer to match it's current length.

size_type EOctetString::size ( ) const
inline

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const EOctetString ostr 
)
friend

Insertion oeprator for serialization.

Member Data Documentation

const size_type EOctetString::npos { std::string::npos }
static

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