-
Notifications
You must be signed in to change notification settings - Fork 0
/
builder.h
45 lines (36 loc) · 1.36 KB
/
builder.h
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
#ifndef UCIF_BUILDER_H
#define UCIF_BUILDER_H
#include <string>
#include <vector>
namespace ucif {
/*! The mininum functions required for an array interface.
Arrays are used for storing lists of loop headers and looped data items,
which are passed to the builders.
Arrays are also used to store lists of any lexer and parser error messages
that are encountered.
*/
struct array_wrapper_base
{
virtual ~array_wrapper_base() {}
virtual void push_back(std::string const&) = 0;
virtual std::string operator[](unsigned const&) const = 0;
virtual unsigned size() const = 0;
};
/*! Builders should inherit from builder_base and provide the functions
defined below.
See for example py_builder in iotbx/cif/boost_python/cif_ext.pp which in
turn calls the Python cif_model_builder in iotbx/cif/builders.py.
*/
struct builder_base
{
virtual ~builder_base() {}
virtual void start_save_frame(std::string const& save_frame_heading) = 0;
virtual void end_save_frame() = 0;
virtual void add_data_item(std::string const& tag, std::string const& value) = 0;
virtual void add_loop(array_wrapper_base const& loop_headers,
std::vector<array_wrapper_base*> const& values) = 0;
virtual void add_data_block(std::string const& data_block_heading) = 0;
virtual array_wrapper_base* new_array() = 0;
};
} // namespace ucif
#endif // GUARD