blob: 9b88dc9bca9a2d03620ea63ba8cbfa6804c2d01d (
plain) (
blame)
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/stllike/string.h>
#include <stdint.h>
namespace vespalib {
/**
* This is an abstract class used to visit structured objects. It
* contains a basic interface that is intended to be overridden by
* subclasses. As an extension to this class, the visit.hpp file
* contains various versions of the visit method that maps visitation
* of various types into invocations of the basic interface defined by
* this class.
**/
class ObjectVisitor
{
public:
/**
* Open a (sub-)structure
*
* @param name name of structure
* @param type type of structure
**/
virtual void openStruct(const vespalib::string &name, const vespalib::string &type) = 0;
/**
* Close a (sub-)structure
**/
virtual void closeStruct() = 0;
/**
* Visit a boolean value
*
* @param name variable name
* @param value variable value
**/
virtual void visitBool(const vespalib::string &name, bool value) = 0;
/**
* Visit an integer value
*
* @param name variable name
* @param value variable value
**/
virtual void visitInt(const vespalib::string &name, int64_t value) = 0;
/**
* Visit a floating-point value
*
* @param name variable name
* @param value variable value
**/
virtual void visitFloat(const vespalib::string &name, double value) = 0;
/**
* Visit a string value
*
* @param name variable name
* @param value variable value
**/
virtual void visitString(const vespalib::string &name, const vespalib::string &value) = 0;
/**
* Visit method used to indicate that an optional substructure is
* not present.
*
* @param name variable name
**/
virtual void visitNull(const vespalib::string &name) = 0;
/**
* Visit method invoked by the default implementation of member
* visitation to signal that member visitation is not yet implemented.
*
* @param name variable name
* @param value variable value
**/
virtual void visitNotImplemented() = 0;
/**
* empty
**/
virtual ~ObjectVisitor();
};
} // namespace vespalib
|