Version 4.2.0.1, tag libreoffice-4.2.0.1
[LibreOffice.git] / basegfx / source / inc / stringconversiontools.hxx
blob96692dcf2bb4f34686f1d395872c26f44c77419c
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 _STRINGCONVERSIONTOOLS_HXX
20 #define _STRINGCONVERSIONTOOLS_HXX
22 #include <sal/types.h>
23 #include <rtl/ustring.hxx>
24 #include <rtl/ustrbuf.hxx>
26 namespace basegfx
28 namespace internal
30 void lcl_skipSpaces(sal_Int32& io_rPos,
31 const OUString& rStr,
32 const sal_Int32 nLen);
34 void lcl_skipSpacesAndCommas(sal_Int32& io_rPos,
35 const OUString& rStr,
36 const sal_Int32 nLen);
38 inline bool lcl_isOnNumberChar(const sal_Unicode aChar, bool bSignAllowed = true)
40 const bool bPredicate( (sal_Unicode('0') <= aChar && sal_Unicode('9') >= aChar)
41 || (bSignAllowed && sal_Unicode('+') == aChar)
42 || (bSignAllowed && sal_Unicode('-') == aChar) );
44 return bPredicate;
47 inline bool lcl_isOnNumberChar(const OUString& rStr, const sal_Int32 nPos, bool bSignAllowed = true)
49 return lcl_isOnNumberChar(rStr[nPos],
50 bSignAllowed);
53 bool lcl_getDoubleChar(double& o_fRetval,
54 sal_Int32& io_rPos,
55 const OUString& rStr);
57 bool lcl_importDoubleAndSpaces( double& o_fRetval,
58 sal_Int32& io_rPos,
59 const OUString& rStr,
60 const sal_Int32 nLen );
62 bool lcl_importFlagAndSpaces(sal_Int32& o_nRetval,
63 sal_Int32& io_rPos,
64 const OUString& rStr,
65 const sal_Int32 nLen);
67 void lcl_skipNumber(sal_Int32& io_rPos,
68 const OUString& rStr,
69 const sal_Int32 nLen);
71 void lcl_skipDouble(sal_Int32& io_rPos,
72 const OUString& rStr);
74 inline void lcl_putNumberChar( OUStringBuffer& rStr,
75 double fValue )
77 rStr.append( fValue );
80 void lcl_putNumberCharWithSpace( OUStringBuffer& rStr,
81 double fValue,
82 double fOldValue,
83 bool bUseRelativeCoordinates );
85 inline sal_Unicode lcl_getCommand( sal_Char cUpperCaseCommand,
86 sal_Char cLowerCaseCommand,
87 bool bUseRelativeCoordinates )
89 return bUseRelativeCoordinates ? cLowerCaseCommand : cUpperCaseCommand;
91 } // namespace internal
92 } // namespace basegfx
94 #endif /* _STRINGCONVERSIONTOOLS_HXX */
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */