Size: 1296 bytes.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// cs/net/json/parsers.hh
#ifndef CS_NET_JSON_PARSERS_HH
#define CS_NET_JSON_PARSERS_HH

#include <cmath>
#include <cstdint>
#include <iostream>
#include <map>
#include <memory>
#include <ostream>
#include <sstream>
#include <string>
#include <variant>
#include <vector>

#include "cs/net/json/object.hh"
#include "cs/result.hh"

namespace cs::net::json::parsers {

cs::Result operator>>(std::string str, Object* object);

cs::ResultOr<Object> ParseObject(std::string str,
                                 unsigned int* cursor);

cs::ResultOr<Object> ParseObject(std::string str);

cs::ResultOr<std::map<std::string, Object>> ParseMap(
    std::string str, unsigned int* cursor);

cs::ResultOr<std::string> ParseString(std::string str);

cs::ResultOr<std::string> ParseString(std::string str,
                                      unsigned int* cursor);

cs::ResultOr<bool> ParseBoolean(std::string str,
                                unsigned int* cursor);

cs::ResultOr<std::variant<float, int>> ParseNumber(
    std::string str);

cs::ResultOr<std::variant<float, int>> ParseNumber(
    std::string str, unsigned int* cursor);

cs::ResultOr<std::vector<Object>> ParseArray(
    std::string str, unsigned int* cursor);

}  // namespace cs::net::json::parsers

#endif  // CS_NET_JSON_PARSERS_HH
v0 (commit) © 2025 @p13i.io | Load balancer proxied to: cs-code-viewer-2:8080 in 4ms.