--- parser3/src/include/pa_charset.h 2002/08/01 11:26:46 1.17 +++ parser3/src/include/pa_charset.h 2003/01/31 12:10:43 1.20.2.9 @@ -1,14 +1,14 @@ /** @file Parser: Charset connection decl. - Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com) + Copyright (c) 2001, 2003 ArtLebedev Group (http://www.artlebedev.com) Author: Alexandr Petrosian (http://paf.design.ru) */ #ifndef PA_CHARSET_H #define PA_CHARSET_H -static const char* IDENT_CHARSET_H="$Id: pa_charset.h,v 1.17 2002/08/01 11:26:46 paf Exp $"; +static const char* IDENT_CHARSET_H="$Date: 2003/01/31 12:10:43 $"; #include "pa_pool.h" #include "pa_exception.h" @@ -39,19 +39,20 @@ struct Charset_TransRec { }; /** charset holds name & transcode tables - registers Xerces transcoders + registers libxml transcoders */ -class Charset : public Pooled { +class Charset: public PA_Object { + Pool pool_for_load; public: - Charset(Pool& apool, const String& aname, const String *request_file_spec); - Charset::~Charset(); + Charset(StringPtr aname, StringPtr afile_spec); + override ~Charset(); - const String& name() const { return fname; } + StringPtr name() const { return fname; } bool isUTF8() const { return fisUTF8; } - static void transcode(Pool& pool, + static void transcode(Pool& pool, const Charset& source_transcoder, const void *source_body, size_t source_content_length, const Charset& dest_transcoder, const void *& dest_body, size_t& dest_content_length ); @@ -66,7 +67,7 @@ public: private: - void loadDefinition(const String& request_file_spec); + void load_definition(StringPtr afile_spec); void sort_ToTable(); void transcodeToUTF8(Pool& pool, @@ -91,7 +92,8 @@ public: private: - const String& fname; + StringPtr fname; + CharPtr fname_cstr; bool fisUTF8; Tables tables; @@ -105,11 +107,19 @@ public: /// converts GdomeDOMString string to char * const char *transcode_cstr(GdomeDOMString *s); /// converts GdomeDOMString string to parser String - String& transcode(GdomeDOMString *s); + String& transcode(GdomeDOMString *s +#ifndef NO_STRING_ORIGIN + , const String *origin +#endif + ); /// converts xmlChar* null-terminated string to char * const char *transcode_cstr(xmlChar *s); /// converts xmlChar* null-terminated string to parser String - String& transcode(xmlChar *s); + String& transcode(xmlChar *s +#ifndef NO_STRING_ORIGIN + , const String *origin +#endif + ); /** converts sized char * to xmlChar* @returns xmlChar * which caller should free */ @@ -126,6 +136,9 @@ private: #endif }; +DECLARE_OBJECT_PTR(Charset); + +extern CharsetPtr UTF8_charset; #ifdef XML /// Auto-object used to track GdomeDOMString usage