X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcodec.h;h=e8b172eb5af068004d6ad051642ced663a2b9608;hp=3470ccc68e6c65ad4890f499a54b41c88fa91256;hb=0ac97daad8d24f6762e1b870fec782c7aace695a;hpb=c88a239ff3b218ad0226e8c53356350ccc1f7014 diff --git a/source/codec.h b/source/codec.h index 3470ccc..e8b172e 100644 --- a/source/codec.h +++ b/source/codec.h @@ -9,7 +9,7 @@ Distributed under the LGPL #define MSP_STRINGS_CODEC_H_ #include -#include +#include namespace Msp { namespace Codecs { @@ -79,6 +79,8 @@ public: */ virtual void encode(const ustring &str, std::string &buf); + std::string encode(const ustring &); + /** Procuces a sequence of bytes that will bring the encoder back to the initial state. @@ -143,6 +145,8 @@ public: */ virtual void decode(const std::string &str, ustring &buf); + ustring decode(const std::string &); + /** Resets the decoder to the initial state. */ @@ -160,6 +164,11 @@ public: virtual ~Codec() { } + /** + Returns the name of the encoding handled by this codec. + */ + virtual const char *get_name() const =0; + /** Creates an encoder for this codec. */ @@ -231,6 +240,12 @@ deleting the codec when it's no longer needed. */ Codec *create_codec(const std::string &); +/** +Automatically detects the encoding of a string and creates a codec for it. +The codec must be deleted when it's no longer needed. +*/ +Codec *detect_codec(const std::string &); + } // namespace Codecs } // namespace Msp