Fixed operator << for Easy::return_entity.
This commit is contained in:
parent
7558c73648
commit
d3d9f0f4e4
|
@ -90,7 +90,7 @@ namespace Easy
|
||||||
void from_string(const string &json);
|
void from_string(const string &json);
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Returns the JSON of the Entity as string.
|
* @brief Returns the JSON of the Entity as formatted string.
|
||||||
*
|
*
|
||||||
* @return JSON string
|
* @return JSON string
|
||||||
*
|
*
|
||||||
|
|
|
@ -63,14 +63,6 @@ Easy::return_entity<T>::return_entity::operator const string() const
|
||||||
return entity.to_string();
|
return entity.to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
|
||||||
std::ostream &Easy::operator <<(std::ostream &out,
|
|
||||||
const Easy::return_entity<T> &ret)
|
|
||||||
{
|
|
||||||
out << ret.entity.to_string();
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Explicit instantiations, so it can be used from outside.
|
// Explicit instantiations, so it can be used from outside.
|
||||||
template struct Easy::return_entity<Easy::Account>;
|
template struct Easy::return_entity<Easy::Account>;
|
||||||
template struct Easy::return_entity<Easy::Application>;
|
template struct Easy::return_entity<Easy::Application>;
|
||||||
|
|
|
@ -36,11 +36,6 @@ namespace Mastodon
|
||||||
{
|
{
|
||||||
namespace Easy
|
namespace Easy
|
||||||
{
|
{
|
||||||
template <typename T>
|
|
||||||
struct return_entity;
|
|
||||||
template <typename T> // https://stackoverflow.com/a/4661372/5965450
|
|
||||||
std::ostream &operator <<(std::ostream&, const return_entity<T>&);
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Return types for calls that return a single `Easy::Entity`.
|
* @brief Return types for calls that return a single `Easy::Entity`.
|
||||||
*
|
*
|
||||||
|
@ -79,20 +74,24 @@ namespace Easy
|
||||||
operator const T() const;
|
operator const T() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Mastodon::Easy::Entity as string.
|
* @brief Mastodon::Easy::Entity as formatted string.
|
||||||
*
|
*
|
||||||
* @since 0.100.0
|
* @since 0.100.0
|
||||||
*/
|
*/
|
||||||
operator const string() const;
|
operator const string() const;
|
||||||
|
|
||||||
// FIXME: Can't get it to work, don't know why.
|
|
||||||
/*!
|
/*!
|
||||||
* @brief Mastodon::Easy::Entity as string.
|
* @brief Mastodon::Easy::Entity as formatted string.
|
||||||
*
|
*
|
||||||
* @since 0.100.0
|
* @since 0.100.0
|
||||||
*/
|
*/
|
||||||
friend std::ostream &operator <<<T>(std::ostream &out,
|
friend std::ostream &operator <<(std::ostream &out,
|
||||||
const return_entity<T> &ret);
|
const return_entity<T> &ret)
|
||||||
|
{
|
||||||
|
// Could only get it to work by implementing it here.
|
||||||
|
out << ret.entity.to_string();
|
||||||
|
return out;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
Reference in New Issue