crawlserv++  [under development]
Application for crawling and analyzing textual content of websites.
Json.hpp File Reference
#include "Strings.hpp"
#include "../Main/Exception.hpp"
#include "../Struct/TextMap.hpp"
#include "../_extern/jsoncons/include/jsoncons/json.hpp"
#include <cstddef>
#include "../_extern/rapidjson/include/rapidjson/document.h"
#include "../_extern/rapidjson/include/rapidjson/error/en.h"
#include "../_extern/rapidjson/include/rapidjson/error/error.h"
#include "../_extern/rapidjson/include/rapidjson/stringbuffer.h"
#include "../_extern/rapidjson/include/rapidjson/writer.h"
#include <cctype>
#include <string>
#include <utility>
#include <vector>
Include dependency graph for Json.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  crawlservpp::Helper::Json::Exception
 Class for JSON exceptions. More...
 

Namespaces

 rapidjson
 
 crawlservpp::Helper::Json
 Namespace for global JSON helper functions.
 

Typedefs

typedef ::std::size_t rapidjson::SizeType
 

Constants

constexpr auto crawlservpp::Helper::Json::unicodeEscapeLength {6}
 The length of an escaped Unicode character in JSON code (including the '\u'). More...
 
constexpr auto crawlservpp::Helper::Json::unicodeEscapeDigit1 {2}
 The offset of the first Unicode character digit in JSON code (from the '\'). More...
 
constexpr auto crawlservpp::Helper::Json::unicodeEscapeDigit2 {3}
 The offset of the second Unicode character digit in JSON code (from the '\'). More...
 
constexpr auto crawlservpp::Helper::Json::unicodeEscapeDigit3 {4}
 The offset of the third Unicode character digit in JSON code (from the '\'). More...
 
constexpr auto crawlservpp::Helper::Json::unicodeEscapeDigit4 {5}
 The offset of the fourth Unicode character digit in JSON code (from the '\'). More...
 
constexpr auto crawlservpp::Helper::Json::numDebugChars {25}
 The number of characters to show before and behind a JSON error. More...
 

Stringification

std::string crawlservpp::Helper::Json::stringify (const std::vector< std::string > &vectorToStringify)
 Stringifies a vector of strings into one string containing a JSON array. More...
 
std::string crawlservpp::Helper::Json::stringify (const std::string &stringToStringify)
 Converts a string into a JSON array with the string as the only element inside it. More...
 
std::string crawlservpp::Helper::Json::stringify (const char *stringToStringify)
 Converts a string into a JSON array with the string as the only element inside it. More...
 
std::string crawlservpp::Helper::Json::stringify (const std::vector< std::vector< std::pair< std::string, std::string >>> &vectorToStringify)
 Converts a vector of vectors of string pairs into a JSON array with corresponding objects containing [key, value] pairs. More...
 
std::string crawlservpp::Helper::Json::stringify (const Struct::TextMap &textMapToStringify)
 Converts a text map into a JSON array with corresponding objects containing [key, value] pairs. More...
 
std::string crawlservpp::Helper::Json::stringify (const rapidjson::Value &value)
 Stringifies a JSON value using the RapidJSON. More...
 
std::string crawlservpp::Helper::Json::stringify (const jsoncons::json &json)
 Stringifies a JSON value using jsoncons. More...
 

Parsing

std::string crawlservpp::Helper::Json::cleanCopy (std::string_view json)
 Copies and cleans the given JSON code to prepare it for parsing. More...
 
rapidjson::Document crawlservpp::Helper::Json::parseRapid (std::string_view json)
 Parses JSON code using RapidJSON. More...
 
jsoncons::json crawlservpp::Helper::Json::parseCons (std::string_view json)
 Parses JSON code using jsoncons. More...
 
Struct::TextMap crawlservpp::Helper::Json::parseTextMapJson (std::string_view json)
 Parses JSON code using RapidJSON and converts it into a text map. More...
 
std::vector< std::pair< std::size_t, std::size_t > > crawlservpp::Helper::Json::parsePosLenPairsJson (std::string_view json)
 Parses JSON code using RapidJSON and converts it into [pos;length] pairs. More...
 

Memory

static void crawlservpp::Helper::Json::free (rapidjson::Document &target)
 Frees memory by swapping. More...