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  *
00004  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00005  *
00006  * Copyright 2000, 2010 Oracle and/or its affiliates.
00007  *
00008  * OpenOffice.org - a multi-platform office productivity suite
00009  *
00010  * This file is part of OpenOffice.org.
00011  *
00012  * OpenOffice.org is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 3
00014  * only, as published by the Free Software Foundation.
00015  *
00016  * OpenOffice.org is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License version 3 for more details
00020  * (a copy is included in the LICENSE file that accompanied this code).
00021  *
00022  * You should have received a copy of the GNU Lesser General Public License
00023  * version 3 along with OpenOffice.org.  If not, see
00024  * <http://www.openoffice.org/license.html>
00025  * for a copy of the LGPLv3 License.
00026  *
00027  ************************************************************************/
00028 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
00029 #define _COM_SUN_STAR_UNO_SEQUENCE_H_
00030 
00031 #include "typelib/typedescription.h"
00032 #include "uno/sequence2.h"
00033 #include "com/sun/star/uno/Type.h"
00034 #include "rtl/alloc.h"
00035 
00036 #if ! defined EXCEPTIONS_OFF
00037 #include <new>
00038 #endif
00039 
00040 
00041 namespace rtl
00042 {
00043 class ByteSequence;
00044 }
00045 
00046 namespace com
00047 {
00048 namespace sun
00049 {
00050 namespace star
00051 {
00052 namespace uno
00053 {
00054 
00062 template< class E >
00063 class Sequence
00064 {
00067     uno_Sequence * _pSequence;
00068 
00069 public:
00071 
00072     // these are here to force memory de/allocation to sal lib.
00073     inline static void * SAL_CALL operator new ( ::size_t nSize )
00074         SAL_THROW(())
00075         { return ::rtl_allocateMemory( nSize ); }
00076     inline static void SAL_CALL operator delete ( void * pMem )
00077         SAL_THROW(())
00078         { ::rtl_freeMemory( pMem ); }
00079     inline static void * SAL_CALL operator new ( ::size_t, void * pMem )
00080         SAL_THROW(())
00081         { return pMem; }
00082     inline static void SAL_CALL operator delete ( void *, void * )
00083         SAL_THROW(())
00084         {}
00085 
00089     static typelib_TypeDescriptionReference * s_pType;
00090 
00092 
00095     typedef E ElementType;
00096 
00099     inline Sequence() SAL_THROW(());
00100 
00105     inline Sequence( const Sequence< E > & rSeq ) SAL_THROW(());
00106 
00113     inline Sequence( uno_Sequence * pSequence, __sal_NoAcquire dummy )
00114         SAL_THROW(());
00115 
00121     inline Sequence( const E * pElements, sal_Int32 len );
00122 
00127     inline explicit Sequence( sal_Int32 len );
00128 
00132     inline ~Sequence() SAL_THROW(());
00133 
00140     inline Sequence< E > & SAL_CALL operator = ( const Sequence< E > & rSeq )
00141         SAL_THROW(());
00142 
00147     inline sal_Int32 SAL_CALL getLength() const SAL_THROW(())
00148         { return _pSequence->nElements; }
00149 
00155     inline sal_Bool SAL_CALL hasElements() const SAL_THROW(())
00156         { return (_pSequence->nElements > 0); }
00157 
00164     inline const E * SAL_CALL getConstArray() const SAL_THROW(())
00165         { return reinterpret_cast< const E * >( _pSequence->elements ); }
00166 
00176     inline E * SAL_CALL getArray();
00177 
00188     inline E & SAL_CALL operator [] ( sal_Int32 nIndex );
00189 
00196     inline const E & SAL_CALL operator [] ( sal_Int32 nIndex ) const
00197         SAL_THROW(());
00198 
00204     inline sal_Bool SAL_CALL operator == ( const Sequence< E > & rSeq ) const
00205         SAL_THROW(());
00206 
00212     inline sal_Bool SAL_CALL operator != ( const Sequence< E > & rSeq ) const
00213         SAL_THROW(());
00214 
00225     inline void SAL_CALL realloc( sal_Int32 nSize );
00226 
00231     inline uno_Sequence * SAL_CALL get() const SAL_THROW(())
00232         { return _pSequence; }
00233 };
00234 
00240 inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence(
00241     const ::rtl::ByteSequence & rByteSequence ) SAL_THROW(());
00242 
00243 }
00244 }
00245 }
00246 }
00247 
00258 template< class E >
00259 inline const ::com::sun::star::uno::Type &
00260 SAL_CALL getCppuType( const ::com::sun::star::uno::Sequence< E > * )
00261     SAL_THROW(());
00262 
00274 template< class E >
00275 inline const ::com::sun::star::uno::Type &
00276 SAL_CALL getCppuSequenceType( const ::com::sun::star::uno::Type & rElementType )
00277     SAL_THROW(());
00278 
00286 inline const ::com::sun::star::uno::Type &
00287 SAL_CALL getCharSequenceCppuType() SAL_THROW(());
00288 
00289 #endif
00290 
00291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines