[ 
https://issues.apache.org/jira/browse/THRIFT-2067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14120318#comment-14120318
 ] 

ASF GitHub Bot commented on THRIFT-2067:
----------------------------------------

GitHub user hcorg opened a pull request:

    https://github.com/apache/thrift/pull/205

    THRIFT-2067 C++: all generated objects provide ostream operator<<

    https://issues.apache.org/jira/browse/THRIFT-2067


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/hcorg/thrift THRIFT-2067_ostream_operator

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/thrift/pull/205.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #205
    
----
commit a4380dcaee83504749ea7e1b9f7e00ce95149d01
Author: Konrad Grochowski <hc...@minions.org.pl>
Date:   2014-09-02T14:00:47Z

    THRIFT-2067 C++: all generated objects provide ostream operator<<

----


> 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 was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to