I Use This!

Project Summary

Analyzed 1 day ago. based on code collected 1 day ago.

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.

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.


In a Nutshell, enumgen...


30 Day Summary

Oct 29 2015 — Nov 28 2015

12 Month Summary

Nov 28 2014 — Nov 28 2015



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