UDK 3.2.7 C/C++ API Reference

com/sun/star/uno/Sequence.h

Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*
00003  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
00020 #define _COM_SUN_STAR_UNO_SEQUENCE_H_
00021 
00022 #include "typelib/typedescription.h"
00023 #include "uno/sequence2.h"
00024 #include "com/sun/star/uno/Type.h"
00025 #include "rtl/alloc.h"
00026 
00027 #if ! defined EXCEPTIONS_OFF
00028 #include <new>
00029 #endif
00030 
00031 
00032 namespace rtl
00033 {
00034 class ByteSequence;
00035 }
00036 
00037 namespace com
00038 {
00039 namespace sun
00040 {
00041 namespace star
00042 {
00043 namespace uno
00044 {
00045 
00053 template< class E >
00054 class Sequence
00055 {
00058     uno_Sequence * _pSequence;
00059 
00060 public:
00062 
00063     // these are here to force memory de/allocation to sal lib.
00064     inline static void * SAL_CALL operator new ( ::size_t nSize )
00065         SAL_THROW(())
00066         { return ::rtl_allocateMemory( nSize ); }
00067     inline static void SAL_CALL operator delete ( void * pMem )
00068         SAL_THROW(())
00069         { ::rtl_freeMemory( pMem ); }
00070     inline static void * SAL_CALL operator new ( ::size_t, void * pMem )
00071         SAL_THROW(())
00072         { return pMem; }
00073     inline static void SAL_CALL operator delete ( void *, void * )
00074         SAL_THROW(())
00075         {}
00076 
00080     static typelib_TypeDescriptionReference * s_pType;
00081 
00083 
00086     typedef E ElementType;
00087 
00090     inline Sequence() SAL_THROW(());
00091 
00096     inline Sequence( const Sequence< E > & rSeq ) SAL_THROW(());
00097 
00104     inline Sequence( uno_Sequence * pSequence, __sal_NoAcquire dummy )
00105         SAL_THROW(());
00106 
00112     inline Sequence( const E * pElements, sal_Int32 len );
00113 
00118     inline explicit Sequence( sal_Int32 len );
00119 
00123     inline ~Sequence() SAL_THROW(());
00124 
00131     inline Sequence< E > & SAL_CALL operator = ( const Sequence< E > & rSeq )
00132         SAL_THROW(());
00133 
00138     inline sal_Int32 SAL_CALL getLength() const SAL_THROW(())
00139         { return _pSequence->nElements; }
00140 
00146     inline sal_Bool SAL_CALL hasElements() const SAL_THROW(())
00147         { return (_pSequence->nElements > 0); }
00148 
00155     inline const E * SAL_CALL getConstArray() const SAL_THROW(())
00156         { return reinterpret_cast< const E * >( _pSequence->elements ); }
00157 
00167     inline E * SAL_CALL getArray();
00168 
00179     inline E & SAL_CALL operator [] ( sal_Int32 nIndex );
00180 
00187     inline const E & SAL_CALL operator [] ( sal_Int32 nIndex ) const
00188         SAL_THROW(());
00189 
00195     inline sal_Bool SAL_CALL operator == ( const Sequence< E > & rSeq ) const
00196         SAL_THROW(());
00197 
00203     inline sal_Bool SAL_CALL operator != ( const Sequence< E > & rSeq ) const
00204         SAL_THROW(());
00205 
00216     inline void SAL_CALL realloc( sal_Int32 nSize );
00217 
00222     inline uno_Sequence * SAL_CALL get() const SAL_THROW(())
00223         { return _pSequence; }
00224 };
00225 
00231 inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence(
00232     const ::rtl::ByteSequence & rByteSequence ) SAL_THROW(());
00233 
00234 }
00235 }
00236 }
00237 }
00238 
00249 template< class E >
00250 inline const ::com::sun::star::uno::Type &
00251 SAL_CALL getCppuType( const ::com::sun::star::uno::Sequence< E > * )
00252     SAL_THROW(());
00253 
00265 template< class E >
00266 inline const ::com::sun::star::uno::Type &
00267 SAL_CALL getCppuSequenceType( const ::com::sun::star::uno::Type & rElementType )
00268     SAL_THROW(());
00269 
00277 inline const ::com::sun::star::uno::Type &
00278 SAL_CALL getCharSequenceCppuType() SAL_THROW(());
00279 
00280 #endif
00281 
00282 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines