13
0

temporal: add additional required string_to/to_string functions for BBT_Offset & BBT_Time

This commit is contained in:
Paul Davis 2021-12-18 14:11:25 -07:00
parent c3a48ff9c9
commit 9b5e910717

View File

@ -350,6 +350,14 @@ inline bool to_string (Temporal::BBT_Time val, std::string & str)
return true;
}
template<>
inline std::string to_string (Temporal::BBT_Time val)
{
std::ostringstream ostr;
ostr << val;
return ostr.str();
}
template<>
inline bool string_to (std::string const & str, Temporal::BBT_Time & val)
{
@ -358,6 +366,14 @@ inline bool string_to (std::string const & str, Temporal::BBT_Time & val)
return (bool) istr;
}
template<>
inline Temporal::BBT_Time string_to (std::string const & str)
{
Temporal::BBT_Time tmp;
string_to (str, tmp);
return tmp;
}
template<>
inline bool to_string (Temporal::BBT_Offset val, std::string & str)
{
@ -367,6 +383,14 @@ inline bool to_string (Temporal::BBT_Offset val, std::string & str)
return true;
}
template<>
inline std::string to_string (Temporal::BBT_Offset val)
{
std::ostringstream ostr;
ostr << val;
return ostr.str();
}
template<>
inline bool string_to (std::string const & str, Temporal::BBT_Offset & val)
{
@ -375,6 +399,14 @@ inline bool string_to (std::string const & str, Temporal::BBT_Offset & val)
return (bool) istr;
}
template<>
inline Temporal::BBT_Offset string_to (std::string const & str)
{
Temporal::BBT_Offset tmp;
string_to (str, tmp);
return tmp;
}
} /* end namespace PBD */
#endif /* __libtemporal_bbt_time_h__ */