-
Notifications
You must be signed in to change notification settings - Fork 465
/
Copy pathsass.hpp
136 lines (109 loc) · 3.36 KB
/
sass.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// must be the first include in all compile units
#ifndef SASS_SASS_H
#define SASS_SASS_H
// undefine extensions macro to tell sys includes
// that we do not want any macros to be exported
// mainly fixes an issue on SmartOS (SEC macro)
#undef __EXTENSIONS__
#ifdef _MSC_VER
#pragma warning(disable : 4005)
#endif
// aplies to MSVC and MinGW
#ifdef _WIN32
// we do not want the ERROR macro
# define NOGDI
// we do not want the min/max macro
# define NOMINMAX
// we do not want the IN/OUT macro
# define _NO_W32_PSEUDO_MODIFIERS
#endif
// should we be case insensitive
// when dealing with files or paths
#ifndef FS_CASE_SENSITIVE
# ifdef _WIN32
# define FS_CASE_SENSITIVE 0
# else
# define FS_CASE_SENSITIVE 1
# endif
#endif
// path separation char
#ifndef PATH_SEP
# ifdef _WIN32
# define PATH_SEP ';'
# else
# define PATH_SEP ':'
# endif
#endif
// include C-API header
#include "sass/base.h"
// For C++ helper
#include <string>
// output behaviours
namespace Sass {
// create some C++ aliases for the most used options
const static Sass_Output_Style NESTED = SASS_STYLE_NESTED;
const static Sass_Output_Style COMPACT = SASS_STYLE_COMPACT;
const static Sass_Output_Style EXPANDED = SASS_STYLE_EXPANDED;
const static Sass_Output_Style COMPRESSED = SASS_STYLE_COMPRESSED;
// only used internal to trigger ruby inspect behavior
const static Sass_Output_Style INSPECT = SASS_STYLE_INSPECT;
const static Sass_Output_Style TO_SASS = SASS_STYLE_TO_SASS;
// helper to aid dreaded MSVC debug mode
// see implementation for more details
char* sass_copy_string(std::string str);
}
// input behaviours
enum Sass_Input_Style {
SASS_CONTEXT_NULL,
SASS_CONTEXT_FILE,
SASS_CONTEXT_DATA,
SASS_CONTEXT_FOLDER
};
// simple linked list
struct string_list {
string_list* next;
char* string;
};
// sass config options structure
struct Sass_Inspect_Options {
// Output style for the generated css code
// A value from above SASS_STYLE_* constants
enum Sass_Output_Style output_style;
// Precision for fractional numbers
int precision;
// initialization list (constructor with defaults)
Sass_Inspect_Options(Sass_Output_Style style = Sass::NESTED,
int precision = 5)
: output_style(style), precision(precision)
{ }
};
// sass config options structure
struct Sass_Output_Options : Sass_Inspect_Options {
// String to be used for indentation
const char* indent;
// String to be used to for line feeds
const char* linefeed;
// Emit comments in the generated CSS indicating
// the corresponding source line.
bool source_comments;
// initialization list (constructor with defaults)
Sass_Output_Options(struct Sass_Inspect_Options opt,
const char* indent = " ",
const char* linefeed = "\n",
bool source_comments = false)
: Sass_Inspect_Options(opt),
indent(indent), linefeed(linefeed),
source_comments(source_comments)
{ }
// initialization list (constructor with defaults)
Sass_Output_Options(Sass_Output_Style style = Sass::NESTED,
int precision = 5,
const char* indent = " ",
const char* linefeed = "\n",
bool source_comments = false)
: Sass_Inspect_Options(style, precision),
indent(indent), linefeed(linefeed),
source_comments(source_comments)
{ }
};
#endif