Current Version: 1.0.10
Project Name: csspp
csspp.h
Go to the documentation of this file.
1 #ifndef CSSPP_CSSPP_H
2 #define CSSPP_CSSPP_H
3 // CSS Preprocessor
4 // Copyright (C) 2015-2016 Made to Order Software Corp.
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 #include <cstdint>
21 #include <string>
22 #include <sstream>
23 
24 #ifdef __CYGWIN__
25 namespace std
26 {
27  template<typename T>
28  std::string to_string(T value)
29  {
30  std::stringstream ss;
31  ss << value;
32  return ss.str();
33  }
34 }
35 #endif
36 
37 #ifndef M_PI
38 #define M_PI 3.14159265358979323846
39 #endif
40 
41 namespace csspp
42 {
43 
44 #define CSSPP_VERSION_MAJOR 1
45 #define CSSPP_VERSION_MINOR 0
46 #define CSSPP_VERSION_PATCH 10
47 #define CSSPP_VERSION "1.0.10"
48 
49 typedef int32_t wide_char_t;
50 typedef uint32_t wide_uchar_t;
51 typedef int line_t;
52 typedef int64_t integer_t;
53 typedef double decimal_number_t;
54 
55 char const * csspp_library_version();
56 int get_precision();
57 void set_precision(int precision);
58 std::string decimal_number_to_string(decimal_number_t d, bool remove_leading_zero);
59 
61 {
62 public:
63  safe_bool_t(bool & flag)
64  : f_flag(flag)
65  , f_old_value(flag)
66  {
67  f_flag = true;
68  }
69 
70  safe_bool_t(bool & flag, bool new_value)
71  : f_flag(flag)
72  , f_old_value(flag)
73  {
74  f_flag = new_value;
75  }
76 
78  {
80  }
81 
82 private:
83  bool & f_flag;
85 };
86 
88 {
89 public:
92  {
93  }
94 
95  safe_precision_t(int precision)
97  {
98  set_precision(precision);
99  }
100 
102  {
104  }
105 
106 private:
108 };
109 
110 } // namespace csspp
111 #endif
112 // #ifndef CSSPP_CSSPP_H
113 
114 // Local Variables:
115 // mode: cpp
116 // indent-tabs-mode: nil
117 // c-basic-offset: 4
118 // tab-width: 4
119 // End:
120 
121 // vim: ts=4 sw=4 et
int32_t wide_char_t
Definition: csspp.h:49
std::string decimal_number_to_string(decimal_number_t d, bool remove_leading_zero)
Definition: csspp.cpp:75
int64_t integer_t
Definition: csspp.h:52
bool f_old_value
Definition: csspp.h:84
safe_bool_t(bool &flag)
Definition: csspp.h:63
int line_t
Definition: position.h:27
int get_precision()
Definition: csspp.cpp:60
void set_precision(int precision)
Definition: csspp.cpp:65
char const * csspp_library_version()
Definition: csspp.cpp:55
safe_precision_t(int precision)
Definition: csspp.h:95
uint32_t wide_uchar_t
Definition: csspp.h:50
safe_bool_t(bool &flag, bool new_value)
Definition: csspp.h:70
double decimal_number_t
Definition: csspp.h:53
bool & f_flag
Definition: csspp.h:83

Documentation of CSS Preprocessor.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.