changed: now we do not use std::string and char* in the Winix API

everywhere we are using std::wstring and wchar_t*
         (std::string and char* is used only locally in some places
         especially when creating a path to OS file system etc.)
added:   to the special thread when winix closes:
         a write function for curl: FetchPageOnExitCurlCallback()
         without this function the curl library will print
         the page's content to the standart output
changed: TextStream<> class from core can make
         UTF8<->wide strings conversions
removed: from config: utf8 option
         now winix expects UTF8 from the user's input (html forms, url-es)
         and outputs strings in the UTF8 format




git-svn-id: svn://ttmath.org/publicrep/winix/trunk@965 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2014-10-09 20:44:56 +00:00
parent 4abf6642f7
commit 8196fb77d1
74 changed files with 1911 additions and 1612 deletions

View File

@@ -11,6 +11,7 @@ init.o: ../../../pikotools/convert/convert.h
init.o: ../../../pikotools/convert/inttostr.h
init.o: ../../../pikotools/membuffer/membuffer.h
init.o: ../../../pikotools/textstream/types.h ../../../pikotools/utf8/utf8.h
init.o: ../../../winix/core/winix_const.h
init.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
init.o: ../../../winix/core/cur.h ../../../winix/core/request.h
init.o: ../../../winix/core/error.h ../../../winix/core/config.h
@@ -96,6 +97,7 @@ stats.o: ../../../pikotools/convert/convert.h
stats.o: ../../../pikotools/convert/inttostr.h
stats.o: ../../../pikotools/membuffer/membuffer.h
stats.o: ../../../pikotools/textstream/types.h ../../../pikotools/utf8/utf8.h
stats.o: ../../../winix/core/winix_const.h
stats.o: ../../../winix/core/logmanipulators.h ../../../winix/core/slog.h
stats.o: ../../../winix/core/cur.h ../../../winix/core/request.h
stats.o: ../../../winix/core/error.h ../../../winix/core/config.h
@@ -124,6 +126,7 @@ templates.o: ../../../pikotools/membuffer/membuffer.h
templates.o: ../../../pikotools/textstream/types.h ../../../winix/core/item.h
templates.o: ../../../winix/core/error.h ../../../winix/core/textstream.h
templates.o: ../../../winix/core/misc.h ../../../pikotools/utf8/utf8.h
templates.o: ../../../winix/core/winix_const.h
templates.o: ../../../winix/templates/htmltextstream.h
templates.o: ../../../winix/core/textstream.h
templates.o: ../../../pikotools/space/spacetojson.h

View File

@@ -44,39 +44,38 @@ namespace Stats
void Bot::SetBrowserName(const char * name)
void Bot::SetBrowserName(const std::wstring & name)
{
browser_name = name;
browser_name = &name;
}
bool Bot::BrowserNameHas(const char * name)
bool Bot::BrowserNameHas(const wchar_t * name)
{
return strstr(browser_name, name) != 0;
return (browser_name->find(name) != std::wstring::npos);
}
bool Bot::IsGoogle()
{
return BrowserNameHas("Googlebot") && BrowserNameHas("+http://www.google.com/bot.html");
return BrowserNameHas(L"Googlebot") && BrowserNameHas(L"+http://www.google.com/bot.html");
}
bool Bot::IsYahoo()
{
return BrowserNameHas("Yahoo!") && BrowserNameHas("yahoo.com");
return BrowserNameHas(L"Yahoo!") && BrowserNameHas(L"yahoo.com");
}
bool Bot::IsBing()
{
if( BrowserNameHas("msnbot") && BrowserNameHas("+http://search.msn.com/msnbot.htm") )
if( BrowserNameHas(L"msnbot") && BrowserNameHas(L"+http://search.msn.com/msnbot.htm") )
return true;
return BrowserNameHas("bingbot") && BrowserNameHas("+http://www.bing.com/bingbot.htm");
return BrowserNameHas(L"bingbot") && BrowserNameHas(L"+http://www.bing.com/bingbot.htm");
}

View File

@@ -35,6 +35,10 @@
#ifndef headerfile_winix_plugins_stats_bot
#define headerfile_winix_plugins_stats_bot
#include <string>
namespace Winix
{
@@ -45,7 +49,7 @@ namespace Stats
struct Bot
{
void SetBrowserName(const char * name);
void SetBrowserName(const std::wstring & name);
bool IsGoogle();
bool IsYahoo();
@@ -54,9 +58,9 @@ struct Bot
private:
const char * browser_name;
const std::wstring * browser_name;
bool BrowserNameHas(const char * name);
bool BrowserNameHas(const wchar_t * name);
};