net.sf.farrago.catalog.codegen
Class CppEnumGen
java.lang.Object
net.sf.farrago.catalog.codegen.CppEnumGen
public class CppEnumGen
- extends Object
CppEnumGen is a tool for generating a C++ enumeration based on the public
static final data members of a Java class.
- Version:
- $Id: //open/dev/farrago/src/net/sf/farrago/catalog/codegen/CppEnumGen.java#15 $
- Author:
- John V. Sichi
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
pw
private PrintWriter pw
CppEnumGen
public CppEnumGen(PrintWriter pw)
- Creates a new CppEnumGen.
- Parameters:
pw
- PrintWriter to which enumeration definitions should be written
generateEnumForClass
public void generateEnumForClass(String enumName,
Class enumClass,
Class enumSymbolType)
throws Exception
- Generates a single enumeration. Enumeration values (and their names) is
based on the subset of non-inherited public static final data members
contained by enumClass and having exact type enumSymbolType. Enumeration
order (and hence implied ordinals) is on the current locale's collation
order for the enum field names. This ordering may not hold in the future,
so no C++ code should be written which depends on the current
deterministic ordering.
TODO: Support integer ordinals. Also, we'd prefer to preserve the
original metamodel ordering in order to relax the ordering condition
above.
- Parameters:
enumName
- name to give C++ enumenumClass
- Java class to be interpreted as an enumeration; this
class's name is used as the enumeration nameenumSymbolType
- Java class used to determine enumeration membership
- Throws:
Exception