Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 : #ifndef INCLUDED_BASEGFX_SOURCE_INC_STRINGCONVERSIONTOOLS_HXX
20 : #define INCLUDED_BASEGFX_SOURCE_INC_STRINGCONVERSIONTOOLS_HXX
21 :
22 : #include <sal/types.h>
23 : #include <rtl/ustring.hxx>
24 : #include <rtl/ustrbuf.hxx>
25 :
26 : namespace basegfx
27 : {
28 : namespace internal
29 : {
30 : void lcl_skipSpaces(sal_Int32& io_rPos,
31 : const OUString& rStr,
32 : const sal_Int32 nLen);
33 :
34 : void lcl_skipSpacesAndCommas(sal_Int32& io_rPos,
35 : const OUString& rStr,
36 : const sal_Int32 nLen);
37 :
38 111283 : inline bool lcl_isOnNumberChar(const sal_Unicode aChar, bool bSignAllowed = true, bool bDotAllowed = true)
39 : {
40 98091 : const bool bPredicate( (sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
41 66098 : || (bSignAllowed && sal_Unicode('+') == aChar)
42 66098 : || (bSignAllowed && sal_Unicode('-') == aChar)
43 164189 : || (bDotAllowed && sal_Unicode('.') == aChar));
44 :
45 111283 : return bPredicate;
46 : }
47 :
48 105029 : inline bool lcl_isOnNumberChar(const OUString& rStr, const sal_Int32 nPos, bool bSignAllowed = true, bool bDotAllowed = true)
49 : {
50 105029 : return lcl_isOnNumberChar(rStr[nPos], bSignAllowed, bDotAllowed);
51 : }
52 :
53 : bool lcl_getDoubleChar(double& o_fRetval,
54 : sal_Int32& io_rPos,
55 : const OUString& rStr);
56 :
57 : bool lcl_importDoubleAndSpaces( double& o_fRetval,
58 : sal_Int32& io_rPos,
59 : const OUString& rStr,
60 : const sal_Int32 nLen );
61 :
62 : bool lcl_importFlagAndSpaces(sal_Int32& o_nRetval,
63 : sal_Int32& io_rPos,
64 : const OUString& rStr,
65 : const sal_Int32 nLen);
66 :
67 : void lcl_skipNumber(sal_Int32& io_rPos,
68 : const OUString& rStr,
69 : const sal_Int32 nLen);
70 :
71 : void lcl_skipDouble(sal_Int32& io_rPos,
72 : const OUString& rStr);
73 :
74 6318 : inline void lcl_putNumberChar( OUStringBuffer& rStr,
75 : double fValue )
76 : {
77 6318 : rStr.append( fValue );
78 6318 : }
79 :
80 : void lcl_putNumberCharWithSpace( OUStringBuffer& rStr,
81 : double fValue,
82 : double fOldValue,
83 : bool bUseRelativeCoordinates );
84 :
85 4318 : inline sal_Unicode lcl_getCommand( sal_Char cUpperCaseCommand,
86 : sal_Char cLowerCaseCommand,
87 : bool bUseRelativeCoordinates )
88 : {
89 4318 : return bUseRelativeCoordinates ? cLowerCaseCommand : cUpperCaseCommand;
90 : }
91 : } // namespace internal
92 : } // namespace basegfx
93 :
94 : #endif // INCLUDED_BASEGFX_SOURCE_INC_STRINGCONVERSIONTOOLS_HXX
95 :
96 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|