From 4d7b1da29e0957ac798ee8e6da8288cbd4ae5c79 Mon Sep 17 00:00:00 2001 From: LaG1924 <12997935+LaG1924@users.noreply.github.com> Date: Thu, 18 May 2017 19:03:05 +0500 Subject: 2017-05-18 --- FieldParser.cpp | 106 -------------------------------------------------------- 1 file changed, 106 deletions(-) delete mode 100644 FieldParser.cpp (limited to 'FieldParser.cpp') diff --git a/FieldParser.cpp b/FieldParser.cpp deleted file mode 100644 index 500a973..0000000 --- a/FieldParser.cpp +++ /dev/null @@ -1,106 +0,0 @@ -#include "FieldParser.hpp" - -Field FieldParser::Parse(FieldType type, byte *data, size_t len) { - switch (type) { - case VarInt: - return ParseVarInt(data, len); - case Boolean: - return ParseBool(data, len); - case String: - return ParseString(data, len); - case Long: - return ParseLong(data, len); - case Int: - return ParseInt(data, len); - case UnsignedByte: - return ParseUByte(data, len); - case Byte8_t: - return ParseByte(data, len); - case Float: - return ParseFloat(data, len); - case Position: - return ParsePosition(data, len); - case Double: - return ParseDouble(data, len); - case ByteArray: - return ParseByteArray(data, len); - default: - throw 105; - } -} - -Field FieldParser::ParseString(byte *data, size_t len) { - Field fLen = ParseVarInt(data, 0); - Field f; - f.SetRaw(data, fLen.GetLength() + fLen.GetVarInt(), String); - return f; -} - -Field FieldParser::ParseBool(byte *data, size_t len) { - Field f; - f.SetRaw(data,1,Boolean); - return f; -} - -Field FieldParser::ParseVarInt(byte *data, size_t len) { - if (len != 0) { - Field f; - f.SetRaw(data, len, VarInt); - return f; - } - int val = VarIntRead(data, len); - Field f; - f.SetVarInt(val); - return f; -} - -Field FieldParser::ParseLong(byte *data, size_t len) { - Field f; - f.SetRaw(data, 8, Long); - return f; -} - -Field FieldParser::ParseInt(byte *data, size_t len) { - Field f; - f.SetRaw(data, 4, Int); - return f; -} - -Field FieldParser::ParseUByte(byte *data, size_t len) { - Field f; - f.SetRaw(data, 1, UnsignedByte); - return f; -} - -Field FieldParser::ParseByte(byte *data, size_t len) { - Field f; - f.SetRaw(data, 1, Byte8_t); - return f; -} - -Field FieldParser::ParseFloat(byte *data, size_t len) { - Field f; - f.SetRaw(data, 4, Float); - return f; -} - -Field FieldParser::ParsePosition(byte *data, size_t len) { - Field f; - f.SetRaw(data, 8, Position); - return f; -} - -Field FieldParser::ParseDouble(byte *data, size_t len) { - Field f; - f.SetRaw(data, 8, Double); - return f; -} - -Field FieldParser::ParseByteArray(byte *data, size_t len) { - if (len == 0) - throw 119; - Field f; - f.SetRaw(data, len, Byte8_t); - //f.SetRaw(data, len, ByteArray); - return f; -} -- cgit v1.2.3