8 #define SCARAB_API_EXPORTS 16 LOGGER( slog,
"param_codec" );
49 std::string t_encoding = a_options.
get_value(
"encoding",
"" );
50 if( t_encoding.empty() )
53 t_encoding = t_path.extension().string().substr( 1 );
57 if( t_codec ==
nullptr )
59 LERROR( slog,
"Unable to find input codec for encoding <" << t_encoding <<
">");
63 return t_codec->
read_file( a_filename, a_options );
68 std::string t_encoding = a_options.
get_value(
"encoding",
"" );
69 if( t_encoding.empty() )
71 LERROR( slog,
"Encoding-type option must be provided");
75 return read_string( a_string, t_encoding, a_options );
81 if( t_codec ==
nullptr )
83 LERROR( slog,
"Unable to find input codec for encoding <" << a_encoding <<
">");
92 std::string t_encoding = a_options.
get_value(
"encoding",
"" );
93 if( t_encoding.empty() )
96 t_encoding = t_path.extension().string().substr( 1 );
100 if( t_codec ==
nullptr )
102 LERROR( slog,
"Unable to find output codec for encoding <" << t_encoding <<
">");
106 return t_codec->
write_file( a_param, a_filename, a_options );
111 std::string t_encoding = a_options.
get_value(
"encoding",
"" );
112 if( t_encoding.empty() )
114 LERROR( slog,
"Encoding-type option must be provided");
118 return write_string( a_param, a_string, t_encoding, a_options );
124 if( t_codec ==
nullptr )
126 LERROR( slog,
"Unable to find output codec for encoding <" << a_encoding <<
">");
130 return t_codec->
write_string( a_param, a_string, a_options );
param_ptr_t read_string(const std::string &a_string, const param_node &a_options=param_node())
virtual bool write_string(const param &a_param, std::string &a_string, const param_node &a_options=param_node())=0
path expand_path(const string &a_path)
XBaseType * create(const XIndexType &a_index, XArgs ... args)
static indexed_factory< XIndexType, XBaseType, XArgs... > * get_instance()
virtual ~param_output_codec()
std::string get_value(const std::string &a_name, const std::string &a_default) const
Contains the logger class and macros, based on Kasper's KLogger class.
bool write_file(const param &a_param, const std::string &a_filename, const param_node &a_options=param_node())
virtual bool write_file(const param &a_param, const std::string &a_filename, const param_node &a_options=param_node())=0
param_ptr_t read_file(const std::string &a_filename, const param_node &a_options=param_node())
LOGGER(slog, "param_codec")
std::unique_ptr< param > param_ptr_t
bool write_string(const param &a_param, std::string &a_string, const param_node &a_options=param_node())