/* * MIT License * * Copyright (c) 2019 Alexey Edelev * * This file is part of qtprotobuf project https://git.semlanik.org/semlanik/qtprotobuf * * Permission is hereby granted, free of charge, to any person obtaining a copy of this * software and associated documentation files (the "Software"), to deal in the Software * without restriction, including without limitation the rights to use, copy, modify, * merge, publish, distribute, sublicense, and/or sell copies of the Software, and * to permit persons to whom the Software is furnished to do so, subject to the following * conditions: * * The above copyright notice and this permission notice shall be included in all copies * or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR * PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE * FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ #pragma once #include #include namespace qtprotobuf { enum WireTypes { UnknownWireType = -1, Varint = 0, Fixed64 = 1, LengthDelimited = 2, Fixed32 = 5 }; constexpr int NotUsedFieldIndex = -1; template struct transparent { transparent(T t = T()) : _t(t){} T _t; operator T&(){ return _t; } operator T() const { return _t; } }; using int32 = int32_t; using int64 = int64_t; using uint32 = uint32_t; using uint64 = uint64_t; using sint32 = transparent; using sint64 = transparent; using fixed32 = transparent; using fixed64 = transparent; using sfixed32 = transparent; using sfixed64 = transparent; using int32List = QList; using int64List = QList; using uint32List = QList; using uint64List = QList; using sint32List = QList; using sint64List = QList; using fixed32List = QList; using fixed64List = QList; using sfixed32List = QList; using sfixed64List = QList; using FloatList = QList; using DoubleList = QList; } Q_DECLARE_METATYPE(qtprotobuf::int32) Q_DECLARE_METATYPE(qtprotobuf::int64) Q_DECLARE_METATYPE(qtprotobuf::sint32) Q_DECLARE_METATYPE(qtprotobuf::sint64) Q_DECLARE_METATYPE(qtprotobuf::uint32) Q_DECLARE_METATYPE(qtprotobuf::uint64) Q_DECLARE_METATYPE(qtprotobuf::fixed32) Q_DECLARE_METATYPE(qtprotobuf::fixed64) Q_DECLARE_METATYPE(qtprotobuf::sfixed32) Q_DECLARE_METATYPE(qtprotobuf::sfixed64) Q_DECLARE_METATYPE(qtprotobuf::int32List) Q_DECLARE_METATYPE(qtprotobuf::int64List) Q_DECLARE_METATYPE(qtprotobuf::sint32List) Q_DECLARE_METATYPE(qtprotobuf::sint64List) Q_DECLARE_METATYPE(qtprotobuf::uint32List) Q_DECLARE_METATYPE(qtprotobuf::uint64List) Q_DECLARE_METATYPE(qtprotobuf::fixed32List) Q_DECLARE_METATYPE(qtprotobuf::fixed64List) Q_DECLARE_METATYPE(qtprotobuf::sfixed32List) Q_DECLARE_METATYPE(qtprotobuf::sfixed64List) Q_DECLARE_METATYPE(qtprotobuf::FloatList) Q_DECLARE_METATYPE(qtprotobuf::DoubleList)