0
I Use This!
Activity Not Available
Analyzed 10 months ago. based on code collected 10 months 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.

Tags

enum lisp codegen cplusplus

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
  • ...
    compare projects before you chose one to use
  • ...
    use of OSS increased in 65% of companies in 2016
  • ...
    search using multiple tags to find exactly what you need

Languages

Languages?height=75&width=75
C++
60%
Lisp
38%
Make
2%

30 Day Summary

Apr 9 2016 — May 9 2016

12 Month Summary

May 9 2015 — May 9 2016

Ratings

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