UDK 3.2.7 C/C++ API Reference
rtl/byteseq.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 _RTL_BYTESEQ_H_
00029 #define _RTL_BYTESEQ_H_
00030 
00031 #include <sal/types.h>
00032 #include <rtl/alloc.h>
00033 
00034 #ifdef __cplusplus
00035 extern "C"
00036 {
00037 #endif
00038 
00044 SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_reference2One(
00045     sal_Sequence ** ppSequence )
00046     SAL_THROW_EXTERN_C();
00047 
00053 SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_realloc(
00054     sal_Sequence ** ppSequence, sal_Int32 nSize )
00055     SAL_THROW_EXTERN_C();
00056 
00061 SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_acquire(
00062     sal_Sequence *pSequence )
00063     SAL_THROW_EXTERN_C();
00064 
00069 SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_release(
00070     sal_Sequence *pSequence )
00071     SAL_THROW_EXTERN_C();
00072 
00079 SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_construct(
00080     sal_Sequence **ppSequence , sal_Int32 nLength )
00081     SAL_THROW_EXTERN_C();
00082 
00089 SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_constructNoDefault(
00090     sal_Sequence **ppSequence , sal_Int32 nLength )
00091     SAL_THROW_EXTERN_C();
00092 
00100 SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_constructFromArray(
00101     sal_Sequence **ppSequence, const sal_Int8 *pData , sal_Int32 nLength )
00102     SAL_THROW_EXTERN_C();
00103 
00110 SAL_DLLPUBLIC void SAL_CALL rtl_byte_sequence_assign(
00111     sal_Sequence **ppSequence , sal_Sequence *pSequence )
00112     SAL_THROW_EXTERN_C();
00113 
00118 SAL_DLLPUBLIC sal_Bool SAL_CALL rtl_byte_sequence_equals(
00119     sal_Sequence *pSequence1 , sal_Sequence *pSequence2 )
00120     SAL_THROW_EXTERN_C();
00121 
00128 SAL_DLLPUBLIC const sal_Int8 *SAL_CALL rtl_byte_sequence_getConstArray(
00129     sal_Sequence *pSequence )
00130     SAL_THROW_EXTERN_C();
00131 
00137 SAL_DLLPUBLIC sal_Int32 SAL_CALL rtl_byte_sequence_getLength(
00138     sal_Sequence *pSequence )
00139     SAL_THROW_EXTERN_C();
00140 
00141 #ifdef __cplusplus
00142 }
00143 namespace rtl
00144 {
00145 
00146 enum __ByteSequence_NoDefault
00147 {
00150     BYTESEQ_NODEFAULT = 0xcafe
00151 };
00152 
00153 enum __ByteSequence_NoAcquire
00154 {
00158     BYTESEQ_NOACQUIRE = 0xcafebabe
00159 };
00160 
00166 class ByteSequence
00167 {
00170     sal_Sequence * _pSequence;
00171 
00172 public:
00174     // these are here to force memory de/allocation to sal lib.
00175     inline static void * SAL_CALL operator new ( size_t nSize ) SAL_THROW(())
00176         { return ::rtl_allocateMemory( nSize ); }
00177     inline static void SAL_CALL operator delete ( void * pMem ) SAL_THROW(())
00178         { ::rtl_freeMemory( pMem ); }
00179     inline static void * SAL_CALL operator new ( size_t, void * pMem ) SAL_THROW(())
00180         { return pMem; }
00181     inline static void SAL_CALL operator delete ( void *, void * ) SAL_THROW(())
00182         {}
00184 
00187     inline ByteSequence() SAL_THROW(());
00192     inline ByteSequence( const ByteSequence & rSeq ) SAL_THROW(());
00197     inline ByteSequence( sal_Sequence *pSequence ) SAL_THROW(());
00203     inline ByteSequence( const sal_Int8 * pElements, sal_Int32 len );
00208     inline ByteSequence( sal_Int32 len );
00215     inline ByteSequence( sal_Int32 len , enum __ByteSequence_NoDefault nodefault );
00225     inline ByteSequence( sal_Sequence *pSequence , enum __ByteSequence_NoAcquire noacquire ) SAL_THROW(());
00228     inline ~ByteSequence() SAL_THROW(());
00229 
00235     inline ByteSequence & SAL_CALL operator = ( const ByteSequence & rSeq ) SAL_THROW(());
00236 
00241     inline sal_Int32 SAL_CALL getLength() const SAL_THROW(())
00242         { return _pSequence->nElements; }
00243 
00249     inline const sal_Int8 * SAL_CALL getConstArray() const SAL_THROW(())
00250         { return (const sal_Int8 *)_pSequence->elements; }
00258     inline sal_Int8 * SAL_CALL getArray();
00259 
00272     inline sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex );
00273 
00280     inline const sal_Int8 & SAL_CALL operator [] ( sal_Int32 nIndex ) const SAL_THROW(())
00281         { return getConstArray()[ nIndex ]; }
00282 
00288     inline sal_Bool SAL_CALL operator == ( const ByteSequence & rSeq ) const SAL_THROW(());
00294     inline sal_Bool SAL_CALL operator != ( const ByteSequence & rSeq ) const SAL_THROW(());
00295 
00302     inline void SAL_CALL realloc( sal_Int32 nSize );
00303 
00308     inline sal_Sequence * SAL_CALL getHandle() const SAL_THROW(())
00309         { return _pSequence; }
00314     inline sal_Sequence * SAL_CALL get() const SAL_THROW(())
00315         { return _pSequence; }
00316 };
00317 
00318 }
00319 #endif
00320 #endif
00321 
00322 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines