LibreOffice
LibreOffice 24.2 SDK C/C++ API Reference
|
C++ class representing a SAL byte sequence. More...
#include <byteseq.h>
Public Member Functions | |
ByteSequence () | |
Default constructor: Creates an empty sequence. More... | |
ByteSequence (const ByteSequence &rSeq) | |
Copy constructor: Creates a copy of given sequence. More... | |
ByteSequence (sal_Sequence *pSequence) | |
Copy constructor Creates a copy from the C-Handle. More... | |
ByteSequence (const sal_Int8 *pElements, sal_Int32 len) | |
Constructor: Creates a copy of given data bytes. More... | |
ByteSequence (sal_Int32 len) | |
Constructor: Creates sequence of given length and initializes all bytes to 0. More... | |
ByteSequence (sal_Int32 len, enum __ByteSequence_NoDefault nodefault) | |
Constructor: Creates sequence of given length and does NOT initialize data. More... | |
ByteSequence (sal_Sequence *pSequence, enum __ByteSequence_NoAcquire noacquire) | |
Constructor: Creates a sequence from a C-Handle without acquiring the handle, thus taking over ownership. More... | |
~ByteSequence () | |
Destructor: Releases sequence handle. More... | |
ByteSequence & | operator= (const ByteSequence &rSeq) |
Assignment operator: Acquires given sequence handle and releases a previously set handle. More... | |
sal_Int32 | getLength () const |
Gets the length of sequence. More... | |
const sal_Int8 * | getConstArray () const |
Gets a pointer to byte array for READING. More... | |
sal_Int8 * | getArray () |
Gets a pointer to elements array for READING AND WRITING. More... | |
sal_Int8 & | operator[] (sal_Int32 nIndex) |
Non-const index operator: Obtains a reference to byte indexed at given position. More... | |
const sal_Int8 & | operator[] (sal_Int32 nIndex) const |
Const index operator: Obtains a reference to byte indexed at given position. More... | |
bool | operator== (const ByteSequence &rSeq) const |
Equality operator: Compares two sequences. More... | |
bool | operator!= (const ByteSequence &rSeq) const |
Unequality operator: Compares two sequences. More... | |
void | realloc (sal_Int32 nSize) |
Reallocates sequence to new length. More... | |
sal_Sequence * | getHandle () const |
Returns the UNacquired C handle of the sequence. More... | |
sal_Sequence * | get () const |
Returns the UNacquired C handle of the sequence (for compatibility reasons) More... | |
C++ class representing a SAL byte sequence.
C++ Sequences are reference counted and shared, so the sequence keeps a handle to its data. To keep value semantics, copies are only generated if the sequence is to be modified (new handle).
|
inline |
Default constructor: Creates an empty sequence.
|
inline |
Copy constructor: Creates a copy of given sequence.
rSeq | another byte sequence |
|
inline |
Copy constructor Creates a copy from the C-Handle.
pSequence | another byte sequence handle |
|
inline |
Constructor: Creates a copy of given data bytes.
pElements | an array of bytes |
len | number of bytes |
|
inline |
Constructor: Creates sequence of given length and initializes all bytes to 0.
len | initial sequence length |
|
inline |
Constructor: Creates sequence of given length and does NOT initialize data.
Use this ctor for performance optimization only.
len | initial sequence length |
nodefault | dummy parameter forcing explicit BYTESEQ_NODEFAULT |
|
inline |
Constructor: Creates a sequence from a C-Handle without acquiring the handle, thus taking over ownership.
Eitherway the handle is released by the destructor. This ctor is useful, when working with a c-interface (it safes a pair of acquire and release call and is thus a performance optimization only).
pSequence | sequence handle to be taken over |
noacquire | dummy parameter forcing explicit BYTESEQ_NOACQUIRE |
|
inline |
Destructor: Releases sequence handle.
Last handle will free memory.
|
inline |
Returns the UNacquired C handle of the sequence (for compatibility reasons)
|
inline |
Gets a pointer to elements array for READING AND WRITING.
In general if the sequence has a handle acquired by other sequences (reference count > 1), then a new sequence is created copying all bytes to keep value semantics! If the sequence has a length of 0, then the returned pointer is undefined.
|
inline |
Gets a pointer to byte array for READING.
If the sequence has a length of 0, then the returned pointer is undefined.
|
inline |
Returns the UNacquired C handle of the sequence.
|
inline |
Gets the length of sequence.
|
inline |
Unequality operator: Compares two sequences.
rSeq | another byte sequence (right side) |
|
inline |
Assignment operator: Acquires given sequence handle and releases a previously set handle.
rSeq | another byte sequence |
|
inline |
Equality operator: Compares two sequences.
rSeq | another byte sequence (right side) |
|
inline |
Non-const index operator: Obtains a reference to byte indexed at given position.
In general if the sequence has a handle acquired by other sequences (reference count > 1), then a new sequence is created copying all bytes to keep value semantics!
nIndex | index |
|
inline |
Const index operator: Obtains a reference to byte indexed at given position.
The implementation does NOT check for array bounds!
nIndex | index |
|
inline |
Reallocates sequence to new length.
If the sequence has a handle acquired by other sequences (reference count > 1), then the remaining elements are copied to a new sequence handle to keep value semantics!
nSize | new size of sequence |