Skip to content

Commit

Permalink
Use String() of convertmodes to register convertmode
Browse files Browse the repository at this point in the history
  • Loading branch information
Malte Muench committed Jul 29, 2024
1 parent d6ee08c commit 9b99ac6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ func readC2MPFromFile(filename string) {
convertModeFromString = make(map[string]ConvertMode)

// initialize all convertModes
convertModeFromString["none"] = convertmode.None{}
convertModeFromString["16bool2ascii"] = convertmode.SixteenBool2Ascii{}
convertModeFromString["pixelbin2ascii"] = convertmode.PixelBin2Ascii{}
convertModeFromString["bytecolor2colorcode"] = convertmode.ByteColor2ColorCode{}
convertModeFromString["mymode"] = convertmode.MyMode{}
// Dynamically create int and uint convertmode
convertModeFromString[convertmode.None{}.String()] = convertmode.None{}
convertModeFromString[convertmode.SixteenBool2Ascii{}.String()] = convertmode.SixteenBool2Ascii{}
convertModeFromString[convertmode.PixelBin2Ascii{}.String()] = convertmode.PixelBin2Ascii{}
convertModeFromString[convertmode.ByteColor2ColorCode{}.String()] = convertmode.ByteColor2ColorCode{}
convertModeFromString[convertmode.MyMode{}.String()] = convertmode.MyMode{}
// Dynamically create int and uint convertmodes
for _, bits := range []uint{8, 16, 32, 64} {
for _, instances := range []uint{1, 2, 4, 8} {
if bits*instances <= 64 {
Expand Down

0 comments on commit 9b99ac6

Please sign in to comment.