19 #ifndef INCLUDED_COM_SUN_STAR_UNO_SEQUENCE_HXX 20 #define INCLUDED_COM_SUN_STAR_UNO_SEQUENCE_HXX 26 #if defined LIBO_INTERNAL_ONLY 27 # include <type_traits> 65 osl_atomic_increment( &rSeq._pSequence->
nRefCount );
66 _pSequence = rSeq._pSequence;
72 : _pSequence( pSequence )
85 throw ::std::bad_alloc();
97 throw ::std::bad_alloc();
100 #if defined LIBO_INTERNAL_ONLY 104 const_cast<E *>(init.begin()), init.size(),
cpp_acquire))
106 throw std::bad_alloc();
114 if (osl_atomic_decrement( &_pSequence->nRefCount ) == 0)
134 if (_pSequence == rSeq._pSequence)
147 return (!
operator == ( rSeq ));
159 throw ::std::bad_alloc();
160 return reinterpret_cast< E *
>( _pSequence->elements );
166 {
return getConstArray(); }
171 {
return begin() + getLength(); }
177 assert(nIndex >= 0 && static_cast<sal_uInt32>(nIndex) < static_cast<sal_uInt32>(getLength()));
178 return getArray()[ nIndex ];
185 assert(nIndex >= 0 && static_cast<sal_uInt32>(nIndex) < static_cast<sal_uInt32>(getLength()));
186 return reinterpret_cast< const E *
>( _pSequence->elements )[ nIndex ];
198 throw ::std::bad_alloc();
202 const ::rtl::ByteSequence & rByteSequence )
204 return *
reinterpret_cast< const ::com::sun::star::uno::Sequence< sal_Int8 > *
>( &rByteSequence );
207 #if defined LIBO_INTERNAL_ONLY 211 namespace uno_detail {
213 template<
typename value_t,
typename charT,
typename traits >
214 void sequence_output_elems( std::basic_ostream<charT, traits> &os,
const value_t *pAry, sal_Int32 nLen, std::true_type )
217 auto const flags = os.setf(std::ios_base::hex);
218 for(sal_Int32 i=0; i<nLen-1; ++i)
219 os <<
"0x" << *pAry++ <<
", ";
221 os <<
"0x" << *pAry++;
225 template<
typename value_t,
typename charT,
typename traits >
226 void sequence_output_elems( std::basic_ostream<charT, traits> &os,
const value_t *pAry, sal_Int32 nLen, std::false_type )
229 for(sal_Int32 i=0; i<nLen-1; ++i)
230 os << *pAry++ <<
", ";
235 template<
typename value_t,
typename charT,
typename traits >
236 void sequence_output_bytes( std::basic_ostream<charT, traits> &os,
const value_t *pAry, sal_Int32 nLen )
240 auto const flags = os.setf(std::ios_base::hex);
241 for(sal_Int32 i=0; i<nLen-1; ++i)
242 os <<
"0x" << (0xFF & +*pAry++) <<
", ";
244 os <<
"0x" << (0xFF & +*pAry++);
249 struct negation : std::integral_constant<bool, !bool(B::value)> { };
259 template<
typename value_t,
typename charT,
typename traits >
260 inline typename std::enable_if<uno_detail::negation<std::is_same<sal_Int8, value_t>>::value, std::basic_ostream<charT, traits>>::type &operator<<(std::basic_ostream<charT, traits> &os, css::uno::Sequence < value_t > &v)
262 const value_t *pAry = v.getConstArray();
263 sal_Int32 nLen = v.getLength();
264 uno_detail::sequence_output_elems(os, pAry, nLen, std::is_integral<value_t>());
268 template<
typename value_t,
typename charT,
typename traits >
269 inline typename std::enable_if<std::is_same<sal_Int8, value_t>::value, std::basic_ostream<charT, traits>>::type &operator<<(std::basic_ostream<charT, traits> &os, css::uno::Sequence < value_t > &v)
272 const sal_Int8 *pAry = v.getConstArray();
273 sal_Int32 nLen = v.getLength();
274 uno_detail::sequence_output_bytes(os, pAry, nLen);
289 template<
typename T > inline ::com::sun::star::uno::Type
const &
291 SAL_UNUSED_PARAMETER ::com::sun::star::uno::Sequence< T >
const *)
298 typename ::com::sun::star::uno::Sequence< T >::ElementType *
>(
306 template<
typename T > inline ::com::sun::star::uno::Type
const &
308 SAL_UNUSED_PARAMETER ::com::sun::star::uno::Sequence< T >
const *)
318 typename ::com::sun::star::uno::Sequence< T >::ElementType *
>(
329 inline const ::com::sun::star::uno::Type &
339 inline const ::com::sun::star::uno::Type &
346 rElementType.getTypeLibType() );
353 inline const ::com::sun::star::uno::Type &
357 if (! s_pType_com_sun_star_uno_Sequence_Char)
361 & s_pType_com_sun_star_uno_Sequence_Char,
362 rElementType.getTypeLibType() );
365 & s_pType_com_sun_star_uno_Sequence_Char );
css::uno::Type const & getTypeFromTypeDescriptionReference(::typelib_TypeDescriptionReference *const *tdr)
Definition: unotype.hxx:101
const ::com::sun::star::uno::Type & getCharSequenceCppuType()
Gets the meta type of IDL sequence< char >.
Definition: Sequence.hxx:354
void cpp_release(void *pCppI)
Function to release a C++ interface.
Definition: genfunc.hxx:46
E * end()
This function allows to use Sequence in standard algorightms, like std::find and others.
Definition: Sequence.hxx:168
CPPU_DLLPUBLIC void uno_type_sequence_destroy(uno_Sequence *sequence, struct _typelib_TypeDescriptionReference *type, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Destroy a sequence whose reference count has dropped to zero.
inline ::com::sun::star::uno::Sequence< sal_Int8 > toUnoSequence(const ::rtl::ByteSequence &rByteSequence)
Creates a UNO byte sequence from a SAL byte sequence.
Definition: Sequence.hxx:201
~Sequence()
Destructor: Releases sequence handle.
Definition: Sequence.hxx:112
signed char sal_Int8
Definition: types.h:43
struct SAL_DLLPUBLIC_RTTI _typelib_TypeDescriptionReference typelib_TypeDescriptionReference
Holds a weak reference to a type description.
CPPU_DLLPUBLIC sal_Bool uno_type_sequence_construct(uno_Sequence **ppSequence, struct _typelib_TypeDescriptionReference *pType, void *pElements, sal_Int32 len, uno_AcquireFunc acquire) SAL_THROW_EXTERN_C()
Constructs a new sequence with given elements.
CPPU_DLLPUBLIC void uno_type_sequence_assign(uno_Sequence **ppDest, uno_Sequence *pSource, struct _typelib_TypeDescriptionReference *pType, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Assigns a sequence.
::com::sun::star::uno::Type const & getTypeFavourChar(SAL_UNUSED_PARAMETER ::com::sun::star::uno::Sequence< T > const *)
Definition: Sequence.hxx:307
#define SAL_UNUSED_PARAMETER
Annotate unused but required C++ function parameters.
Definition: types.h:579
void * cpp_queryInterface(void *pCppI, typelib_TypeDescriptionReference *pType)
Function to query for a C++ interface.
Definition: genfunc.hxx:51
bool operator==(const Sequence &rSeq) const
Equality operator: Compares two sequences.
Definition: Sequence.hxx:132
__sal_NoAcquire
Definition: types.h:368
typelib_TypeDescriptionReference * getTypeLibType() const
Gets the C typelib type description reference pointer.
Definition: Type.h:154
void cpp_acquire(void *pCppI)
Function to acquire a C++ interface.
Definition: genfunc.hxx:41
CPPU_DLLPUBLIC void typelib_static_sequence_type_init(typelib_TypeDescriptionReference **ppRef, typelib_TypeDescriptionReference *pElementType) SAL_THROW_EXTERN_C()
Inits static sequence type reference.
css::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER T const *)
A working replacement for getCppuType (see there).
Definition: unotype.hxx:320
C++ class representing an IDL meta type.
Definition: Type.h:54
Definition: Enterable.hxx:26
const ::com::sun::star::uno::Type & getCppuSequenceType(const ::com::sun::star::uno::Type &rElementType)
Gets the meta type of IDL sequence.
Definition: Sequence.hxx:340
Sequence()
Default constructor: Creates an empty sequence.
Definition: Sequence.hxx:53
bool operator!=(const Sequence &rSeq) const
Unequality operator: Compares two sequences.
Definition: Sequence.hxx:145
E * begin()
This function allows to use Sequence in standard algorightms, like std::find and others.
Definition: Sequence.hxx:163
E & operator[](sal_Int32 nIndex)
Non-const index operator: Obtains a reference to element indexed at given position.
Definition: Sequence.hxx:174
Sequence & operator=(const Sequence &rSeq)
Assignment operator: Acquires given sequence handle and releases previously set handle.
Definition: Sequence.hxx:123
sal_Int32 nRefCount
reference count of sequence
Definition: types.h:323
void realloc(sal_Int32 nSize)
Reallocates sequence to new length.
Definition: Sequence.hxx:190
CPPU_DLLPUBLIC sal_Bool uno_type_equalData(void *pVal1, struct _typelib_TypeDescriptionReference *pVal1Type, void *pVal2, struct _typelib_TypeDescriptionReference *pVal2Type, uno_QueryInterfaceFunc queryInterface, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Tests if two values are equal.
This is the binary specification of a SAL sequence.
Definition: types.h:319
const ::com::sun::star::uno::Type & getCppuType(SAL_UNUSED_PARAMETER const ::com::sun::star::uno::Sequence< E > *)
Definition: Sequence.hxx:330
Template C++ class representing an IDL sequence.
Definition: unotype.hxx:40
CPPU_DLLPUBLIC sal_Bool uno_type_sequence_realloc(uno_Sequence **ppSequence, struct _typelib_TypeDescriptionReference *pType, sal_Int32 nSize, uno_AcquireFunc acquire, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Reallocates length of a sequence.
E * getArray()
Gets a pointer to elements array for reading and writing.
Definition: Sequence.hxx:151
CPPU_DLLPUBLIC sal_Bool uno_type_sequence_reference2One(uno_Sequence **ppSequence, struct _typelib_TypeDescriptionReference *pType, uno_AcquireFunc acquire, uno_ReleaseFunc release) SAL_THROW_EXTERN_C()
Assures that the reference count of the given sequence is one.
static css::uno::Type const & get()
Definition: unotype.hxx:288
::com::sun::star::uno::Type const & getTypeFavourUnsigned(SAL_UNUSED_PARAMETER ::com::sun::star::uno::Sequence< T > const *)
Definition: Sequence.hxx:290