You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2014/11/05 05:48:42 UTC

[jira] [Commented] (THRIFT-2639) c_glib: Expose as properties members of generated structs

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

Hudson commented on THRIFT-2639:
--------------------------------

SUCCESS: Integrated in Thrift #1331 (See [https://builds.apache.org/job/Thrift/1331/])
THRIFT-2639 c_glib: Expose as properties members of generated structs (roger: rev 60b7ad6b3d84127b322d65eba049ce3b6dd17e6b)
* compiler/cpp/src/generate/t_c_glib_generator.cc
* lib/c_glib/test/testdebugproto.c
* compiler/cpp/src/parse/t_enum.h
THRIFT-2639 c_glib: Expose as properties members of generated structs (jensg: rev a0b86741169b8ef0a1e663154db447517bd89b0b)
* compiler/cpp/src/generate/t_c_glib_generator.cc


> c_glib: Expose as properties members of generated structs
> ---------------------------------------------------------
>
>                 Key: THRIFT-2639
>                 URL: https://issues.apache.org/jira/browse/THRIFT-2639
>             Project: Thrift
>          Issue Type: Improvement
>          Components: C glib - Compiler
>    Affects Versions: 0.9.1
>         Environment: Fedora 20 64-bit on x86_64
>            Reporter: Simon South
>            Assignee: Roger Meier
>            Priority: Minor
>              Labels: c_glib, compiler
>             Fix For: 0.9.2
>
>         Attachments: thrift-2639-1-c_glib-initialize-struct-list-members.patch, thrift-2639-2-t_enum_add_min_value_max_value.patch, thrift-2639-3-c_glib-expose-struct-members-as-properties.patch, thrift-2639-4-c_glib-reformat-testdebugproto-c-to-match.patch, thrift-2639-5-c_glib-do-not-use-std-to_string.patch
>
>
> Currently the c_glib compiler generates a GObject class for each Thrift struct, with a corresponding field for each of the struct's members. However it doesn't register the members as properties of the object, expecting client code to instead access the object's fields directly&mdash;an unconventional and bad practice.
> This set of patches changes the compiler so it exposes struct members as object properties, allowing them to be accessed and modified in the conventional manner. (This doesn't _prevent_ objects' fields from being accessed directly, though, so existing code will continue to work.)
> The changes are, in order:
> # Initialize list members with their default values, if specified, in the constructor of generated struct classes. (Not strictly tied to this issue, but used in the test cases I'm submitting.)
> # Add {{get_min_value}} and {{get_max_value}} methods to {{t_enum}}, allowing the compiler to determine the valid range for properties representing an enumerated type.
> # Output a property enumeration, property setter and property getter for each generated class representing a struct, and register the class' properties in its class initializer.
> # Gently reformat {{testdebugproto.c}} (as I have now completely rewritten it) so my previous work matches the structure of this current work.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)