1/*
2  Copyright 1999-2016 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    http://www.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  MagickCore private string methods.
17*/
18#ifndef MAGICKCORE_STRING_PRIVATE_H
19#define MAGICKCORE_STRING_PRIVATE_H
20
21#include "MagickCore/locale_.h"
22
23#if defined(__cplusplus) || defined(c_plusplus)
24extern "C" {
25#endif
26
27static inline double SiPrefixToDoubleInterval(const char *string,
28  const double interval)
29{
30  char
31    *q;
32
33  double
34    value;
35
36  value=InterpretSiPrefixValue(string,&q);
37  if (*q == '%')
38    value*=interval/100.0;
39  return(value);
40}
41
42static inline double StringToDouble(const char *magick_restrict string,
43  char **magick_restrict sentinal)
44{
45  return(InterpretLocaleValue(string,sentinal));
46}
47
48static inline double StringToDoubleInterval(const char *string,
49  const double interval)
50{
51  char
52    *q;
53
54  double
55    value;
56
57  value=InterpretLocaleValue(string,&q);
58  if (*q == '%')
59    value*=interval/100.0;
60  return(value);
61}
62
63static inline int StringToInteger(const char *magick_restrict value)
64{
65  return((int) strtol(value,(char **) NULL,10));
66}
67
68static inline long StringToLong(const char *magick_restrict value)
69{
70  return(strtol(value,(char **) NULL,10));
71}
72
73static inline unsigned long StringToUnsignedLong(
74  const char *magick_restrict value)
75{
76  return(strtoul(value,(char **) NULL,10));
77}
78
79#if defined(__cplusplus) || defined(c_plusplus)
80}
81#endif
82
83#endif
84