X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fcodec.h;h=e8b172eb5af068004d6ad051642ced663a2b9608;hp=bb35b0b43528ca4eba14dc66682f43ae26bca651;hb=0ac97daad8d24f6762e1b870fec782c7aace695a;hpb=b254c706617223da1dd1b9543a74715e42a8a5b0 diff --git a/source/codec.h b/source/codec.h index bb35b0b..e8b172e 100644 --- a/source/codec.h +++ b/source/codec.h @@ -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