AVRO-1940: C++: namespace scoped enums/dev#145
Closed
moriarty wants to merge 2 commits intoapache:masterfrom
Closed
AVRO-1940: C++: namespace scoped enums/dev#145moriarty wants to merge 2 commits intoapache:masterfrom
moriarty wants to merge 2 commits intoapache:masterfrom
Conversation
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.
Author
|
Closing for now. I will separate this from #142 and resubmit with an added command line argument to avoid breaking the tests |
iemejia
referenced
this pull request
in iemejia/avro
May 24, 2021
This commit removes `as` casts in decode.rs where possible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.