Scarab
v1.5.2
Project 8 C++ Utility Library
Main Page
Namespaces
Classes
Files
File List
File Members
library
param
param_codec.hh
Go to the documentation of this file.
1
/*
2
* param_codec.hh
3
*
4
* Created on: Aug 10, 2016
5
* Author: obla999
6
*/
7
8
#ifndef SCARAB_PARAM_CODEC_HH_
9
#define SCARAB_PARAM_CODEC_HH_
10
11
#include "
scarab_api.hh
"
12
13
#include "
factory.hh
"
14
15
#include <string>
16
17
namespace
scarab
18
{
19
class
param;
20
class
param_node;
21
22
#define REGISTER_PARAM_INPUT_CODEC(codec_class, encoding) \
23
static registrar< param_input_codec, codec_class > s_param_input_codec##codec_class##_registrar( encoding );
24
25
class
SCARAB_API
param_input_codec
26
{
27
public
:
28
param_input_codec
();
29
virtual
~
param_input_codec
();
30
31
virtual
param
* read_file(
const
std::string& a_filename,
const
param_node
* a_options =
nullptr
) = 0;
32
virtual
param
* read_string(
const
std::string& a_string,
const
param_node
* a_options =
nullptr
) = 0;
33
};
34
35
36
class
SCARAB_API
param_output_codec
37
{
38
public
:
39
param_output_codec
();
40
virtual
~
param_output_codec
();
41
42
virtual
bool
write_file(
const
param
& a_param,
const
std::string& a_filename,
const
param_node
* a_options =
nullptr
) = 0;
43
virtual
bool
write_string(
const
param
& a_param, std::string& a_string,
const
param_node
* a_options =
nullptr
) = 0;
44
};
45
46
#define REGISTER_PARAM_OUTPUT_CODEC(codec_class, encoding) \
47
static registrar< param_output_codec, codec_class > s_param_output_codec##codec_class##_registrar( encoding );
48
49
50
class
SCARAB_API
param_translator
51
{
52
public
:
53
param_translator
();
54
~
param_translator
();
55
56
public
:
57
param
* read_file(
const
std::string& a_filename,
const
param_node
* a_options =
nullptr
);
58
param
* read_string(
const
std::string& a_string,
const
param_node
* a_options =
nullptr
);
59
60
public
:
61
bool
write_file(
const
param
& a_param,
const
std::string& a_filename,
const
param_node
* a_options =
nullptr
);
62
bool
write_string(
const
param
& a_param, std::string& a_string,
const
param_node
* a_options =
nullptr
);
63
};
64
65
66
67
}
/* namespace scarab */
68
69
#endif
/* SCARAB_PARAM_CODEC_HH_ */
SCARAB_API
#define SCARAB_API
Definition:
scarab_api.hh:24
scarab::param_translator
Definition:
param_codec.hh:50
scarab::param_output_codec
Definition:
param_codec.hh:36
scarab
Definition:
authentication.cc:28
scarab_api.hh
scarab::param_node
Definition:
param.hh:300
scarab::param_input_codec
Definition:
param_codec.hh:25
scarab::param
Definition:
param.hh:30
factory.hh
Generated by
1.8.11