Skip to content

onehundredfeet/henum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

henum

Tiny repository of improvements for the haxe enum abstract (Int)

Usage

Just add the build macro to an abstract int enum. You can specify the default value as a parameter if you want parsing to not throw on invalid values.

@:build(henum.Enhance.build("A"))
enum abstract MyEnum (Int ) from Int{
    var A;
    var B;
    var C;
}

This adds toString and fromString to the abstract.

var a = p.MyEnum.A;
trace('a: $a'); // results in a: A
var b = p.MyEnum.fromString('B');
trace('b: $b'); // results in b: B

About

Tiny repository of improvements for the haxe enum

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages