Bump for 3.6-28
[LibreOffice.git] / connectivity / source / inc / ado / Aolevariant.hxx
blobfd343f32df614c07012d2ca4c223e413b7b14253
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*************************************************************************
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6 * Copyright 2000, 2010 Oracle and/or its affiliates.
8 * OpenOffice.org - a multi-platform office productivity suite
10 * This file is part of OpenOffice.org.
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.
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).
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.
27 ************************************************************************/
28 #ifndef _CONNECTIVITY_ADO_AOLEVARIANT_HXX_
29 #define _CONNECTIVITY_ADO_AOLEVARIANT_HXX_
31 #include <sal/types.h>
32 #ifdef __MINGW32__
33 #include <windows.h>
34 #endif
35 #include <rtl/ustring.hxx>
36 #include <com/sun/star/uno/Sequence.hxx>
38 #include "ado_pre_sys_include.h"
39 #include <oaidl.h>
40 #include "ado_post_sys_include.h"
42 namespace com
44 namespace sun
46 namespace star
48 namespace util
50 struct Date;
51 struct Time;
52 struct DateTime;
57 namespace connectivity
59 namespace ado
61 class OLEString
63 BSTR m_sStr;
64 public:
65 OLEString();
66 OLEString(const BSTR& _sBStr);
67 OLEString(const ::rtl::OUString& _sBStr);
68 OLEString(const OLEString& _rRh)
70 OLEString::operator=(_rRh);
72 ~OLEString();
73 OLEString& operator=(const ::rtl::OUString& _rSrc);
74 OLEString& operator=(const BSTR& _rSrc);
75 OLEString& operator=(const OLEString& _rSrc);
76 operator ::rtl::OUString() const;
77 operator BSTR() const;
78 BSTR* operator &();
79 sal_Int32 length() const;
82 class OLEVariant : public ::tagVARIANT
84 public:
85 OLEVariant();
86 OLEVariant(const VARIANT& varSrc);
87 OLEVariant(const OLEVariant& varSrc) ;
88 OLEVariant(sal_Bool x) ;
89 OLEVariant(sal_Int8 n) ;
90 OLEVariant(sal_Int16 n) ;
91 OLEVariant(sal_Int32 n) ;
92 OLEVariant(sal_Int64 x) ;
94 OLEVariant(const rtl::OUString& us) ;
95 ~OLEVariant() ;
96 OLEVariant(const ::com::sun::star::util::Date& x );
97 OLEVariant(const ::com::sun::star::util::Time& x );
98 OLEVariant(const ::com::sun::star::util::DateTime& x );
99 OLEVariant(const float &x);
100 OLEVariant(const double &x);
101 OLEVariant(IDispatch* pDispInterface);
102 OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x);
103 OLEVariant& operator=(const OLEVariant& varSrc);
104 // Assign a const VARIANT& (::VariantCopy handles everything)
106 OLEVariant& operator=(const tagVARIANT& varSrc);
107 // Assign a const VARIANT* (::VariantCopy handles everything)
109 OLEVariant& operator=(const VARIANT* pSrc);
110 void setByte(sal_uInt8 n) ;
111 void setInt16(sal_Int16 n) ;
112 void setInt32(sal_Int32 n) ;
113 void setFloat(float f) ;
114 void setDouble(double d) ;
115 void setDate(DATE d) ;
116 void setChar(unsigned char a) ;
117 void setCurrency(double aCur) ;
118 void setBool(sal_Bool b) ;
119 void setString(const rtl::OUString& us) ;
120 void setNoArg() ;
122 void setIDispatch(IDispatch* pDispInterface);
123 void setNull() ;
124 void setEmpty() ;
126 void setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr);
127 void setArray(SAFEARRAY* pSafeArray, VARTYPE vtType);
128 sal_Bool isNull() const ;
129 sal_Bool isEmpty() const ;
131 VARTYPE getType() const ;
132 void ChangeType(VARTYPE vartype, const OLEVariant* pSrc);
135 operator ::rtl::OUString() const;
137 operator sal_Bool() const { return getBool(); }
138 operator sal_Int8() const { return getInt8(); }
139 operator sal_Int16() const { return getInt16(); }
140 operator sal_Int32() const { return getInt32(); }
141 operator float() const { return getFloat(); }
142 operator double() const { return getDouble(); }
144 operator ::com::sun::star::uno::Sequence< sal_Int8 >() const;
145 operator ::com::sun::star::util::Date() const ;
146 operator ::com::sun::star::util::Time() const ;
147 operator ::com::sun::star::util::DateTime()const ;
148 ::rtl::OUString getString() const;
149 sal_Bool getBool() const;
150 IUnknown* getIUnknown() const;
151 IDispatch* getIDispatch() const;
152 sal_uInt8 getByte() const;
153 sal_Int16 getInt16() const;
154 sal_Int8 getInt8() const;
155 sal_Int32 getInt32() const;
156 sal_uInt32 getUInt32() const;
157 float getFloat() const;
158 double getDouble() const;
159 double getDate() const;
160 CY getCurrency() const;
161 SAFEARRAY* getUI1SAFEARRAYPtr() const;
162 ::com::sun::star::uno::Any makeAny() const;
164 static VARIANT_BOOL VariantBool(sal_Bool bEinBoolean);
166 private:
167 void CHS();
169 void set(double n);
175 #endif // _CONNECTIVITY_ADO_AOLEVARIANT_HXX_
177 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */