KItinerary::ProtobufStreamReader

Search for usage in LXR

KItinerary::ProtobufStreamReader Class Reference

#include <protobufstreamreader.h>

Public Types

enum  WireType {
  VARINT , I64 , LEN , SGROUP ,
  EGROUP , I32
}
 

Public Member Functions

 ProtobufStreamReader (const QByteArray &data)
 
 ProtobufStreamReader (std::string_view data)
 
Q_INVOKABLE bool atEnd () const
 
Q_INVOKABLE quint64 fieldNumber ()
 
std::string_view readLengthDelimitedRecord ()
 
Q_INVOKABLE QString readString ()
 
Q_INVOKABLE KItinerary::ProtobufStreamReader readSubMessage ()
 
Q_INVOKABLE quint64 readVarintField ()
 
Q_INVOKABLE void skip ()
 
Q_INVOKABLE WireType wireType ()
 

Detailed Description

Protocol Buffers stream reader.

For use on protobuf data for which the full format definition is unknown.

See also
https://protobuf.dev/

Definition at line 22 of file protobufstreamreader.h.

Member Enumeration Documentation

◆ WireType

enum KItinerary::ProtobufStreamReader::WireType

Definition at line 36 of file protobufstreamreader.h.

Constructor & Destructor Documentation

◆ ProtobufStreamReader() [1/2]

ProtobufStreamReader::ProtobufStreamReader ( std::string_view data)
explicit

Definition at line 14 of file protobufstreamreader.cpp.

◆ ProtobufStreamReader() [2/2]

ProtobufStreamReader::ProtobufStreamReader ( const QByteArray & data)
explicit

Definition at line 19 of file protobufstreamreader.cpp.

Member Function Documentation

◆ atEnd()

bool ProtobufStreamReader::atEnd ( ) const

Returns true when having reached the end of the stream.

Definition at line 93 of file protobufstreamreader.cpp.

◆ fieldNumber()

quint64 ProtobufStreamReader::fieldNumber ( )

Returns the number of the current field.

Assumes the cursor is on the beginning of a field. The cursor does not advance.

Definition at line 51 of file protobufstreamreader.cpp.

◆ readLengthDelimitedRecord()

std::string_view ProtobufStreamReader::readLengthDelimitedRecord ( )

Reads a field of type LEN.

This assumes the cursor is placed at the beginning of a field with wire type LEN. The cursor is advanced to after the field.

Definition at line 67 of file protobufstreamreader.cpp.

◆ readString()

QString ProtobufStreamReader::readString ( )

Reads a string.

This assumes the cursor is placed at the beginning of a field with wire type LEN containing a string. The cursor is advanced to after the field.

Definition at line 82 of file protobufstreamreader.cpp.

◆ readSubMessage()

ProtobufStreamReader ProtobufStreamReader::readSubMessage ( )

Reads a nested message.

This assumes the cursor is placed at the beginning of a field with wire type LEN containing a sub-message. The cursor is advanced to after the field.

Definition at line 88 of file protobufstreamreader.cpp.

◆ readVarintField()

quint64 ProtobufStreamReader::readVarintField ( )

Read a field of type VARINT.

This assumes the cursor is placed at the beginning of a field with wire type VARINT. The cursor is advanced to after the field.

Definition at line 61 of file protobufstreamreader.cpp.

◆ skip()

void ProtobufStreamReader::skip ( )

Skips over the next field in the stream.

Definition at line 98 of file protobufstreamreader.cpp.

◆ wireType()

ProtobufStreamReader::WireType ProtobufStreamReader::wireType ( )

Returns the wire type of the current field.

Assumes the cursor is on the beginning of a field. The cursor does not advance.

Definition at line 56 of file protobufstreamreader.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:14:49 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.