You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Vitali Lovich (JIRA)" <ji...@apache.org> on 2013/06/25 19:11:20 UTC
[jira] [Created] (THRIFT-2067) Thrift objects should have a default
string representation
Vitali Lovich created THRIFT-2067:
-------------------------------------
Summary: Thrift objects should have a default string representation
Key: THRIFT-2067
URL: https://issues.apache.org/jira/browse/THRIFT-2067
Project: Thrift
Issue Type: Improvement
Components: C++ - Compiler, C++ - Library
Reporter: Vitali Lovich
Just like thrift objects implement a custom toString in Java, there should be an inline friend function that writes a text representation of the struct to a std::ostream. Probably makes sense for the text representation to be similar to C++:
{code}
class MyThriftClass {
friend std::ostream& operator<<(std::ostream& o, MyThriftClass) {
o << "MyThriftClass[";
o << "field1=" << field1;
if (__isset.field2) {
o << ", field2=" << field2;
}
o << ", list1=" << apache::thrift::util::to_string(list1);
return o << "]";
}
// ...
}
{code}
There will also probably be a util.h file to include that implements generic template to_string for lists, maps, & sets.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira