| 18 | using EnumValue = uint32_t; |
| 19 | |
| 20 | class Field { |
| 21 | public: |
| 22 | enum class InternalType : uint8_t { |
| 23 | Unset, |
| 24 | Varint, |
| 25 | Fixed64, |
| 26 | Fixed32, |
| 27 | Raw, |
| 28 | Ref, |
| 29 | }; |
| 30 | |
| 31 | struct Raw { |
| 32 | const Byte* data; |
| 33 | size_t length; |
| 34 | |
| 35 | constexpr Raw(const Byte* data, size_t length) : data(data), length(length) {} |
| 36 | |
| 37 | std::string_view toStringView() const; |
| 38 | }; |
| 39 | |
| 40 | Field(); |
| 41 | ~Field(); |
| 42 | |
| 43 | Field(const Field& other); |
| 44 | Field(Field&& other) noexcept; |
| 45 | |
| 46 | Field& operator=(const Field& other); |
| 47 | Field& operator=(Field&& other) noexcept; |
| 48 | |
| 49 | Field clone() const; |
| 50 | |
| 51 | size_t byteSize(FieldNumber fieldNumber, bool writeEvenIfEmpty, bool writeEvenIfEmptyForNestedFields) const; |
| 52 | |
| 53 | Byte* write(FieldNumber fieldNumber, |
| 54 | bool writeEvenIfEmpty, |
| 55 | bool writeEvenIfEmptyForNestedFields, |
| 56 | Byte* bufferStart, |
| 57 | Byte* bufferEnd) const; |
| 58 | |
| 59 | int32_t getInt32() const; |
| 60 | void setInt32(int32_t v); |
| 61 | |
| 62 | int32_t getSInt32() const; |
| 63 | void setSInt32(int32_t v); |
| 64 | |
| 65 | int64_t getInt64() const; |
| 66 | void setInt64(int64_t v); |
| 67 | |
| 68 | int64_t getSInt64() const; |
| 69 | void setSInt64(int64_t v); |
| 70 | |
| 71 | uint32_t getUInt32() const; |
| 72 | void setUInt32(uint32_t v); |
| 73 | |
| 74 | uint64_t getUInt64() const; |
| 75 | void setUInt64(uint64_t v); |
| 76 | |
| 77 | uint64_t getFixed64() const; |