Update ooo320-m1
[ooovba.git] / connectivity / source / inc / ado / Aolevariant.hxx
blobddacefec179ed28a5e88159a0132f48a0fca5388
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: Aolevariant.hxx,v $
10 * $Revision: 1.12 $
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 ************************************************************************/
30 #ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_
31 #define _CONNECTIVITY_ADO_AOLEVARIANT_HXX_
33 #include <sal/types.h>
34 #ifdef __MINGW32__
35 #include <windows.h>
36 #endif
37 #include <rtl/ustring.hxx>
38 #include <com/sun/star/uno/Sequence.hxx>
40 #include "ado_pre_sys_include.h"
41 #include <oaidl.h>
42 #include "ado_post_sys_include.h"
44 namespace com
46 namespace sun
48 namespace star
50 namespace util
52 struct Date;
53 struct Time;
54 struct DateTime;
59 namespace connectivity
61 namespace ado
63 class OLEString
65 BSTR m_sStr;
66 public:
67 OLEString();
68 OLEString(const BSTR& _sBStr);
69 OLEString(const ::rtl::OUString& _sBStr);
70 OLEString(const OLEString& _rRh)
72 OLEString::operator=(_rRh);
74 ~OLEString();
75 OLEString& operator=(const ::rtl::OUString& _rSrc);
76 OLEString& operator=(const BSTR& _rSrc);
77 OLEString& operator=(const OLEString& _rSrc);
78 operator ::rtl::OUString() const;
79 operator BSTR() const;
80 BSTR* operator &();
81 sal_Int32 length() const;
84 class OLEVariant : public ::tagVARIANT
86 public:
87 OLEVariant();
88 OLEVariant(const VARIANT& varSrc);
89 OLEVariant(const OLEVariant& varSrc) ;
90 OLEVariant(sal_Bool x) ;
91 OLEVariant(sal_Int8 n) ;
92 OLEVariant(sal_Int16 n) ;
93 OLEVariant(sal_Int32 n) ;
94 OLEVariant(sal_Int64 x) ;
96 OLEVariant(const rtl::OUString& us) ;
97 ~OLEVariant() ;
98 OLEVariant(const ::com::sun::star::util::Date& x );
99 OLEVariant(const ::com::sun::star::util::Time& x );
100 OLEVariant(const ::com::sun::star::util::DateTime& x );
101 OLEVariant(const float &x);
102 OLEVariant(const double &x);
103 OLEVariant(IDispatch* pDispInterface);
104 OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x);
105 OLEVariant& operator=(const OLEVariant& varSrc);
106 // Assign a const VARIANT& (::VariantCopy handles everything)
108 OLEVariant& operator=(const tagVARIANT& varSrc);
109 // Assign a const VARIANT* (::VariantCopy handles everything)
111 OLEVariant& operator=(const VARIANT* pSrc);
112 void setByte(sal_uInt8 n) ;
113 void setInt16(sal_Int16 n) ;
114 void setInt32(sal_Int32 n) ;
115 void setFloat(float f) ;
116 void setDouble(double d) ;
117 void setDate(DATE d) ;
118 void setChar(unsigned char a) ;
119 void setCurrency(double aCur) ;
120 void setBool(sal_Bool b) ;
121 void setString(const rtl::OUString& us) ;
122 void setNoArg() ;
124 void setIDispatch(IDispatch* pDispInterface);
125 void setNull() ;
126 void setEmpty() ;
128 void setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr);
129 void setArray(SAFEARRAY* pSafeArray, VARTYPE vtType);
130 sal_Bool isNull() const ;
131 sal_Bool isEmpty() const ;
133 VARTYPE getType() const ;
134 void ChangeType(VARTYPE vartype, const OLEVariant* pSrc);
137 operator ::rtl::OUString() const;
139 operator sal_Bool() const { return getBool(); }
140 operator sal_Int8() const { return getInt8(); }
141 operator sal_Int16() const { return getInt16(); }
142 operator sal_Int32() const { return getInt32(); }
143 operator float() const { return getFloat(); }
144 operator double() const { return getDouble(); }
146 operator ::com::sun::star::uno::Sequence< sal_Int8 >() const;
147 operator ::com::sun::star::util::Date() const ;
148 operator ::com::sun::star::util::Time() const ;
149 operator ::com::sun::star::util::DateTime()const ;
150 ::rtl::OUString getString() const;
151 sal_Bool getBool() const;
152 IUnknown* getIUnknown() const;
153 IDispatch* getIDispatch() const;
154 sal_uInt8 getByte() const;
155 sal_Int16 getInt16() const;
156 sal_Int8 getInt8() const;
157 sal_Int32 getInt32() const;
158 sal_uInt32 getUInt32() const;
159 float getFloat() const;
160 double getDouble() const;
161 double getDate() const;
162 CY getCurrency() const;
163 SAFEARRAY* getUI1SAFEARRAYPtr() const;
165 static VARIANT_BOOL VariantBool(sal_Bool bEinBoolean);
167 private:
168 void CHS();
170 void set(double n);
176 #endif // _CONNECTIVITY_ADO_AOLEVARIANT_HXX_