use external library

This commit is contained in:
Konstantin Käfer
2014-03-12 12:42:51 +01:00
parent b3e9a1b42c
commit 72ac0c9c31
3 changed files with 46 additions and 42 deletions

View File

@@ -1,7 +1,8 @@
// (c) Dean McNamee <dean@gmail.com>, 2012.
// C++ port by Konstantin Käfer <mail@kkaefer.com, 2014.
// C++ port by Konstantin Käfer <mail@kkaefer.com>, 2014.
//
// https://github.com/deanm/css-color-parser-js
// https://github.com/kkaefer/css-color-parser-cpp
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to
@@ -20,26 +21,24 @@
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
#ifndef LLMR_UTIL_COLOR
#define LLMR_UTIL_COLOR
#ifndef CSS_COLOR_PARSER_CPP
#define CSS_COLOR_PARSER_CPP
#include <string>
namespace llmr {
namespace util {
namespace CSSColorParser {
struct CSSColor {
inline CSSColor() {}
inline CSSColor(unsigned char r, unsigned char g, unsigned char b, float a)
struct Color {
inline Color() {}
inline Color(unsigned char r, unsigned char g, unsigned char b, float a)
: r(r), g(g), b(b), a(a) {}
unsigned char r = 0, g = 0, b = 0;
float a = 1.0f;
};
CSSColor parseCSSColor(std::string str);
Color parse(const std::string& css_str);
}
}
#endif