8 #define SCARAB_API_EXPORTS 17 LOGGER( slog,
"param_codec" );
50 std::string t_encoding;
51 if( a_options !=
nullptr && a_options->
has(
"encoding" ) )
53 t_encoding = a_options->
get_value(
"encoding" );
58 t_encoding = t_path.extension().native().substr( 1 );
62 if( t_codec ==
nullptr )
64 LERROR( slog,
"Unable to find input codec for encoding <" << t_encoding <<
">");
68 return t_codec->
read_file( a_filename, a_options );
73 std::string t_encoding;
74 if( a_options !=
nullptr && a_options->
has(
"encoding" ) )
76 t_encoding = a_options->
get_value(
"encoding" );
80 LERROR( slog,
"Encoding-type option must be provided");
85 if( t_codec ==
nullptr )
87 LERROR( slog,
"Unable to find input codec for encoding <" << t_encoding <<
">");
96 std::string t_encoding;
97 if( a_options !=
nullptr && a_options->
has(
"encoding" ) )
99 t_encoding = a_options->
get_value(
"encoding" );
104 t_encoding = t_path.extension().native().substr( 1 );
108 if( t_codec ==
nullptr )
110 LERROR( slog,
"Unable to find output codec for encoding <" << t_encoding <<
">");
114 return t_codec->
write_file( a_param, a_filename, a_options );
119 std::string t_encoding;
120 if( a_options !=
nullptr && a_options->
has(
"encoding" ) )
122 t_encoding = a_options->
get_value(
"encoding" );
126 LERROR( slog,
"Encoding-type option must be provided");
131 if( t_codec ==
nullptr )
133 LERROR( slog,
"Unable to find output codec for encoding <" << t_encoding <<
">");
137 return t_codec->
write_string( a_param, a_string, a_options );
path SCARAB_API expand_path(const string &a_path)
static factory< XBaseType, XArgs... > * get_instance()
LOGGER(slog,"param_codec")
bool write_file(const param &a_param, const std::string &a_filename, const param_node *a_options=nullptr)
virtual ~param_output_codec()
Contains the logger class and macros, based on Kasper's KLogger class.
std::string get_value(const std::string &a_name) const
bool has(const std::string &a_name) const
param * read_string(const std::string &a_string, const param_node *a_options=nullptr)
virtual bool write_string(const param &a_param, std::string &a_string, const param_node *a_options=nullptr)=0
virtual bool write_file(const param &a_param, const std::string &a_filename, const param_node *a_options=nullptr)=0
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=nullptr)
param * read_file(const std::string &a_filename, const param_node *a_options=nullptr)