Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / basic / source / sbx / sbxconv.hxx
blobe053e7e028bebdd9e09d5059b1d3e3cd37ef7513
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 .
20 #ifndef INCLUDED_BASIC_SOURCE_SBX_SBXCONV_HXX
21 #define INCLUDED_BASIC_SOURCE_SBX_SBXCONV_HXX
23 #include "sbxdec.hxx"
24 #include <basic/sbx.hxx>
26 class SbxArray;
28 // SBXSCAN.CXX
29 extern void ImpCvtNum( double nNum, short nPrec, OUString& rRes, bool bCoreString=false );
30 extern ErrCode ImpScan
31 ( const OUString& rSrc, double& nVal, SbxDataType& rType, sal_uInt16* pLen,
32 bool bOnlyIntntl );
34 // with advanced evaluation (International, "TRUE"/"FALSE")
35 extern bool ImpConvStringExt( OUString& rSrc, SbxDataType eTargetType );
37 void ImpGetIntntlSep( sal_Unicode& rcDecimalSep, sal_Unicode& rcThousandSep, sal_Unicode& rcDecimalSepAlt );
39 // SBXINT.CXX
41 sal_Int16 ImpGetInteger( const SbxValues* );
42 void ImpPutInteger( SbxValues*, sal_Int16 );
44 sal_Int64 ImpGetInt64( const SbxValues* );
45 void ImpPutInt64( SbxValues*, sal_Int64 );
46 sal_uInt64 ImpGetUInt64( const SbxValues* );
47 void ImpPutUInt64( SbxValues*, sal_uInt64 );
49 sal_Int64 ImpDoubleToSalInt64 ( double d );
50 sal_uInt64 ImpDoubleToSalUInt64( double d );
51 double ImpSalUInt64ToDouble( sal_uInt64 n );
53 // SBXLNG.CXX
55 sal_Int32 ImpGetLong( const SbxValues* );
56 void ImpPutLong( SbxValues*, sal_Int32 );
58 // SBXSNG.CXX
60 float ImpGetSingle( const SbxValues* );
61 void ImpPutSingle( SbxValues*, float );
63 // SBXDBL.CXX
65 double ImpGetDouble( const SbxValues* );
66 void ImpPutDouble( SbxValues*, double, bool bCoreString=false );
68 // SBXCURR.CXX
70 sal_Int64 ImpGetCurrency( const SbxValues* );
71 void ImpPutCurrency( SbxValues*, const sal_Int64 );
73 inline sal_Int64 ImpDoubleToCurrency( double d )
75 if (d > 0)
76 return static_cast<sal_Int64>( d * CURRENCY_FACTOR + 0.5);
77 else
78 return static_cast<sal_Int64>( d * CURRENCY_FACTOR - 0.5);
81 inline double ImpCurrencyToDouble( const sal_Int64 r )
82 { return static_cast<double>(r) / double(CURRENCY_FACTOR); }
85 // SBXDEC.CXX
87 SbxDecimal* ImpCreateDecimal( SbxValues* p );
88 SbxDecimal* ImpGetDecimal( const SbxValues* p );
89 void ImpPutDecimal( SbxValues* p, SbxDecimal* pDec );
91 // SBXDATE.CXX
93 double ImpGetDate( const SbxValues* );
94 void ImpPutDate( SbxValues*, double );
96 // SBXSTR.CXX
98 OUString ImpGetString( const SbxValues* );
99 OUString ImpGetCoreString( const SbxValues* );
100 void ImpPutString( SbxValues*, const OUString* );
102 // SBXCHAR.CXX
104 sal_Unicode ImpGetChar( const SbxValues* );
105 void ImpPutChar( SbxValues*, sal_Unicode );
107 // SBXBYTE.CXX
108 sal_uInt8 ImpGetByte( const SbxValues* );
109 void ImpPutByte( SbxValues*, sal_uInt8 );
111 // SBXUINT.CXX
113 sal_uInt16 ImpGetUShort( const SbxValues* );
114 void ImpPutUShort( SbxValues*, sal_uInt16 );
116 // SBXULNG.CXX
118 sal_uInt32 ImpGetULong( const SbxValues* );
119 void ImpPutULong( SbxValues*, sal_uInt32 );
121 // SBXBOOL.CXX
123 enum SbxBOOL ImpGetBool( const SbxValues* );
124 void ImpPutBool( SbxValues*, sal_Int16 );
126 // ByteArray <--> String
127 SbxArray* StringToByteArray(const OUString& rStr);
128 OUString ByteArrayToString(SbxArray* pArr);
130 #endif
132 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */