Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RYMLParser.h
Go to the documentation of this file.
1/*
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 */
12
13#ifndef RYML_PARSER_H
14#define RYML_PARSER_H
15
16#include "JSONInterface.h"
17#include "RConfigure.h"
18
19#include <list>
20#include <istream>
21#include <memory>
22
23class TRYMLTree : public JSONTree {
24protected:
25 class Impl;
26 std::unique_ptr<Impl> tree;
27
28public:
30 protected:
32 class Impl;
33 friend TRYMLTree;
34 std::unique_ptr<Impl> node;
35
36 public:
37 virtual void writeJSON(std::ostream &os) const override;
38 virtual void writeYML(std::ostream &) const override;
39
40 Node(TRYMLTree *t, const Impl &other);
41 Node(const Node &other);
42 virtual Node &operator<<(std::string const &s) override;
43 virtual Node &operator<<(int i) override;
44 virtual Node &operator<<(double d) override;
45 virtual const Node &operator>>(std::string &v) const override;
46 virtual Node &operator[](std::string const &k) override;
47 virtual Node &operator[](size_t pos) override;
48 virtual const Node &operator[](std::string const &k) const override;
49 virtual const Node &operator[](size_t pos) const override;
50 virtual bool is_container() const override;
51 virtual bool is_map() const override;
52 virtual bool is_seq() const override;
53 virtual void set_map() override;
54 virtual void set_seq() override;
55 virtual std::string key() const override;
56 virtual std::string val() const override;
57 virtual bool has_key() const override;
58 virtual bool has_val() const override;
59 virtual bool has_child(std::string const &) const override;
60 virtual Node &append_child() override;
61 virtual size_t num_children() const override;
62 virtual Node &child(size_t pos) override;
63 virtual const Node &child(size_t pos) const override;
64 };
65
66protected:
67 std::list<std::string> _strcache;
68 std::list<Node> _nodecache;
69
70public:
71 Node &incache(const Node &n);
72 const char *incache(const std::string &str);
73 void clearcache();
74
75public:
76 TRYMLTree();
77 ~TRYMLTree();
78 TRYMLTree(std::istream &is);
79 Node &rootnode();
80};
81
82#endif
#define d(i)
Definition RSha256.hxx:102
virtual bool is_map() const override
virtual bool has_key() const override
virtual Node & child(size_t pos) override
virtual const Node & operator>>(std::string &v) const override
virtual void writeYML(std::ostream &) const override
TRYMLTree * tree
Definition RYMLParser.h:31
virtual bool is_container() const override
virtual std::string key() const override
virtual Node & operator<<(std::string const &s) override
std::unique_ptr< Impl > node
Definition RYMLParser.h:34
virtual std::string val() const override
virtual Node & operator[](std::string const &k) override
virtual Node & append_child() override
virtual void set_seq() override
virtual bool is_seq() const override
virtual bool has_val() const override
virtual bool has_child(std::string const &) const override
virtual void writeJSON(std::ostream &os) const override
virtual size_t num_children() const override
virtual void set_map() override
std::unique_ptr< Impl > tree
Definition RYMLParser.h:26
std::list< std::string > _strcache
Definition RYMLParser.h:67
void clearcache()
Node & incache(const Node &n)
Node & rootnode()
std::list< Node > _nodecache
Definition RYMLParser.h:68
const Int_t n
Definition legend1.C:16