43#ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_STRING_CAST_H
44#define LASS_GUARDIAN_OF_INCLUSION_UTIL_STRING_CAST_H
55class BadStringCast:
public ExceptionMixin<BadStringCast>
58 BadStringCast(std::string msg, std::string loc): ExceptionMixin<BadStringCast>(std::move(msg), std::move(loc)) {}
59 ~BadStringCast() noexcept {}
68 StringCast(
const std::string& in):
73 template <
typename In> StringCast(
const In& in)
75 typedef std::numeric_limits<typename CallTraits<In>::TValue> TLimits;
76 if (TLimits::is_specialized)
78 buffer_.precision(TLimits::digits10 + 1);
82 bool read(std::string& out)
91 template <
typename Out>
bool read(Out& out)
97 typedef std::numeric_limits<typename CallTraits<Out>::TValue> TLimits;
98 if (TLimits::is_specialized)
100 buffer_.precision(TLimits::digits10 + 1);
102 return buffer_ >>
out && (buffer_ >> std::ws).eof();
105 std::stringstream buffer_;
110template <
typename Out,
typename In>
111Out stringCast(
const In& in)
113 impl::StringCast caster(in);
115 if (!caster.read(out))
117 LASS_THROW(
"Failed to cast");
ColorRGBA out(const ColorRGBA &a, const ColorRGBA &b)
a held out by b, part of a outside b.
ColorRGBA in(const ColorRGBA &a, const ColorRGBA &b)
part of a inside b.
general utility, debug facilities, ...
Library for Assembled Shared Sources.