CppCMS
cppcms/encoding.h
00001 
00002 //                                                                             
00003 //  Copyright (C) 2008-2012  Artyom Beilis (Tonkikh) <artyomtnk@yahoo.com>     
00004 //                                                                             
00005 //  See accompanying file COPYING.TXT file for licensing details.
00006 //
00008 #ifndef CPPCMS_ENCODING_H
00009 #define CPPCMS_ENCODING_H
00010 
00011 #include <string>
00012 #include <map>
00013 #include <locale>
00014 #include <cppcms/defs.h>
00015 #include <cppcms/config.h>
00016 
00017 namespace cppcms {
00022         namespace encoding {
00023 
00027                 
00032                 bool CPPCMS_API valid(std::locale const &loc,char const *begin,char const *end,size_t &count);
00037                 bool CPPCMS_API valid_utf8(char const *begin,char const *end,size_t &count);
00042                 bool CPPCMS_API valid(char const *encoding,char const *begin,char const *end,size_t &count);
00047                 bool CPPCMS_API valid(std::string const &encoding,char const *begin,char const *end,size_t &count);
00048         
00060                 bool CPPCMS_API is_ascii_compatible(std::string const &encoding);
00069                 bool CPPCMS_API validate_or_filter(     std::string const &encoding,
00070                                                         char const *begin,char const *end,
00071                                                         std::string &output,
00072                                                         char replace = 0);
00073 
00078                 std::string CPPCMS_API to_utf8(std::locale const &loc,char const *begin,char const *end);
00083                 std::string CPPCMS_API to_utf8(char const *encoding,char const *begin,char const *end);
00088                 std::string CPPCMS_API to_utf8(std::locale const &loc,std::string const &str);
00093                 std::string CPPCMS_API to_utf8(char const *encoding,std::string const &str);
00094 
00099                 std::string CPPCMS_API from_utf8(std::locale const &loc,char const *begin,char const *end);
00104                 std::string CPPCMS_API from_utf8(char const *encoding,char const *begin,char const *end);
00109                 std::string CPPCMS_API from_utf8(std::locale const &loc,std::string const &str);
00114                 std::string CPPCMS_API from_utf8(char const *encoding,std::string const &str);
00115 
00116         }  // encoding
00117 } // cppcms
00118 
00119 
00120 #endif