[
https://issues.apache.org/jira/browse/THRIFT-539?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Nitay Joffe updated THRIFT-539:
-------------------------------
Attachment: thrift-539-print.patch
Attaching patch for print part of this JIRA. I realize this can already be done
via ThriftDebugString as you say David, but I think it is still nice to have
this for certain situations.
Here is an example of what this produces:
{noformat}
ostream work: {num1: 15, num2: 10, op: SUBTRACT, comment: fssdf}
debug work: Work {
01: num1 (i32) = 15,
02: num2 (i32) = 10,
03: op (i32) = 2,
04: comment (string) = "fssdf",
}
{noformat}
The "debug work" part is using ThriftDebugString. The "ostream work" part is
using my ostream<< function.
As you can see, they're comparable. I don't print the types, but that can be
added.
Thoughts? Comments?
> struct hash and print methods for C++
> -------------------------------------
>
> Key: THRIFT-539
> URL: https://issues.apache.org/jira/browse/THRIFT-539
> Project: Thrift
> Issue Type: New Feature
> Components: Compiler (C++), Library (C++)
> Reporter: Nitay Joffe
> Priority: Minor
> Attachments: thrift-539-hash.patch, thrift-539-print.patch
>
>
> The current thrift compiler for C++ generates methods for structs like
> operator== and operator< since it uses maps,sets, etc but it does not
> generate a hash() method or a human readable print() method.
> The idea of this issue is to add functionality to the C++ compiler to
> generate:
> # A boost hash compatible hash_value() function. This should probably be an
> option to the compiler as it adds a dependency in generated code on boost.
> # An operator<< function for printing structs in a nice form. This should be
> safe to always do?
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.