--- parser3/src/include/pa_charsets.h 2001/12/17 18:44:51 1.2 +++ parser3/src/include/pa_charsets.h 2026/11/26 21:25:03 1.25 @@ -1,10 +1,8 @@ /** @file Parser: sql driver manager decl. - Copyright (c) 2001 ArtLebedev Group (http://www.artlebedev.com) - Author: Alexander Petrosyan (http://paf.design.ru) - - $Id: pa_charsets.h,v 1.2 2001/12/17 18:44:51 paf Exp $ + Copyright (c) 2001-2026 Art. Lebedev Studio (https://www.artlebedev.com) + Authors: Konstantin Morshnev , Alexandr Petrosian global sql driver manager, must be thread-safe @@ -13,18 +11,33 @@ #ifndef PA_CHARSETS_H #define PA_CHARSETS_H +#define IDENT_PA_CHARSETS_H "$Id: pa_charsets.h,v 1.25 2026/11/26 21:25:03 moko Exp $" + #include "pa_hash.h" +#include "pa_charset.h" -class Charsets : public Hash { +/// convention: use UPPERCASE keys +class Charsets: public HashString { public: - Charsets(Pool& apool); - ~Charsets(); - Charset& get_charset(const String& name); -}; + Charsets(); + + Charset& get(String::Body ANAME); + Charset& get_direct(const char *ANAME); + Charset& get_file_charset(String::Body ANAME); -/// global -extern Charsets *charsets; + void load_charset(Request_charsets& charsets, String::Body ANAME, const String& afile_spec); + + // detects charset if it's not enforced, skips BOM signature if it complies charset + static Charset* checkBOM(char *&body,size_t &body_size, Charset* enforced_charset); + + static String::C encodeUTF16(const String::C src, bool bom); +}; +//@{ globals +extern Charset pa_UTF8_charset; +extern Charset pa_UTF16_charset; +extern Charsets pa_charsets; +//@} #endif