bump product version to 5.0.4.1
[LibreOffice.git] / connectivity / source / inc / ado / Aolevariant.hxx
blob59c7735a7900417b3e25c04902abc916443aaa08
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX
20 #define INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX
22 #include <sal/types.h>
23 #ifdef __MINGW32__
24 #include <windows.h>
25 #endif
26 #include <rtl/ustring.hxx>
27 #include <com/sun/star/uno/Sequence.hxx>
29 #include "ado_pre_sys_include.h"
30 #include <oaidl.h>
31 #include "ado_post_sys_include.h"
33 namespace com
35 namespace sun
37 namespace star
39 namespace util
41 struct Date;
42 struct Time;
43 struct DateTime;
48 namespace connectivity
50 namespace ado
52 class OLEString
54 BSTR m_sStr;
55 public:
56 OLEString();
57 OLEString(const BSTR& _sBStr);
58 OLEString(const OUString& _sBStr);
59 OLEString(const OLEString& _rRh)
61 OLEString::operator=(_rRh);
63 ~OLEString();
64 OLEString& operator=(const OUString& _rSrc);
65 OLEString& operator=(const BSTR& _rSrc);
66 OLEString& operator=(const OLEString& _rSrc);
67 operator OUString() const;
68 operator BSTR() const;
69 BSTR* operator &();
70 sal_Int32 length() const;
73 class OLEVariant : public ::tagVARIANT
75 public:
76 OLEVariant();
77 OLEVariant(const VARIANT& varSrc);
78 OLEVariant(const OLEVariant& varSrc) ;
79 OLEVariant(bool x) ;
80 OLEVariant(sal_Bool) SAL_DELETED_FUNCTION;
81 OLEVariant(sal_Int8 n) ;
82 OLEVariant(sal_Int16 n) ;
83 OLEVariant(sal_Int32 n) ;
84 OLEVariant(sal_Int64 x) ;
86 OLEVariant(const OUString& us) ;
87 ~OLEVariant() ;
88 OLEVariant(const ::com::sun::star::util::Date& x );
89 OLEVariant(const ::com::sun::star::util::Time& x );
90 OLEVariant(const ::com::sun::star::util::DateTime& x );
91 OLEVariant(const float &x);
92 OLEVariant(const double &x);
93 OLEVariant(IDispatch* pDispInterface);
94 OLEVariant(const ::com::sun::star::uno::Sequence< sal_Int8 >& x);
95 OLEVariant& operator=(const OLEVariant& varSrc);
96 // Assign a const VARIANT& (::VariantCopy handles everything)
98 OLEVariant& operator=(const tagVARIANT& varSrc);
99 // Assign a const VARIANT* (::VariantCopy handles everything)
101 OLEVariant& operator=(const VARIANT* pSrc);
102 void setByte(sal_uInt8 n) ;
103 void setInt16(sal_Int16 n) ;
104 void setInt32(sal_Int32 n) ;
105 void setFloat(float f) ;
106 void setDouble(double d) ;
107 void setDate(DATE d) ;
108 void setChar(unsigned char a) ;
109 void setCurrency(double aCur) ;
110 void setBool(sal_Bool b) ;
111 void setString(const OUString& us) ;
112 void setNoArg() ;
114 void setIDispatch(IDispatch* pDispInterface);
115 void setNull() ;
116 void setEmpty() ;
118 void setUI1SAFEARRAYPtr(SAFEARRAY* pSafeAr);
119 void setArray(SAFEARRAY* pSafeArray, VARTYPE vtType);
120 sal_Bool isNull() const ;
121 sal_Bool isEmpty() const ;
123 VARTYPE getType() const ;
124 void ChangeType(VARTYPE vartype, const OLEVariant* pSrc);
127 operator OUString() const;
129 operator bool() const { return getBool() == 1; }
130 operator sal_Bool() const { return getBool(); }
131 operator sal_Int8() const { return getInt8(); }
132 operator sal_Int16() const { return getInt16(); }
133 operator sal_Int32() const { return getInt32(); }
134 operator float() const { return getFloat(); }
135 operator double() const { return getDouble(); }
137 operator ::com::sun::star::uno::Sequence< sal_Int8 >() const;
138 operator ::com::sun::star::util::Date() const ;
139 operator ::com::sun::star::util::Time() const ;
140 operator ::com::sun::star::util::DateTime()const ;
141 OUString getString() const;
142 sal_Bool getBool() const;
143 IUnknown* getIUnknown() const;
144 IDispatch* getIDispatch() const;
145 sal_uInt8 getByte() const;
146 sal_Int16 getInt16() const;
147 sal_Int8 getInt8() const;
148 sal_Int32 getInt32() const;
149 sal_uInt32 getUInt32() const;
150 float getFloat() const;
151 double getDouble() const;
152 double getDate() const;
153 CY getCurrency() const;
154 SAFEARRAY* getUI1SAFEARRAYPtr() const;
155 ::com::sun::star::uno::Any makeAny() const;
157 static VARIANT_BOOL VariantBool(sal_Bool bEinBoolean);
159 private:
160 void CHS();
162 void set(double n);
168 #endif // INCLUDED_CONNECTIVITY_SOURCE_INC_ADO_AOLEVARIANT_HXX
170 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */