Skip to content

AVRO-1940: C++: namespace scoped enums/dev#145

Closed
moriarty wants to merge 2 commits intoapache:masterfrom
moriarty:avro-1940/cpp-namespace-scoped-enums/dev
Closed

AVRO-1940: C++: namespace scoped enums/dev#145
moriarty wants to merge 2 commits intoapache:masterfrom
moriarty:avro-1940/cpp-namespace-scoped-enums/dev

Conversation

@moriarty
Copy link

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.

Alexander Moriarty added 2 commits October 24, 2016 13:59
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.
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.
@moriarty moriarty changed the title Avro 1940/cpp namespace scoped enums/dev AVRO-1940: C++: namespace scoped enums/dev Oct 24, 2016
@moriarty
Copy link
Author

Closing for now.

I will separate this from #142 and resubmit with an added command line argument to avoid breaking the tests

@moriarty moriarty closed this Oct 24, 2016
iemejia referenced this pull request in iemejia/avro May 24, 2021
This commit removes `as` casts in decode.rs where possible.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant