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().native().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");
76 if( t_codec ==
nullptr )
78 LERROR( slog,
"Unable to find input codec for encoding <" << t_encoding <<
">");
87 std::string t_encoding = a_options.
get_value(
"encoding",
"" );
88 if( t_encoding.empty() )
91 t_encoding = t_path.extension().native().substr( 1 );
95 if( t_codec ==
nullptr )
97 LERROR( slog,
"Unable to find output codec for encoding <" << t_encoding <<
">");
101 return t_codec->
write_file( a_param, a_filename, a_options );
106 std::string t_encoding = a_options.
get_value(
"encoding",
"" );
107 if( t_encoding.empty() )
109 LERROR( slog,
"Encoding-type option must be provided");
114 if( t_codec ==
nullptr )
116 LERROR( slog,
"Unable to find output codec for encoding <" << t_encoding <<
">");
120 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)
static factory< XBaseType, XArgs... > * get_instance()
LOGGER(slog,"param_codec")
virtual ~param_output_codec()
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())
std::unique_ptr< param > param_ptr_t
std::string get_value(const std::string &a_name, const std::string &a_default) const
XBaseType * create(const std::string &a_class_name, XArgs...args)
bool write_string(const param &a_param, std::string &a_string, const param_node &a_options=param_node())