LibreOffice
LibreOffice 6.1 SDK C/C++ API Reference
byteseq.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 #ifndef INCLUDED_RTL_BYTESEQ_H
20 #define INCLUDED_RTL_BYTESEQ_H
21 
22 #include "sal/config.h"
23 
24 #include "rtl/alloc.h"
25 #include "rtl/ustring.h"
26 #include "sal/saldllapi.h"
27 #include "sal/types.h"
28 
29 #ifdef __cplusplus
30 extern "C"
31 {
32 #endif
33 
40  sal_Sequence ** ppSequence )
42 
49  sal_Sequence ** ppSequence, sal_Int32 nSize )
51 
57  sal_Sequence *pSequence )
59 
65  sal_Sequence *pSequence )
67 
75  sal_Sequence **ppSequence , sal_Int32 nLength )
77 
85  sal_Sequence **ppSequence , sal_Int32 nLength )
87 
96  sal_Sequence **ppSequence, const sal_Int8 *pData , sal_Int32 nLength )
98 
106  sal_Sequence **ppSequence , sal_Sequence *pSequence )
108 
114  sal_Sequence *pSequence1 , sal_Sequence *pSequence2 )
116 
124  sal_Sequence *pSequence )
126 
132 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_byte_sequence_getLength(
133  sal_Sequence *pSequence )
135 
136 #ifdef __cplusplus
137 }
138 namespace rtl
139 {
140 
142 {
146 };
147 
149 {
154 #if defined _MSC_VER
155  int(0xcafebabe)
156 #else
157  0xcafebabe
158 #endif
159 };
160 
167 {
170  sal_Sequence * _pSequence;
171 
172 public:
174  // these are here to force memory de/allocation to sal lib.
175  static void * SAL_CALL operator new ( size_t nSize )
176  { return ::rtl_allocateMemory( nSize ); }
177  static void SAL_CALL operator delete ( void * pMem )
178  { ::rtl_freeMemory( pMem ); }
179  static void * SAL_CALL operator new ( size_t, void * pMem )
180  { return pMem; }
181  static void SAL_CALL operator delete ( void *, void * )
182  {}
184 
187  inline ByteSequence();
192  inline ByteSequence( const ByteSequence & rSeq );
193 #if defined LIBO_INTERNAL_ONLY
194  inline ByteSequence( ByteSequence && rSeq );
195 #endif
196 
200  inline ByteSequence( sal_Sequence *pSequence );
206  inline ByteSequence( const sal_Int8 * pElements, sal_Int32 len );
211  inline ByteSequence( sal_Int32 len );
218  inline ByteSequence( sal_Int32 len , enum __ByteSequence_NoDefault nodefault );
228  inline ByteSequence( sal_Sequence *pSequence , enum __ByteSequence_NoAcquire noacquire );
231  inline ~ByteSequence();
232 
238  inline ByteSequence & SAL_CALL operator = ( const ByteSequence & rSeq );
239 #if defined LIBO_INTERNAL_ONLY
240  inline ByteSequence & SAL_CALL operator = ( ByteSequence && rSeq );
241 #endif
242 
247  sal_Int32 SAL_CALL getLength() const
248  { return _pSequence->nElements; }
249 
255  const sal_Int8 * SAL_CALL getConstArray() const
256  { return reinterpret_cast<sal_Int8 *>(_pSequence->elements); }
264  inline sal_Int8 * SAL_CALL getArray();
265 
278  inline sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex );
279 
286  const sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex ) const
287  { return getConstArray()[ nIndex ]; }
288 
294  inline bool SAL_CALL operator == ( const ByteSequence & rSeq ) const;
300  inline bool SAL_CALL operator != ( const ByteSequence & rSeq ) const;
301 
308  inline void SAL_CALL realloc( sal_Int32 nSize );
309 
314  sal_Sequence * SAL_CALL getHandle() const
315  { return _pSequence; }
320  sal_Sequence * SAL_CALL get() const
321  { return _pSequence; }
322 };
323 
324 }
325 #endif
326 #endif
327 
328 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
#define SAL_THROW_EXTERN_C()
Nothrow specification for C functions.
Definition: types.h:344
SAL_DLLPUBLIC void rtl_byte_sequence_acquire(sal_Sequence *pSequence) SAL_THROW_EXTERN_C()
Acquires the byte sequence.
__ByteSequence_NoAcquire
Definition: byteseq.h:148
C++ class representing a SAL byte sequence.
Definition: byteseq.h:166
bool operator==(const TTimeValue &rTimeA, const TTimeValue &rTimeB)
Definition: timer.hxx:116
bool operator!=(const Any &rAny, const C &value)
Template unequality operator: compares set value of left side any to right side value.
Definition: Any.hxx:645
signed char sal_Int8
Definition: types.h:43
#define SAL_DLLPUBLIC
Definition: saldllapi.h:30
SAL_DLLPUBLIC sal_Int32 rtl_byte_sequence_getLength(sal_Sequence *pSequence) SAL_THROW_EXTERN_C()
Returns the length of the sequence.
#define SAL_WARN_UNUSED
Annotate classes where a compiler should warn if an instance is unused.
Definition: types.h:598
This enum value can be used to create a bytesequence with uninitialized data.
Definition: byteseq.h:145
sal_Sequence * getHandle() const
Returns the UNnacquired C handle of the sequence.
Definition: byteseq.h:314
SAL_DLLPUBLIC void rtl_byte_sequence_constructFromArray(sal_Sequence **ppSequence, const sal_Int8 *pData, sal_Int32 nLength) SAL_THROW_EXTERN_C()
Constructs a byte sequence with length nLength and copies nLength bytes from pData.
SAL_DLLPUBLIC void * rtl_allocateMemory(sal_Size Bytes) SAL_THROW_EXTERN_C()
Allocate memory.
SAL_DLLPUBLIC void rtl_byte_sequence_construct(sal_Sequence **ppSequence, sal_Int32 nLength) SAL_THROW_EXTERN_C()
Constructs a bytes sequence with length nLength.
__ByteSequence_NoDefault
Definition: byteseq.h:141
SAL_DLLPUBLIC sal_Bool rtl_byte_sequence_equals(sal_Sequence *pSequence1, sal_Sequence *pSequence2) SAL_THROW_EXTERN_C()
Compares two byte sequences.
unsigned char sal_Bool
Definition: types.h:38
Definition: bootstrap.hxx:29
SAL_DLLPUBLIC void rtl_byte_sequence_reference2One(sal_Sequence **ppSequence) SAL_THROW_EXTERN_C()
Assures that the reference count of the given byte sequence is one.
SAL_DLLPUBLIC void rtl_byte_sequence_realloc(sal_Sequence **ppSequence, sal_Int32 nSize) SAL_THROW_EXTERN_C()
Reallocates length of byte sequence.
This enum value can be used to create a bytesequence from a C-Handle without acquiring the handle...
Definition: byteseq.h:153
SAL_DLLPUBLIC const sal_Int8 * rtl_byte_sequence_getConstArray(sal_Sequence *pSequence) SAL_THROW_EXTERN_C()
Returns the data array pointer of the sequence.
SAL_DLLPUBLIC void rtl_byte_sequence_constructNoDefault(sal_Sequence **ppSequence, sal_Int32 nLength) SAL_THROW_EXTERN_C()
Constructs a bytes sequence with length nLength.
SAL_DLLPUBLIC void rtl_byte_sequence_assign(sal_Sequence **ppSequence, sal_Sequence *pSequence) SAL_THROW_EXTERN_C()
Assigns the byte sequence pSequence to *ppSequence.
SAL_DLLPUBLIC void rtl_freeMemory(void *Ptr) SAL_THROW_EXTERN_C()
Free memory.
sal_Int32 getLength() const
Gets the length of sequence.
Definition: byteseq.h:247
This is the binary specification of a SAL sequence.
Definition: types.h:319
SAL_DLLPUBLIC void rtl_byte_sequence_release(sal_Sequence *pSequence) SAL_THROW_EXTERN_C()
Releases the byte sequence.
const sal_Int8 * getConstArray() const
Gets a pointer to byte array for READING.
Definition: byteseq.h:255