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

fix coding-stype

This commit is contained in:
bolero-MURAKAMI 2012-10-06 00:58:56 +09:00
parent 2012838899
commit df3023db30
196 changed files with 2510 additions and 3945 deletions

View file

@ -7,7 +7,11 @@
#include <sprout/uuid/uuid.hpp>
namespace sprout {
inline SPROUT_CONSTEXPR std::size_t hash_value(sprout::uuids::uuid const& v) {
//
// hash_value
//
inline SPROUT_CONSTEXPR std::size_t
hash_value(sprout::uuids::uuid const& v) {
return sprout::hash_range(v.begin(), v.end());
}
} // namespace sprout

View file

@ -20,7 +20,8 @@ namespace sprout {
// operator>>
//
template<typename Elem, typename Traits>
std::basic_istream<Elem, Traits>& operator>>(std::basic_istream<Elem, Traits>& lhs, sprout::uuids::uuid& rhs) {
inline std::basic_istream<Elem, Traits>&
operator>>(std::basic_istream<Elem, Traits>& lhs, sprout::uuids::uuid& rhs) {
typedef typename std::basic_ios<Elem, Traits>::char_type char_type;
typename std::basic_istream<Elem, Traits>::sentry const ok(lhs);
typedef std::ctype<Elem> ctype_type;
@ -73,7 +74,8 @@ namespace sprout {
// operator<<
//
template<typename Elem, typename Traits>
std::basic_ostream<Elem, Traits>& operator<<(std::basic_ostream<Elem, Traits>& lhs, sprout::uuids::uuid const& rhs) {
inline std::basic_ostream<Elem, Traits>&
operator<<(std::basic_ostream<Elem, Traits>& lhs, sprout::uuids::uuid const& rhs) {
sprout::detail::io::ios_flags_saver flags_saver(lhs);
sprout::detail::io::basic_ios_fill_saver<Elem, Traits> fill_saver(lhs);
typename std::basic_ostream<Elem, Traits>::sentry const ok(lhs);

View file

@ -20,9 +20,12 @@ namespace sprout {
//
// nil_uuid
//
inline SPROUT_CONSTEXPR sprout::uuids::uuid nil_uuid() {
return sprout::uuids::nil_generator()();
}
namespace {
inline SPROUT_CONSTEXPR sprout::uuids::uuid
nil_uuid() {
return sprout::uuids::nil_generator()();
}
} // anonymous-namespace
} // namespace uuids
} // namespace sprout

View file

@ -99,18 +99,21 @@ namespace sprout {
return open_brace == U'{' && c == U'}';
}
template<typename Iterator, typename Char, typename... Args>
SPROUT_CONSTEXPR result_type generate_2_3(next_char<Iterator> nc, Char open_brace, bool has_dashes, std::uint8_t byte, Args... args) const {
SPROUT_CONSTEXPR result_type
generate_2_3(next_char<Iterator> nc, Char open_brace, bool has_dashes, std::uint8_t byte, Args... args) const {
return generate_2(nc, open_brace, has_dashes, args..., static_cast<std::uint8_t>((byte << 4) | get_value(nc.c)));
}
template<typename Iterator, typename Char, typename... Args>
SPROUT_CONSTEXPR result_type generate_2_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
SPROUT_CONSTEXPR result_type
generate_2_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
return generate_2_3(nc.next(), open_brace, has_dashes, get_value(nc.c), args...);
}
template<typename Iterator, typename Char, typename... Args>
SPROUT_CONSTEXPR typename std::enable_if<
sizeof...(Args) == 6 || sizeof...(Args) == 8 || sizeof...(Args) == 10,
result_type
>::type generate_2_1(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
>::type
generate_2_1(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
return has_dashes
? is_dash(nc.c)
? generate_2_2(nc.next(), open_brace, has_dashes, args...)
@ -122,7 +125,8 @@ namespace sprout {
SPROUT_CONSTEXPR typename std::enable_if<
sizeof...(Args) == 4,
result_type
>::type generate_2_1(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
>::type
generate_2_1(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
return is_dash(nc.c)
? generate_2_2(nc.next(), open_brace, true, args...)
: generate_2_2(nc, open_brace, false, args...)
@ -132,14 +136,16 @@ namespace sprout {
SPROUT_CONSTEXPR typename std::enable_if<
sizeof...(Args) != 4 && sizeof...(Args) != 6 && sizeof...(Args) != 8 && sizeof...(Args) != 10,
result_type
>::type generate_2_1(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
>::type
generate_2_1(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
return generate_2_2(nc, open_brace, has_dashes, args...);
}
template<typename Iterator, typename Char, typename... Args>
SPROUT_CONSTEXPR typename std::enable_if<
sizeof...(Args) == 16,
result_type
>::type generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
>::type
generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
return !open_brace || (open_brace && is_close_brace(nc.next().c, open_brace))
? result_type{{args...}}
: throw std::domain_error("string_generator: invalid uuid string (brace not closed)")
@ -149,18 +155,21 @@ namespace sprout {
SPROUT_CONSTEXPR typename std::enable_if<
sizeof...(Args) == 0,
result_type
>::type generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
>::type
generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
return generate_2_2(nc, open_brace, has_dashes, args...);
}
template<typename Iterator, typename Char, typename... Args>
SPROUT_CONSTEXPR typename std::enable_if<
sizeof...(Args) != 0 && sizeof...(Args) != 16,
result_type
>::type generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
>::type
generate_2(next_char<Iterator> nc, Char open_brace, bool has_dashes, Args... args) const {
return generate_2_1(nc.next(), open_brace, has_dashes, args...);
}
template<typename Iterator>
SPROUT_CONSTEXPR result_type generate_1(next_char<Iterator> nc) const {
SPROUT_CONSTEXPR result_type
generate_1(next_char<Iterator> nc) const {
return is_open_brace(nc.c)
? generate_2(nc.next(), nc.c, false)
: generate_2(nc, typename next_char<Iterator>::char_type(), false)

View file

@ -9,7 +9,7 @@
#include <sprout/tuple/tuple/get.hpp>
#include <sprout/uuid/uuid.hpp>
namespace sprout_adl {
namespace sprout {
//
// tuple_get
//

View file

@ -15,16 +15,20 @@ namespace sprout {
//
// _uuid
//
SPROUT_CONSTEXPR sprout::uuids::uuid operator "" _uuid(char const* s, std::size_t size) {
inline SPROUT_CONSTEXPR sprout::uuids::uuid
operator "" _uuid(char const* s, std::size_t size) {
return sprout::uuids::string_generator()(s, s + size);
}
SPROUT_CONSTEXPR sprout::uuids::uuid operator "" _uuid(wchar_t const* s, std::size_t size) {
inline SPROUT_CONSTEXPR sprout::uuids::uuid
operator "" _uuid(wchar_t const* s, std::size_t size) {
return sprout::uuids::string_generator()(s, s + size);
}
SPROUT_CONSTEXPR sprout::uuids::uuid operator "" _uuid(char16_t const* s, std::size_t size) {
inline SPROUT_CONSTEXPR sprout::uuids::uuid
operator "" _uuid(char16_t const* s, std::size_t size) {
return sprout::uuids::string_generator()(s, s + size);
}
SPROUT_CONSTEXPR sprout::uuids::uuid operator "" _uuid(char32_t const* s, std::size_t size) {
inline SPROUT_CONSTEXPR sprout::uuids::uuid
operator "" _uuid(char32_t const* s, std::size_t size) {
return sprout::uuids::string_generator()(s, s + size);
}
} // namespace uuids

View file

@ -18,7 +18,8 @@ namespace sprout {
namespace uuids {
namespace detail {
template<typename InputIterator>
inline SPROUT_CONSTEXPR bool is_nil(InputIterator first, InputIterator last) {
inline SPROUT_CONSTEXPR bool
is_nil(InputIterator first, InputIterator last) {
return first == last ? true
: !*first && sprout::uuids::detail::is_nil(sprout::next(first), last)
;
@ -230,31 +231,44 @@ namespace sprout {
// operator<=
// operator>=
//
inline SPROUT_CONSTEXPR bool operator==(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return NS_SSCRISK_CEL_OR_SPROUT::equal(lhs.begin(), lhs.end(), rhs.begin());
}
inline SPROUT_CONSTEXPR bool operator!=(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return !(lhs == rhs);
}
inline SPROUT_CONSTEXPR bool operator<(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return NS_SSCRISK_CEL_OR_SPROUT::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
inline SPROUT_CONSTEXPR bool operator>(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return rhs < lhs;
}
inline SPROUT_CONSTEXPR bool operator<=(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return !(rhs < lhs);
}
inline SPROUT_CONSTEXPR bool operator>=(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return !(lhs < rhs);
}
namespace {
inline SPROUT_CONSTEXPR bool
operator==(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return NS_SSCRISK_CEL_OR_SPROUT::equal(lhs.begin(), lhs.end(), rhs.begin());
}
inline SPROUT_CONSTEXPR bool
operator!=(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return !(lhs == rhs);
}
inline SPROUT_CONSTEXPR bool
operator<(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return NS_SSCRISK_CEL_OR_SPROUT::lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end());
}
inline SPROUT_CONSTEXPR bool
operator>(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return rhs < lhs;
}
inline SPROUT_CONSTEXPR bool
operator<=(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return !(rhs < lhs);
}
inline SPROUT_CONSTEXPR bool
operator>=(sprout::uuids::uuid const& lhs, sprout::uuids::uuid const& rhs) {
return !(lhs < rhs);
}
} // anonymous-namespace
//
// swap
//
inline void swap(sprout::uuids::uuid& lhs, sprout::uuids::uuid& rhs) SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs))) {
lhs.swap(rhs);
}
namespace {
inline void
swap(sprout::uuids::uuid& lhs, sprout::uuids::uuid& rhs)
SPROUT_NOEXCEPT_EXPR(SPROUT_NOEXCEPT_EXPR(lhs.swap(rhs)))
{
lhs.swap(rhs);
}
} // anonymous-namespace
} // namespace uuids
using sprout::uuids::uuid;