From 81e1a928300a5f23f52685080806fc52a29d6aa6 Mon Sep 17 00:00:00 2001 From: Myun2 Date: Thu, 23 Sep 2010 15:34:34 +0900 Subject: [PATCH] =?utf8?q?web/css=5Fattributes.hpp:=20color=E3=81=AE?= =?utf8?q?=E7=9B=B4=E3=81=97=E3=81=A8=E3=81=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- roast/include/roast/web/css_attributes.hpp | 4 +++- roast/test/lexical_test/html_test.cpp | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/roast/include/roast/web/css_attributes.hpp b/roast/include/roast/web/css_attributes.hpp index fee558bc..ea60f266 100644 --- a/roast/include/roast/web/css_attributes.hpp +++ b/roast/include/roast/web/css_attributes.hpp @@ -44,7 +44,7 @@ namespace roast ::std::string to_string() const { char work[8]; #pragma warning(disable:4996) - sprintf(work, "#%\06x", (0x00ffffff) & value ); + sprintf(work, "#%06x", (0x00ffffff) & value ); #pragma warning(default:4996) return work; } @@ -64,6 +64,7 @@ namespace roast public: color(const char* color_name) : _base("color", color_name) {} color(const color_type& cl) : _base("color", cl.to_string().c_str()) {} + color(unsigned long cl) : _base("color", color_type(cl).to_string().c_str()) {} }; // background-color @@ -72,6 +73,7 @@ namespace roast public: background_color(const char* color_name) : _base("background-color", color_name) {} background_color(const color_type& cl) : _base("background-color", cl.to_string().c_str()) {} + background_color(unsigned long cl) : _base("background-color", color_type(cl).to_string().c_str()) {} }; // background-image diff --git a/roast/test/lexical_test/html_test.cpp b/roast/test/lexical_test/html_test.cpp index 099fe6a6..b604b407 100644 --- a/roast/test/lexical_test/html_test.cpp +++ b/roast/test/lexical_test/html_test.cpp @@ -8,8 +8,10 @@ int main() { using namespace roast::web::css; - //background_repeat br(background_repeat::repeat); + printf("%s\n", color("red").to_string().c_str() ); + printf("%s\n", background_color(0x11223344).to_string().c_str() ); printf("%s\n", background_repeat(background_repeat::repeat).to_string().c_str() ); + printf("%s\n", background_position(background_position::left, background_position::top).to_string().c_str() ); return 0; } -- 2.11.0