Furrent
Classes | Typedefs | Enumerations | Functions
fur::bencode Namespace Reference

Contains the structure for decoding and encoding bencode data. More...

Classes

class  BencodeDict
 
class  BencodeInt
 
class  BencodeList
 
class  BencodeParser
 
class  BencodeString
 
class  BencodeValue
 

Typedefs

using BencodeResult = util::Result< std::unique_ptr< BencodeValue >, BencodeParserError >
 Result of a parsing operation. More...
 

Enumerations

enum  BencodeParserError {
  BencodeParserError::InvalidString, BencodeParserError::IntFormat, BencodeParserError::IntValue, BencodeParserError::StringFormat,
  BencodeParserError::ListFormat, BencodeParserError::DictFormat, BencodeParserError::DictKey, BencodeParserError::DictKeyOrder
}
 
enum  BencodeType { BencodeType::Integer, BencodeType::String, BencodeType::List, BencodeType::Dict }
 Enumeration for the different types of bencode data. More...
 

Functions

std::string error_to_string (BencodeParserError error)
 Function to translate a BencodeParserError into a string. More...
 

Detailed Description

Contains the structure for decoding and encoding bencode data.

Typedef Documentation

◆ BencodeResult

Result of a parsing operation.

Enumeration Type Documentation

◆ BencodeParserError

Enumerator
InvalidString 

The bencoded string is not valid, the most general error that can occur typically where the string is not well formed

IntFormat 

A integer was not in the form ['i', 'number', 'e'].

IntValue 

The integer was not a valid integer.

StringFormat 

A string was not in the form ['length', ':', 'string'].

ListFormat 

A list was not in the form ['l', 'bencode_value', ... , 'e'].

DictFormat 

A dictionary was not in the form ['d', 'bencode_value', ... , 'e'].

DictKey 

A dictionary key was not a string.

DictKeyOrder 

The keys of the dictionary were not in lexicographical order.

◆ BencodeType

Enumeration for the different types of bencode data.

Enumerator
Integer 
String 
List 
Dict 

Function Documentation

◆ error_to_string()

std::string fur::bencode::error_to_string ( const BencodeParserError  error)

Function to translate a BencodeParserError into a string.