1
0
Fork 0
mirror of https://github.com/bolero-MURAKAMI/Sprout synced 2025-08-03 12:49:50 +00:00

ヘッター部の README のアドレスが違っていたので修正

This commit is contained in:
manga_osyo 2012-05-22 18:11:37 +09:00
parent 1ea9d30e2a
commit 9f061e8882
5 changed files with 349 additions and 350 deletions

View file

@ -1,68 +1,68 @@
//
// Sprout C++ Library
//
// Copyright (c) 2012
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
//
// Readme:
// https://github.com/osyo-manga/cpp-half/blob/master/README
//
// License:
// Boost Software License - Version 1.0
// <http://www.boost.org/LICENSE_1_0.txt>
//
#include <sprout/weed.hpp>
#include <boost/mpl/print.hpp>
#include <boost/mpl/int.hpp>
#include <iostream>
//
// __TIME__ Parser
//
int
main(){
namespace w = sprout::weed;
//
// __TIME__ to Sprout.String
//
static constexpr auto time = sprout::to_string(__TIME__);
// static constexpr auto time = sprout::to_string("23:22:45");
//
// parse __TIME__
//
constexpr auto expr = w::int_ >> ':' >> w::int_ >> ':' >> w::int_;
static constexpr auto result = w::parse(time.begin(), time.end(), parser);
static_assert(result.success(), "failed parse");
//
// get result
//
static constexpr sprout::array<long long int, 3> result_attr = result.attr();
static constexpr auto hour = result_attr[0];
static constexpr auto minute = result_attr[1];
static constexpr auto second = result_attr[2];
// static_assert(hour == 23, "");
// static_assert(minute == 22, "");
// static_assert(second == 45, "");
std::cout << hour << std::endl;
std::cout << minute << std::endl;
std::cout << second << std::endl;
//
// compile time output
//
namespace m = boost::mpl;
typedef m::print<m::int_<hour>>::type hour_;
typedef m::print<m::int_<minute>>::type minute_;
typedef m::print<m::int_<second>>::type second_;
return 0;
}
//
// Sprout C++ Library
//
// Copyright (c) 2012
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
//
// Readme:
// https://github.com/bolero-MURAKAMI/Sprout/blob/master/README
//
// License:
// Boost Software License - Version 1.0
// <http://www.boost.org/LICENSE_1_0.txt>
//
#include <sprout/weed.hpp>
#include <boost/mpl/print.hpp>
#include <boost/mpl/int.hpp>
#include <iostream>
//
// __TIME__ Parser
//
int
main(){
namespace w = sprout::weed;
//
// __TIME__ to Sprout.String
//
static constexpr auto time = sprout::to_string(__TIME__);
// static constexpr auto time = sprout::to_string("23:22:45");
//
// parse __TIME__
//
constexpr auto expr = w::int_ >> ':' >> w::int_ >> ':' >> w::int_;
static constexpr auto result = w::parse(time.begin(), time.end(), parser);
static_assert(result.success(), "failed parse");
//
// get result
//
static constexpr sprout::array<long long int, 3> result_attr = result.attr();
static constexpr auto hour = result_attr[0];
static constexpr auto minute = result_attr[1];
static constexpr auto second = result_attr[2];
// static_assert(hour == 23, "");
// static_assert(minute == 22, "");
// static_assert(second == 45, "");
std::cout << hour << std::endl;
std::cout << minute << std::endl;
std::cout << second << std::endl;
//
// compile time output
//
namespace m = boost::mpl;
typedef m::print<m::int_<hour>>::type hour_;
typedef m::print<m::int_<minute>>::type minute_;
typedef m::print<m::int_<second>>::type second_;
return 0;
}

View file

@ -1,36 +1,36 @@
//
// Sprout C++ Library
//
// Copyright (c) 2012
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
//
// Readme:
// https://github.com/osyo-manga/cpp-half/blob/master/README
//
// License:
// Boost Software License - Version 1.0
// <http://www.boost.org/LICENSE_1_0.txt>
//
#include <sprout/weed.hpp>
int
main(){
namespace w = sprout::weed;
static constexpr auto max_string_size = 32;
static constexpr auto space = *w::omit[ w::space ];
static constexpr auto remove_space = *w::lim<max_string_size>(space >> w::char_);
static constexpr auto source = sprout::to_string(" homu : mami= 10 ");
static constexpr auto result = w::parse(
sprout::begin(source), sprout::end(source),
remove_space
);
static_assert(result.success(), "fail remove_space parse");
static_assert(result.attr() == "homu:mami=10", "");
return 0;
}
//
// Sprout C++ Library
//
// Copyright (c) 2012
// bolero-MURAKAMI : http://d.hatena.ne.jp/boleros/
// osyo-manga : http://d.hatena.ne.jp/osyo-manga/
//
// Readme:
// https://github.com/bolero-MURAKAMI/Sprout/blob/master/README
//
// License:
// Boost Software License - Version 1.0
// <http://www.boost.org/LICENSE_1_0.txt>
//
#include <sprout/weed.hpp>
int
main(){
namespace w = sprout::weed;
static constexpr auto max_string_size = 32;
static constexpr auto space = *w::omit[ w::space ];
static constexpr auto remove_space = *w::lim<max_string_size>(space >> w::char_);
static constexpr auto source = sprout::to_string(" homu : mami= 10 ");
static constexpr auto result = w::parse(
sprout::begin(source), sprout::end(source),
remove_space
);
static_assert(result.success(), "fail remove_space parse");
static_assert(result.attr() == "homu:mami=10", "");
return 0;
}