forked from aseprite/aseprite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalue.h
More file actions
54 lines (40 loc) · 1.02 KB
/
value.h
File metadata and controls
54 lines (40 loc) · 1.02 KB
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
// Aseprite CSS Library
// Copyright (C) 2013 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef CSS_VALUE_H_INCLUDED
#define CSS_VALUE_H_INCLUDED
#pragma once
#include "css/map.h"
#include <string>
namespace css {
class Value {
public:
enum Type {
None,
Number,
String
};
Value();
explicit Value(double value, const std::string& unit = "");
explicit Value(const std::string& value);
Type type() const { return m_type; }
double number() const;
std::string string() const;
std::string unit() const;
void setNumber(double value);
void setString(const std::string& value);
void setUnit(const std::string& unit = "");
bool operator==(const Value& other) const;
bool operator!=(const Value& other) const {
return !operator==(other);
}
private:
Type m_type;
double m_number;
std::string m_string;
};
typedef Map<Value> Values;
} // namespace css
#endif