Update ooo320-m1
[ooovba.git] / bridges / source / remote / urp / urp_marshal_decl.hxx
blobf33f9a3492bd4b29d37771c81c81ab627a585d22
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: urp_marshal_decl.hxx,v $
10 * $Revision: 1.6 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _URP_MARSHAL_DECL_HXX_
32 #define _URP_MARSHAL_DECL_HXX_
34 #include <rtl/ustring.hxx>
35 #include <rtl/byteseq.hxx>
37 #include <com/sun/star/uno/Type.hxx>
39 namespace bridges_urp
41 struct urp_BridgeImpl;
43 typedef void
44 ( SAL_CALL * urp_extractOidCallback )( remote_Interface *pRemoteI, rtl_uString **ppOid );
46 extern char g_bMarshalSystemIsLittleEndian;
47 class Marshal
49 public:
50 Marshal( /* cache access */ struct urp_BridgeImpl *,
51 sal_Int32 m_nBufferSize,
52 urp_extractOidCallback callback = 0
54 ~Marshal( );
56 inline sal_Bool pack( void *pSource , typelib_TypeDescription *pType );
58 sal_Bool packRecursive( void *pSource, typelib_TypeDescription *pType );
60 void packTid( const ::rtl::ByteSequence &id, sal_Bool bIgnoreCache = sal_False );
61 void packOid( const ::rtl::OUString &oid );
62 void packType( void *pSource );
64 inline void packCompressedSize( sal_Int32 nSize );
65 inline void packInt8( void *pSource );
66 inline void packInt16( void *pSource );
67 inline void packInt32( void *pSource );
68 inline void packString( void *pSource );
69 inline sal_Bool packAny( void *pSource );
70 inline void packByteSequence( sal_Int8 *pBuffer , sal_Int32 nSize );
72 // can be called during marshaling, but not between
73 // finish and restart
74 // returns true, when nothing has been marshaled
75 inline sal_Bool empty() const;
77 // stops marshaling, inserts size in front of the buffer
78 // getStart and getSize can now be called
79 inline void finish( sal_Int32 nMessageCount );
81 // must be called after finish. After calling restart,
82 // a new marshalling session is started invalidating
83 // the previous bufer
84 inline void restart();
86 // is only valid, after finish has been called.
87 // valid until destructed.
88 inline sal_Int8 *getBuffer();
90 // is only valid, after finish has been called.
91 // valid until destructed.
92 inline sal_Int32 getSize();
94 inline sal_Int32 getPos()
95 { return m_pos - m_base; }
97 inline sal_Bool isSystemLittleEndian()
98 { return g_bMarshalSystemIsLittleEndian; }
100 private:
101 inline void ensureAdditionalMem( sal_Int32 nMemToAdd );
102 sal_Int32 m_nBufferSize;
103 sal_Int8 *m_base;
104 sal_Int8 *m_pos;
105 struct urp_BridgeImpl *m_pBridgeImpl;
106 urp_extractOidCallback m_callback;
109 #endif