Logo ROOT  
Reference Guide
Go to the documentation of this file.
2 * Project: RooFit
3 * Authors:
4 * Carsten D. Burgard, DESY/ATLAS, Dec 2021
5 *
6 * Copyright (c) 2022, CERN
7 *
8 * Redistribution and use in source and binary forms,
9 * with or without modification, are permitted according to the terms
10 * listed in LICENSE (http://roofit.sourceforge.net/license.txt)
11 */
13#ifndef RYML_PARSER_H
14#define RYML_PARSER_H
18#include <RConfigure.h>
20#include <list>
21#include <istream>
22#include <memory>
26 class Impl;
27 std::unique_ptr<Impl> tree;
31 protected:
33 class Impl;
34 friend TRYMLTree;
35 std::unique_ptr<Impl> node;
37 public:
38 void writeJSON(std::ostream &os) const override;
39 void writeYML(std::ostream &) const override;
41 Node(TRYMLTree *t, const Impl &other);
42 Node(const Node &other);
43 Node &operator<<(std::string const &s) override;
44 Node &operator<<(int i) override;
45 Node &operator<<(double d) override;
46 const Node &operator>>(std::string &v) const override;
47 Node &operator[](std::string const &k) override;
48 Node &operator[](size_t pos) override;
49 const Node &operator[](std::string const &k) const override;
50 const Node &operator[](size_t pos) const override;
51 bool is_container() const override;
52 bool is_map() const override;
53 bool is_seq() const override;
54 void set_map() override;
55 void set_seq() override;
56 void clear() override;
57 std::string key() const override;
58 std::string val() const override;
59 bool has_key() const override;
60 bool has_val() const override;
61 bool has_child(std::string const &) const override;
62 Node &append_child() override;
63 size_t num_children() const override;
64 Node &child(size_t pos) override;
65 const Node &child(size_t pos) const override;
66 };
69 std::list<std::string> _strcache;
70 std::list<Node> _nodecache;
73 Node &incache(const Node &n);
74 const char *incache(const std::string &str);
75 void clearcache();
78 TRYMLTree();
79 ~TRYMLTree() override;
80 TRYMLTree(std::istream &is);
81 Node &rootnode() override;
#define d(i)
Definition: RSha256.hxx:102
bool is_map() const override
Definition: RYMLParser.cxx:221
bool has_key() const override
Definition: RYMLParser.cxx:256
friend TRYMLTree
Definition: RYMLParser.h:34
Node & child(size_t pos) override
Definition: RYMLParser.cxx:280
const Node & operator>>(std::string &v) const override
Definition: RYMLParser.cxx:184
void writeYML(std::ostream &) const override
Definition: RYMLParser.cxx:106
TRYMLTree * tree
Definition: RYMLParser.h:32
bool is_container() const override
Definition: RYMLParser.cxx:215
void clear() override
Definition: RYMLParser.cxx:124
std::string key() const override
Definition: RYMLParser.cxx:233
Node & operator<<(std::string const &s) override
Definition: RYMLParser.cxx:163
std::unique_ptr< Impl > node
Definition: RYMLParser.h:35
std::string val() const override
Definition: RYMLParser.cxx:241
Node & operator[](std::string const &k) override
Definition: RYMLParser.cxx:191
Node & append_child() override
Definition: RYMLParser.cxx:250
void set_seq() override
Definition: RYMLParser.cxx:118
bool is_seq() const override
Definition: RYMLParser.cxx:227
Node(TRYMLTree *t, const Impl &other)
Definition: RYMLParser.cxx:147
bool has_val() const override
Definition: RYMLParser.cxx:262
bool has_child(std::string const &) const override
Definition: RYMLParser.cxx:268
void writeJSON(std::ostream &os) const override
Definition: RYMLParser.cxx:100
size_t num_children() const override
Definition: RYMLParser.cxx:274
void set_map() override
Definition: RYMLParser.cxx:112
std::unique_ptr< Impl > tree
Definition: RYMLParser.h:27
std::list< std::string > _strcache
Definition: RYMLParser.h:69
~TRYMLTree() override
Definition: RYMLParser.cxx:139
void clearcache()
Definition: RYMLParser.cxx:329
Node & incache(const Node &n)
Definition: RYMLParser.cxx:322
Node & rootnode() override
Definition: RYMLParser.cxx:157
std::list< Node > _nodecache
Definition: RYMLParser.h:70
const Int_t n
Definition: legend1.C:16
static constexpr double s