1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: Aolevariant.hxx,v $
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>
37 #include <rtl/ustring.hxx>
38 #include <com/sun/star/uno/Sequence.hxx>
40 #include "ado_pre_sys_include.h"
42 #include "ado_post_sys_include.h"
59 namespace connectivity
68 OLEString(const BSTR
& _sBStr
);
69 OLEString(const ::rtl::OUString
& _sBStr
);
70 OLEString(const OLEString
& _rRh
)
72 OLEString::operator=(_rRh
);
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;
81 sal_Int32
length() const;
84 class OLEVariant
: public ::tagVARIANT
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
) ;
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
) ;
124 void setIDispatch(IDispatch
* pDispInterface
);
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
);
176 #endif // _CONNECTIVITY_ADO_AOLEVARIANT_HXX_