MagickCore 7.0.10
string-private.h
Go to the documentation of this file.
1/*
2 Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization
3 dedicated to making software imaging solutions freely available.
4
5 You may not use this file except in compliance with the License.
6 obtain a copy of the License at
7
8 https://imagemagick.org/script/license.php
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Wizard's Toolkit private string methods.
17*/
18#ifndef _WIZARDSTOOLKIT_STRING_PRIVATE_H
19#define _WIZARDSTOOLKIT_STRING_PRIVATE_H
20
21#include <wizard/locale_.h>
22
23#if defined(__cplusplus) || defined(c_plusplus)
24extern "C" {
25#endif
26
27static inline double StringToDouble(const char *string,char **sentinal)
28{
29 return(InterpretLocaleValue(string,sentinal));
30}
31
32static inline double StringToDoubleInterval(const char *string,
33 const double interval)
34{
35 char
36 *q;
37
38 double
39 value;
40
41 value=InterpretSiPrefixValue(string,&q);
42 if (*q == '%')
43 value*=interval/100.0;
44 return(value);
45}
46
47static inline int StringToInteger(const char *value)
48{
49 return((int) strtol(value,(char **) NULL,10));
50}
51
52static inline long StringToLong(const char *value)
53{
54 if (value == (const char *) NULL)
55 return(0);
56 return(strtol(value,(char **) NULL,10));
57}
58
59static inline unsigned long StringToUnsignedLong(const char *value)
60{
61 return(strtoul(value,(char **) NULL,10));
62}
63
64#if defined(__cplusplus) || defined(c_plusplus)
65}
66#endif
67
68#endif
WizardExport double InterpretLocaleValue(const char *string, char **sentinal)
Definition locale.c:969
static unsigned long StringToUnsignedLong(const char *value)
static long StringToLong(const char *value)
static int StringToInteger(const char *value)
static double StringToDoubleInterval(const char *string, const double interval)
static double StringToDouble(const char *string, char **sentinal)
WizardExport double InterpretSiPrefixValue(const char *string, char **sentinal)
Definition string.c:1418