100 Commits

Today I made my 100th commit on the Git repository :-D

I also extended the ‘enumeration’ declarations. Now they have a similar complex code-generation as the ‘flags enumerations’:

// XieXie
enum Types {
	Unknown	("unknown")			:= 0
	Foo		("this is foo")		:= 5
	Bar		("and this is bar") := 6
}

// C++
struct Types
{
    enum __XX__Enum
    {
        Unknown = 0,
        Foo = 5,
        Bar = 6,
        __XX__Uninitialized
    };
    Types() :
        __XX__Entry(__XX__Uninitialized)
    {
    }
    Types(const __XX__Enum& entry) :
        __XX__Entry(entry)
    {
    }
    inline operator __XX__Enum () const
    {
        return __XX__Entry;
    }
    inline size_t Num() const
    {
        return 3;
    }
    std::string Str() const
    {
        switch (__XX__Entry)
        {
            case Unknown: return "unknown";
            case Foo:     return "this is foo";
            case Bar:     return "and this is bar";
        }
        return "";
    }
    __XX__Enum __XX__Entry;
};

Leave a Reply