You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avro.apache.org by moriarty <gi...@git.apache.org> on 2016/10/24 16:10:46 UTC

[GitHub] avro pull request #145: Avro 1940/cpp namespace scoped enums/dev

GitHub user moriarty opened a pull request:

    https://github.com/apache/avro/pull/145

    Avro 1940/cpp namespace scoped enums/dev

    Sorry I should rebased this to only include 14e0aa2. 
    
    But as this is now, it is a breaking change, so I will leave it open here for comments and rebase/resubmit a PR once the maintainers or users have given some feedback.
    
    14e0aa2 adds a namespace of the same name around all enums. as is, it is a breaking change, but it could be optional as a command line argument.
    
    It could also be done using c++11 enum class, but avro c++ doesn't look like anyone is actively working on introducing c++11. 

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

    $ git pull https://github.com/moriarty/avro avro-1940/cpp-namespace-scoped-enums/dev

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

    https://github.com/apache/avro/pull/145.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 #145
    
----
commit 92549ed69c56e2f393c361143c3b8ee90e05d538
Author: Alexander Moriarty <al...@tba.nl>
Date:   2016-10-24T11:59:19Z

    AVRO-1936: C++: adds new include guards
    
    This change adds additional include guards in a different format.
    
    Removes the random numbers from the include guards, instead guarding
    only by NAMESPACE_TYPE_ where TYPE is the Enum, Record or Union Type.
    
    Adds #ifndef NAMESPACE_TYPE_... checks before each struct declaration.
    
    Adds #define NAMESPACE_TYPE_... to the generate(Enum/Record/Union)Traits
    funtion.
    
    This allows including multiple of the generated C++ files into one
    source C++ file, where the avsc files were generated from avdl, and the
    avdl files contained includes with shared basic types.
    
    The previous way to achieve this, as was done in the AvrogencppTests,
    was to abuse or take advantage adding additional meaningless namespaces.
    
    I have left one line of Commented out Code for input from avro-cpp
    users on this proposal.

commit 14e0aa2cb51cd4b29acc8f878cd2857f8dc3ca62
Author: Alexander Moriarty <al...@tba.nl>
Date:   2016-10-24T15:58:28Z

    AVRO-1940: C++: scope enums into own namespaces
    
    Adds a namespace around all enums with the same name as the enum.
    
    There are otherways to do this (c++11) but this way introduces less
    changes.
    
    It could also have an optional command line argument to avoid any
    breaking changes.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] avro pull request #145: AVRO-1940: C++: namespace scoped enums/dev

Posted by moriarty <gi...@git.apache.org>.
Github user moriarty closed the pull request at:

    https://github.com/apache/avro/pull/145


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---