|
crawlserv++
[under development]
Application for crawling and analyzing textual content of websites.
|
Simple Python pickle dictionary. More...
#include <PickleDict.hpp>
Classes | |
| class | Exception |
| Class for Python pickle exceptions. More... | |
Construction | |
| PickleDict ()=default | |
| Default constructor. More... | |
| PickleDict (const Bytes &data) | |
| Constructor reading the bytes of a Python pickle. More... | |
Getters | |
| std::optional< std::int64_t > | getNumber (const std::string &key) const |
| Gets a number from the dictionary, if avaible. More... | |
| std::optional< double > | getFloat (const std::string &key) const |
| Gets a floating-point number from the dictionary, if avaible. More... | |
| std::optional< std::string > | getString (const std::string &key) const |
| Gets a string from the dictionary, if avaible. More... | |
Setters | |
| void | setNumber (const std::string &key, std::int64_t value) |
| Adds or overwrite a number in the dictionary. More... | |
| void | setFloat (const std::string &key, double value) |
| Adds or overwrites a floating-point number in the dictionary. More... | |
| void | setString (const std::string &key, const std::string &value) |
| Add or overwrites a string in the dictionary. More... | |
Reading and Writing | |
| void | readFrom (const Bytes &data) |
| Creates a simple dictionary from Python pickle data. More... | |
| void | writeTo (Bytes &dataTo) const |
| Writes dictionary to Python pickle data. More... | |
Simple Python pickle dictionary.
Only pickles with protocol version 4 or higher are supported.
SHORT_BINSTRING and SHORT_BINUNICODE, i.e. strings up to a length of 255 are supported as key names. They need to be separated by MEMOIZE from their respective values in the Python pickle.
|
default |
Default constructor.
|
inlineexplicit |
Constructor reading the bytes of a Python pickle.
| data | The bytes contained in a pickle. |
References readFrom().
|
inline |
Gets a floating-point number from the dictionary, if avaible.
| key | The key of the dictionary entry containing the floating-point number. |
Referenced by crawlservpp::Data::TopicModel::clear().
|
inline |
Gets a number from the dictionary, if avaible.
| key | The key of the dictionary entry containing the number. |
Referenced by crawlservpp::Data::TopicModel::clear().
|
inline |
Gets a string from the dictionary, if avaible.
| key | The key of the dictionary entry containing the string. |
Referenced by crawlservpp::Data::TopicModel::clear(), and writeTo().
|
inline |
Creates a simple dictionary from Python pickle data.
Only Python pickles with protocol version 4 or higher are supported.
| data | Constant reference to a vector containing the bytes of the Python pickle. |
| PickleDict::Exception | if the data could not be read correctly. |
SHORT_BINSTRING and SHORT_BINUNICODE, i.e. strings up to a length of 255 are supported as key names. They need to be separated by MEMOIZE from their respective values in the Python pickle. Referenced by PickleDict().
|
inline |
Adds or overwrites a floating-point number in the dictionary.
| key | The key of the value. |
| value | The corresponding value. |
Referenced by crawlservpp::Data::TopicModel::clear(), and writeTo().
|
inline |
Adds or overwrite a number in the dictionary.
| key | The key of the value. |
| value | The corresponding value. |
Referenced by crawlservpp::Data::TopicModel::clear(), and writeTo().
|
inline |
Add or overwrites a string in the dictionary.
| key | The key of the value. |
| value | The corresponding value. |
Referenced by crawlservpp::Data::TopicModel::clear(), and writeTo().
|
inline |
Writes dictionary to Python pickle data.
Python pickle protocol version 4 will be used and the data will be written to one single frame.
| dataTo | Reference to a vector which will contain the bytes of the data after writing. The vector will be cleared before writing begins (although no memory will be freed). |
References crawlservpp::Helper::Container::append(), crawlservpp::Helper::Bytes::bytesToDouble(), crawlservpp::Helper::Bytes::bytesToInt16(), crawlservpp::Helper::Bytes::bytesToInt32(), crawlservpp::Helper::Bytes::bytesToInt64(), crawlservpp::Helper::Bytes::bytesToUInt16(), crawlservpp::Helper::Bytes::bytesToUInt32(), crawlservpp::Helper::Bytes::bytesToUInt64(), crawlservpp::Helper::Bytes::byteToHexString(), crawlservpp::Helper::Bytes::charToString(), crawlservpp::Helper::Bytes::doubleToBytes(), getString(), crawlservpp::Helper::Bytes::int16ToBytes(), crawlservpp::Helper::Bytes::int32ToBytes(), crawlservpp::Helper::Bytes::int64ToBytes(), crawlservpp::Helper::Utf8::length(), crawlservpp::Helper::Container::moveInto(), crawlservpp::Data::pickleBase, crawlservpp::Data::pickleEightBytes, crawlservpp::Data::pickleFourBytes, crawlservpp::Data::pickleHeadSize, crawlservpp::Data::pickleMaxUFourByteNumber, crawlservpp::Data::pickleMaxUOneByteNumber, crawlservpp::Data::pickleMaxUTwoByteNumber, crawlservpp::Data::pickleMinFrameSize, crawlservpp::Data::pickleMinSize, crawlservpp::Data::pickleNineBytes, crawlservpp::Data::pickleOneByte, crawlservpp::Data::pickleProtoByte, crawlservpp::Data::pickleProtocolVersion, crawlservpp::Data::pickleTwoBytes, crawlservpp::Data::pickleVersionByte, setFloat(), setNumber(), setString(), crawlservpp::Helper::Bytes::uInt16ToBytes(), crawlservpp::Helper::Bytes::uInt32ToBytes(), and crawlservpp::Helper::Bytes::uInt64ToBytes().
Referenced by crawlservpp::Data::TopicModel::clear().