I Use This!
Activity Not Available
Analyzed about 1 year ago. based on code collected about 1 year ago.

Project Summary

NOTE: This project is new. The code generator is fully functional and feature rich, now fully unit tested. The implementation of the generated interface is now complete as well. Feel free to take a look by downloading the code from subversion (click the Source link) if you'd like and giving it a try. Feedback welcome.

It's easier to show examples than to write documentation (but it's coming). Here's an example where Fruit.enum is the input, and Fruit.hpp, Fruit.ipp, and Fruit.cpp are generated as a result. http://code.google.com/p/enumgen/source/browse/#svn/trunk/demo

If you're a C++ programmer, I hope you find this useful, and recognize the amount of effort put into generating clean and efficient C++ code.

Why enumgen?

C++ classes have desirable properties that regular enum types do not yet(*) have. Some of the benefits class hold over raw enums are are:

classes are forward-declarable, enums are not. (yet) classes can prevent implicit conversions to ints classes can have member functions and are generally extensible, enums are not. Therefore I created a code-gen tool which reads a simple input file and generates a complete C++ class (header/implementation files) for you to include in your projects and use directly instead of regular enums.

Additional benefits:

user provided code can extend the generated class interface a fairly extensive introspection interface for the generated code to query the enumerator names, values, and aliases ability to create enum objects out of strings that spell their name or one of their aliases ability to ask an enum object for a string representation of its enum value The code generator itself is written in Common Lisp. Currently I've tested with CLISP, SBCL, and ECL, but it should be simple enough to get working elsewhere. You'll need to install a CL implementation to generate C++ code, however, once you generate your C++ source files, they can be compiled into your C++ project without the need for a lisp environment whatsoever. There is absolutely no dependency on lisp except to run the code generator itself.

(*) I'm aware of the future C++0x standard and new strongly-typed, forward-declarable enums. However that will only help improve this generated code, and does not obviate it. One reason is the ability to have MEMBER FUNCTIONS of an enum is still not on the table. I plan to make heavy use of these new enum functions as the new standard implementations become available and widespread.


codegen cplusplus enum lisp

In a Nutshell, enumgen...

This Project has No vulnerabilities Reported Against it

Did You Know...

  • ...
    Black Duck offers a free trial so you can discover if there are open source vulnerabilities in your code
  • ...
    you can subscribe to e-mail newsletters to receive update from the Open Hub blog
  • ...
    in 2016, 47% of companies did not have formal process in place to track OS code
  • ...
    data presented on the Open Hub is available through our API



30 Day Summary

Apr 9 2016 — May 9 2016

12 Month Summary

May 9 2015 — May 9 2016


Be the first to rate this project
Click to add your rating
Review this Project!