My Project
UDK 3.2.7 C/C++ API Reference
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Sequence.h
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * Copyright 2000, 2010 Oracle and/or its affiliates.
7  *
8  * OpenOffice.org - a multi-platform office productivity suite
9  *
10  * This file is part of OpenOffice.org.
11  *
12  * OpenOffice.org is free software: you can redistribute it and/or modify
13  * it under the terms of the GNU Lesser General Public License version 3
14  * only, as published by the Free Software Foundation.
15  *
16  * OpenOffice.org is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19  * GNU Lesser General Public License version 3 for more details
20  * (a copy is included in the LICENSE file that accompanied this code).
21  *
22  * You should have received a copy of the GNU Lesser General Public License
23  * version 3 along with OpenOffice.org. If not, see
24  * <http://www.openoffice.org/license.html>
25  * for a copy of the LGPLv3 License.
26  *
27  ************************************************************************/
28 #ifndef _COM_SUN_STAR_UNO_SEQUENCE_H_
29 #define _COM_SUN_STAR_UNO_SEQUENCE_H_
30 
32 #include "uno/sequence2.h"
33 #include "com/sun/star/uno/Type.h"
34 #include "rtl/alloc.h"
35 
36 #if ! defined EXCEPTIONS_OFF
37 #include <new>
38 #endif
39 
40 
41 namespace rtl
42 {
43 class ByteSequence;
44 }
45 
46 namespace com
47 {
48 namespace sun
49 {
50 namespace star
51 {
52 namespace uno
53 {
54 
62 template< class E >
63 class Sequence
64 {
67  uno_Sequence * _pSequence;
68 
69 public:
71 
72  // these are here to force memory de/allocation to sal lib.
73  inline static void * SAL_CALL operator new ( ::size_t nSize )
74  SAL_THROW(())
75  { return ::rtl_allocateMemory( nSize ); }
76  inline static void SAL_CALL operator delete ( void * pMem )
77  SAL_THROW(())
78  { ::rtl_freeMemory( pMem ); }
79  inline static void * SAL_CALL operator new ( ::size_t, void * pMem )
80  SAL_THROW(())
81  { return pMem; }
82  inline static void SAL_CALL operator delete ( void *, void * )
83  SAL_THROW(())
84  {}
85 
89  static typelib_TypeDescriptionReference * s_pType;
90 
92 
95  typedef E ElementType;
96 
99  inline Sequence() SAL_THROW(());
100 
105  inline Sequence( const Sequence< E > & rSeq ) SAL_THROW(());
106 
113  inline Sequence( uno_Sequence * pSequence, __sal_NoAcquire dummy )
114  SAL_THROW(());
115 
121  inline Sequence( const E * pElements, sal_Int32 len );
122 
127  inline explicit Sequence( sal_Int32 len );
128 
132  inline ~Sequence() SAL_THROW(());
133 
140  inline Sequence< E > & SAL_CALL operator = ( const Sequence< E > & rSeq )
141  SAL_THROW(());
142 
147  inline sal_Int32 SAL_CALL getLength() const SAL_THROW(())
148  { return _pSequence->nElements; }
149 
155  inline sal_Bool SAL_CALL hasElements() const SAL_THROW(())
156  { return (_pSequence->nElements > 0); }
157 
164  inline const E * SAL_CALL getConstArray() const SAL_THROW(())
165  { return reinterpret_cast< const E * >( _pSequence->elements ); }
166 
176  inline E * SAL_CALL getArray();
177 
188  inline E & SAL_CALL operator [] ( sal_Int32 nIndex );
189 
196  inline const E & SAL_CALL operator [] ( sal_Int32 nIndex ) const
197  SAL_THROW(());
198 
204  inline sal_Bool SAL_CALL operator == ( const Sequence< E > & rSeq ) const
205  SAL_THROW(());
206 
212  inline sal_Bool SAL_CALL operator != ( const Sequence< E > & rSeq ) const
213  SAL_THROW(());
214 
225  inline void SAL_CALL realloc( sal_Int32 nSize );
226 
231  inline uno_Sequence * SAL_CALL get() const SAL_THROW(())
232  { return _pSequence; }
233 };
234 
240 inline ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL toUnoSequence(
241  const ::rtl::ByteSequence & rByteSequence ) SAL_THROW(());
242 
243 }
244 }
245 }
246 }
247 
258 template< class E >
259 inline const ::com::sun::star::uno::Type &
260 SAL_CALL getCppuType( const ::com::sun::star::uno::Sequence< E > * )
261  SAL_THROW(());
262 
274 template< class E >
275 inline const ::com::sun::star::uno::Type &
276 SAL_CALL getCppuSequenceType( const ::com::sun::star::uno::Type & rElementType )
277  SAL_THROW(());
278 
286 inline const ::com::sun::star::uno::Type &
287 SAL_CALL getCharSequenceCppuType() SAL_THROW(());
288 
289 #endif
290 
291 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */