From df3bbe12423bef6f9a04d53966ec9394de07edee Mon Sep 17 00:00:00 2001 From: Kevin Chabowski Date: Tue, 6 Aug 2013 22:23:23 +0200 Subject: Moved tag types to own file. --- nbt/nbt.go | 48 ------------------------------------------------ nbt/tagtypes.go | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 48 deletions(-) create mode 100644 nbt/tagtypes.go (limited to 'nbt') diff --git a/nbt/nbt.go b/nbt/nbt.go index d66705d..26bace5 100644 --- a/nbt/nbt.go +++ b/nbt/nbt.go @@ -6,54 +6,6 @@ import ( "io" ) -const ( - TAG_End = iota - TAG_Byte - TAG_Short - TAG_Int - TAG_Long - TAG_Float - TAG_Double - TAG_Byte_Array - TAG_String - TAG_List - TAG_Compound - TAG_Int_Array -) - -type TagType byte - -func (tt TagType) String() string { - switch tt { - case TAG_End: - return "TAG_End" - case TAG_Byte: - return "TAG_Byte" - case TAG_Short: - return "TAG_Short" - case TAG_Int: - return "TAG_Int" - case TAG_Long: - return "TAG_Long" - case TAG_Float: - return "TAG_Float" - case TAG_Double: - return "TAG_Double" - case TAG_Byte_Array: - return "TAG_Byte_Array" - case TAG_String: - return "TAG_String" - case TAG_List: - return "TAG_List" - case TAG_Compound: - return "TAG_Compound" - case TAG_Int_Array: - return "TAG_Int_Array" - default: - return "TAG_Unknown" - } -} - type Tag struct { Type TagType Payload interface{} diff --git a/nbt/tagtypes.go b/nbt/tagtypes.go new file mode 100644 index 0000000..161e64a --- /dev/null +++ b/nbt/tagtypes.go @@ -0,0 +1,51 @@ +package nbt + +// Valid TagType values. +const ( + TAG_End = iota + TAG_Byte + TAG_Short + TAG_Int + TAG_Long + TAG_Float + TAG_Double + TAG_Byte_Array + TAG_String + TAG_List + TAG_Compound + TAG_Int_Array +) + +// TagType describes the type of a NBT tag. Valid values are the TAG_* constants. +type TagType byte + +func (tt TagType) String() string { + switch tt { + case TAG_End: + return "TAG_End" + case TAG_Byte: + return "TAG_Byte" + case TAG_Short: + return "TAG_Short" + case TAG_Int: + return "TAG_Int" + case TAG_Long: + return "TAG_Long" + case TAG_Float: + return "TAG_Float" + case TAG_Double: + return "TAG_Double" + case TAG_Byte_Array: + return "TAG_Byte_Array" + case TAG_String: + return "TAG_String" + case TAG_List: + return "TAG_List" + case TAG_Compound: + return "TAG_Compound" + case TAG_Int_Array: + return "TAG_Int_Array" + default: + return "TAG_Unknown" + } +} -- cgit v1.2.3-70-g09d2