PhoenixProtocolBuffer  1.0.1
Set of tools to decode offset from protocol buffer
Loading...
Searching...
No Matches
phoenix_varint.h File Reference
#include <iostream>
#include <vector>
#include <cstdint>
+ Include dependency graph for phoenix_varint.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

size_t phoenix_readVarInt (char *&iter)
 Reads and print a varint from protocol buffer.
 
void phoenix_skipVarInt (char *&iter)
 Skips a varint.
 

Function Documentation

◆ phoenix_readVarInt()

size_t phoenix_readVarInt ( char *& iter)

Reads and print a varint from protocol buffer.

Parameters
[out]iter: position on the current message to be used
Returns
value of the varint

Definition at line 29 of file phoenix_varint.cpp.

29 {
30 std::vector<uint8_t> vecBitSize;
31 bool isExtraByte(false);
32 do{
33 char packedSizeVal = *iter;
34 uint8_t val = packedSizeVal & 127;
35 vecBitSize.push_back(val); //Get the first 7 bytes
36 isExtraByte = packedSizeVal & 128; //Get only the strong bit
37 iter += 1lu;
38 }while(isExtraByte);
39 return phoenix_varIntToValue(vecBitSize);
40}
size_t phoenix_varIntToValue(const std::vector< uint8_t > &vecBitSize)
Convert a varint into a value.

References phoenix_varIntToValue().

Referenced by FieldParser::loadComputeFieldOffset(), FieldParser::loadComputeFieldOffsetArray(), FieldParser::loadFieldFromOffset(), phoenix_fieldPrint(), phoenix_fieldPrintArray(), and phoenix_fieldSkip().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ phoenix_skipVarInt()

void phoenix_skipVarInt ( char *& iter)

Skips a varint.

Parameters
[out]iter: iterator over the message to be used

Definition at line 45 of file phoenix_varint.cpp.

45 {
46 bool isExtraByte(false);
47 do{
48 char packedSizeVal = *iter;
49 isExtraByte = packedSizeVal & 128; //Get only the strong bit
50 iter += 1lu;
51 }while(isExtraByte);
52}

Referenced by phoenix_fieldSkip().

+ Here is the caller graph for this function: