added: uptime winix function prints how many sessions there are

changed: functions for text/numbers conversions
         int Toi(const std::string & str,  int base = 10);
         int Toi(const std::wstring & str, int base = 10);
         int Toi(const char * str,         int base = 10);
         int Toi(const wchar_t * str,      int base = 10);

         long Tol(const std::string & str,  int base = 10);
         long Tol(const std::wstring & str, int base = 10);
         long Tol(const char * str,         int base = 10);
         long Tol(const wchar_t * str,      int base = 10);

         template<class CharType>
         bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10);

         template<class CharType>
         bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10);

         template<class CharType>
         bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10);

         template<class CharType>
         bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10);

         const wchar_t * Toa(unsigned int value,  int base = 10);
         const wchar_t * Toa(unsigned long value, int base = 10);
         const wchar_t * Toa(int value,  int base = 10);
         const wchar_t * Toa(long value, int base = 10);

         void Toa(int  value, std::string & res,  int base = 10, bool clear = true);
         void Toa(long value, std::string & res,  int base = 10, bool clear = true);
         void Toa(int  value, std::wstring & res, int base = 10, bool clear = true);
         void Toa(long value, std::wstring & res, int base = 10, bool clear = true);

added:   HtmlTextStream class (files htmltextstream.cpp htmltextstream.h in templates)
         this is a special stream for automatically escaping html tags
	     



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@682 e52654a7-88a9-db11-a3e9-0013d4bc506e
pull/3/head
Tomasz Sowa 12 years ago
parent 518281e101
commit 933c8841ff

@ -7,29 +7,29 @@ app.o: ../db/dbtextstream.h ../core/textstream.h misc.h ../core/error.h log.h
app.o: textstream.h ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
app.o: ../core/user.h ../core/group.h ../core/thread.h ../core/dircontainer.h
app.o: ../core/ugcontainer.h request.h requesttypes.h session.h error.h
app.o: user.h plugindata.h rebus.h mounts.h mount.h mountparser.h users.h
app.o: ugcontainer.h lastcontainer.h groups.h group.h loadavg.h
app.o: sessionmanager.h sessioncontainer.h notify.h
app.o: user.h plugindata.h rebus.h ../templates/htmltextstream.h mounts.h
app.o: mount.h mountparser.h users.h ugcontainer.h lastcontainer.h groups.h
app.o: group.h loadavg.h sessionmanager.h sessioncontainer.h notify.h
app.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
app.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h ../../ezc/src/pattern.h
app.o: ../../ezc/src/stringconv.h ../../ezc/src/functions.h
app.o: ../../ezc/src/funinfo.h ../core/mount.h ../core/config.h
app.o: ../templates/misc.h ../templates/localefilter.h ../templates/locale.h
app.o: ../core/confparser.h ../functions/functions.h
app.o: ../functions/functionbase.h ../core/request.h ../core/system.h
app.o: ../core/notify.h ../functions/functionparser.h ../functions/adduser.h
app.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
app.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
app.o: ../functions/createthread.h ../functions/default.h
app.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
app.o: ../functions/login.h ../functions/logout.h ../functions/ls.h
app.o: ../functions/mkdir.h ../functions/mv.h ../functions/node.h
app.o: ../functions/priv.h ../functions/reload.h ../functions/rm.h
app.o: ../functions/run.h ../functions/stat.h ../functions/subject.h
app.o: ../functions/funthread.h ../functions/template.h
app.o: ../functions/tinymce.h ../functions/uname.h ../functions/upload.h
app.o: ../functions/uptime.h ../functions/who.h ../functions/vim.h
app.o: ../core/htmlfilter.h ../templates/templates.h
app.o: ../core/confparser.h ../templates/htmltextstream.h
app.o: ../functions/functions.h ../functions/functionbase.h ../core/request.h
app.o: ../core/system.h ../core/notify.h ../functions/functionparser.h
app.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
app.o: ../functions/privchanger.h ../functions/chown.h
app.o: ../functions/ckeditor.h ../functions/cp.h ../functions/createthread.h
app.o: ../functions/default.h ../functions/download.h ../functions/emacs.h
app.o: ../functions/last.h ../functions/login.h ../functions/logout.h
app.o: ../functions/ls.h ../functions/mkdir.h ../functions/mv.h
app.o: ../functions/node.h ../functions/priv.h ../functions/reload.h
app.o: ../functions/rm.h ../functions/run.h ../functions/stat.h
app.o: ../functions/subject.h ../functions/funthread.h
app.o: ../functions/template.h ../functions/tinymce.h ../functions/uname.h
app.o: ../functions/upload.h ../functions/uptime.h ../functions/who.h
app.o: ../functions/vim.h ../core/htmlfilter.h ../templates/templates.h
app.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
app.o: ../core/httpsimpleparser.h ../core/log.h ../templates/indexpatterns.h
app.o: ../core/sessionmanager.h compress.h getparser.h httpsimpleparser.h
@ -39,10 +39,11 @@ bbcodeparser.o: bbcodeparser.h htmlfilter.h
compress.o: compress.h log.h textstream.h
config.o: config.h confparser.h htmlfilter.h log.h textstream.h plugin.h
config.o: pluginmsg.h plugindata.h request.h requesttypes.h session.h item.h
config.o: error.h user.h rebus.h system.h dirs.h dircontainer.h ../db/db.h
config.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
config.o: ../core/textstream.h misc.h ../core/error.h ../db/dbitemquery.h
config.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
config.o: error.h user.h rebus.h ../templates/htmltextstream.h
config.o: ../core/textstream.h misc.h system.h dirs.h dircontainer.h
config.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
config.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
config.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
config.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h
config.o: mounts.h mount.h mountparser.h users.h ugcontainer.h
config.o: lastcontainer.h groups.h group.h loadavg.h sessionmanager.h
@ -68,7 +69,8 @@ config.o: ../../ezc/src/funinfo.h ../templates/patterncacher.h
config.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
config.o: ../core/log.h ../templates/indexpatterns.h
config.o: ../templates/localefilter.h ../templates/locale.h
config.o: ../core/confparser.h ../core/sessionmanager.h
config.o: ../core/confparser.h ../templates/htmltextstream.h
config.o: ../core/sessionmanager.h
confparser.o: confparser.h misc.h item.h ../../ezc/src/utf8.h
dircontainer.o: dircontainer.h item.h log.h textstream.h
dirs.o: dirs.h item.h dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
@ -77,14 +79,15 @@ dirs.o: log.h textstream.h ../db/dbitemquery.h ../core/item.h
dirs.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h ../core/thread.h
dirs.o: ../core/dircontainer.h ../core/ugcontainer.h request.h requesttypes.h
dirs.o: session.h error.h user.h plugindata.h rebus.h config.h confparser.h
dirs.o: htmlfilter.h notify.h ../templatesnotify/templatesnotify.h
dirs.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
dirs.o: htmlfilter.h ../templates/htmltextstream.h notify.h
dirs.o: ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
dirs.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
dirs.o: ../../ezc/src/pattern.h ../../ezc/src/stringconv.h
dirs.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h ../core/mount.h
dirs.o: ../core/config.h ../templates/misc.h ../templates/localefilter.h
dirs.o: ../templates/locale.h ../core/confparser.h system.h mounts.h mount.h
dirs.o: mountparser.h users.h ugcontainer.h lastcontainer.h groups.h group.h
dirs.o: loadavg.h
dirs.o: ../templates/locale.h ../core/confparser.h
dirs.o: ../templates/htmltextstream.h system.h mounts.h mount.h mountparser.h
dirs.o: users.h ugcontainer.h lastcontainer.h groups.h group.h loadavg.h
groups.o: groups.h group.h ugcontainer.h ../db/db.h ../db/dbbase.h
groups.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
groups.o: item.h ../core/error.h log.h textstream.h ../db/dbitemquery.h
@ -108,8 +111,9 @@ misc.o: ../core/confparser.h ../core/config.h ../db/db.h ../db/dbbase.h
misc.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
misc.o: ../core/error.h ../db/dbitemquery.h ../db/dbitemcolumns.h
misc.o: ../core/user.h ../core/group.h ../core/thread.h
misc.o: ../core/dircontainer.h ../core/ugcontainer.h ../core/request.h
misc.o: ../core/system.h ../core/sessionmanager.h
misc.o: ../core/dircontainer.h ../core/ugcontainer.h
misc.o: ../templates/htmltextstream.h ../core/request.h ../core/system.h
misc.o: ../core/sessionmanager.h
mount.o: mount.h misc.h item.h
mountparser.o: mountparser.h mount.h item.h error.h dirs.h dircontainer.h
mountparser.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
@ -118,7 +122,7 @@ mountparser.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
mountparser.o: ../core/user.h ../core/group.h ../core/thread.h
mountparser.o: ../core/dircontainer.h ../core/ugcontainer.h request.h
mountparser.o: requesttypes.h session.h user.h plugindata.h rebus.h config.h
mountparser.o: confparser.h htmlfilter.h
mountparser.o: confparser.h htmlfilter.h ../templates/htmltextstream.h
mounts.o: mounts.h mount.h error.h dirs.h item.h dircontainer.h ../db/db.h
mounts.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
mounts.o: ../core/textstream.h misc.h ../core/error.h log.h textstream.h
@ -126,15 +130,15 @@ mounts.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
mounts.o: ../core/user.h ../core/group.h ../core/thread.h
mounts.o: ../core/dircontainer.h ../core/ugcontainer.h request.h
mounts.o: requesttypes.h session.h user.h plugindata.h rebus.h config.h
mounts.o: confparser.h htmlfilter.h mountparser.h plugin.h pluginmsg.h
mounts.o: system.h users.h ugcontainer.h lastcontainer.h groups.h group.h
mounts.o: loadavg.h sessionmanager.h sessioncontainer.h
mounts.o: ../functions/functions.h ../functions/functionbase.h
mounts.o: ../core/request.h ../core/config.h ../core/system.h
mounts.o: ../core/notify.h ../../ezc/src/utf8.h ../functions/functionparser.h
mounts.o: ../functions/adduser.h ../functions/cat.h ../functions/chmod.h
mounts.o: ../functions/privchanger.h ../functions/chown.h
mounts.o: ../functions/ckeditor.h ../functions/cp.h
mounts.o: confparser.h htmlfilter.h ../templates/htmltextstream.h
mounts.o: mountparser.h plugin.h pluginmsg.h system.h users.h ugcontainer.h
mounts.o: lastcontainer.h groups.h group.h loadavg.h sessionmanager.h
mounts.o: sessioncontainer.h ../functions/functions.h
mounts.o: ../functions/functionbase.h ../core/request.h ../core/config.h
mounts.o: ../core/system.h ../core/notify.h ../../ezc/src/utf8.h
mounts.o: ../functions/functionparser.h ../functions/adduser.h
mounts.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
mounts.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
mounts.o: ../functions/createthread.h ../functions/default.h
mounts.o: ../functions/download.h ../functions/emacs.h ../functions/last.h
mounts.o: ../functions/login.h ../functions/logout.h ../functions/ls.h
@ -151,27 +155,31 @@ mounts.o: ../../ezc/src/funinfo.h ../templates/patterncacher.h
mounts.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
mounts.o: ../core/log.h ../templates/indexpatterns.h
mounts.o: ../templates/localefilter.h ../templates/locale.h
mounts.o: ../core/confparser.h ../core/sessionmanager.h
mounts.o: ../core/confparser.h ../templates/htmltextstream.h
mounts.o: ../core/sessionmanager.h
notify.o: log.h textstream.h notify.h ../templatesnotify/templatesnotify.h
notify.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
notify.o: ../../ezc/src/pattern.h item.h ../../ezc/src/stringconv.h
notify.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h ../core/mount.h
notify.o: ../core/config.h ../core/textstream.h misc.h ../templates/misc.h
notify.o: ../templates/localefilter.h ../templates/locale.h
notify.o: ../core/confparser.h ../core/user.h request.h requesttypes.h
notify.o: session.h error.h user.h plugindata.h rebus.h config.h confparser.h
notify.o: htmlfilter.h system.h dirs.h dircontainer.h ../db/db.h
notify.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
notify.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
notify.o: ../core/group.h ../core/thread.h ../core/dircontainer.h
notify.o: ../core/ugcontainer.h mounts.h mount.h mountparser.h users.h
notify.o: ugcontainer.h lastcontainer.h groups.h group.h loadavg.h
notify.o: ../core/confparser.h ../templates/htmltextstream.h ../core/user.h
notify.o: request.h requesttypes.h session.h error.h user.h plugindata.h
notify.o: rebus.h config.h confparser.h htmlfilter.h
notify.o: ../templates/htmltextstream.h system.h dirs.h dircontainer.h
notify.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
notify.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
notify.o: ../db/dbitemcolumns.h ../core/group.h ../core/thread.h
notify.o: ../core/dircontainer.h ../core/ugcontainer.h mounts.h mount.h
notify.o: mountparser.h users.h ugcontainer.h lastcontainer.h groups.h
notify.o: group.h loadavg.h
plugin.o: plugin.h pluginmsg.h log.h textstream.h plugindata.h config.h
plugin.o: confparser.h htmlfilter.h request.h requesttypes.h session.h item.h
plugin.o: error.h user.h rebus.h system.h dirs.h dircontainer.h ../db/db.h
plugin.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
plugin.o: ../core/textstream.h misc.h ../core/error.h ../db/dbitemquery.h
plugin.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
plugin.o: error.h user.h rebus.h ../templates/htmltextstream.h
plugin.o: ../core/textstream.h misc.h system.h dirs.h dircontainer.h
plugin.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
plugin.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
plugin.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
plugin.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h
plugin.o: mounts.h mount.h mountparser.h users.h ugcontainer.h
plugin.o: lastcontainer.h groups.h group.h loadavg.h sessionmanager.h
@ -197,17 +205,19 @@ plugin.o: ../../ezc/src/funinfo.h ../templates/patterncacher.h
plugin.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
plugin.o: ../core/log.h ../templates/indexpatterns.h
plugin.o: ../templates/localefilter.h ../templates/locale.h
plugin.o: ../core/confparser.h ../core/sessionmanager.h
plugin.o: ../core/confparser.h ../templates/htmltextstream.h
plugin.o: ../core/sessionmanager.h
plugindata.o: plugindata.h plugin.h pluginmsg.h log.h textstream.h config.h
plugindata.o: confparser.h htmlfilter.h request.h requesttypes.h session.h
plugindata.o: item.h error.h user.h rebus.h system.h dirs.h dircontainer.h
plugindata.o: item.h error.h user.h rebus.h ../templates/htmltextstream.h
plugindata.o: ../core/textstream.h misc.h system.h dirs.h dircontainer.h
plugindata.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
plugindata.o: ../core/textstream.h misc.h ../core/error.h ../db/dbitemquery.h
plugindata.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h
plugindata.o: ../core/group.h ../core/thread.h ../core/dircontainer.h
plugindata.o: ../core/ugcontainer.h mounts.h mount.h mountparser.h users.h
plugindata.o: ugcontainer.h lastcontainer.h groups.h group.h loadavg.h
plugindata.o: sessionmanager.h sessioncontainer.h ../functions/functions.h
plugindata.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
plugindata.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
plugindata.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h
plugindata.o: mounts.h mount.h mountparser.h users.h ugcontainer.h
plugindata.o: lastcontainer.h groups.h group.h loadavg.h sessionmanager.h
plugindata.o: sessioncontainer.h ../functions/functions.h
plugindata.o: ../functions/functionbase.h ../core/request.h ../core/config.h
plugindata.o: ../core/system.h ../core/notify.h ../../ezc/src/utf8.h
plugindata.o: ../functions/functionparser.h ../functions/adduser.h
@ -232,26 +242,26 @@ plugindata.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
plugindata.o: ../core/httpsimpleparser.h ../core/log.h
plugindata.o: ../templates/indexpatterns.h ../templates/localefilter.h
plugindata.o: ../templates/locale.h ../core/confparser.h
plugindata.o: ../core/sessionmanager.h
plugindata.o: ../templates/htmltextstream.h ../core/sessionmanager.h
postmultiparser.o: postmultiparser.h error.h requesttypes.h config.h
postmultiparser.o: confparser.h htmlfilter.h log.h textstream.h
postmultiparser.o: ../../ezc/src/utf8.h misc.h item.h
rebus.o: log.h textstream.h rebus.h misc.h item.h request.h requesttypes.h
rebus.o: session.h error.h user.h plugindata.h config.h confparser.h
rebus.o: htmlfilter.h
rebus.o: htmlfilter.h ../templates/htmltextstream.h ../core/textstream.h
request.o: request.h requesttypes.h session.h item.h error.h user.h
request.o: plugindata.h rebus.h config.h confparser.h htmlfilter.h
request.o: textstream.h log.h plugin.h pluginmsg.h system.h dirs.h
request.o: dircontainer.h ../db/db.h ../db/dbbase.h ../db/dbconn.h
request.o: ../db/dbtextstream.h ../core/textstream.h misc.h ../core/error.h
request.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
request.o: ../core/user.h ../core/group.h ../core/thread.h
request.o: ../core/dircontainer.h ../core/ugcontainer.h mounts.h mount.h
request.o: mountparser.h users.h ugcontainer.h lastcontainer.h groups.h
request.o: group.h loadavg.h sessionmanager.h sessioncontainer.h
request.o: ../functions/functions.h ../functions/functionbase.h
request.o: ../core/request.h ../core/config.h ../core/system.h
request.o: ../core/notify.h ../../ezc/src/utf8.h
request.o: textstream.h ../templates/htmltextstream.h ../core/textstream.h
request.o: misc.h log.h plugin.h pluginmsg.h system.h dirs.h dircontainer.h
request.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
request.o: ../core/error.h ../db/dbitemquery.h ../core/item.h
request.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
request.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h
request.o: mounts.h mount.h mountparser.h users.h ugcontainer.h
request.o: lastcontainer.h groups.h group.h loadavg.h sessionmanager.h
request.o: sessioncontainer.h ../functions/functions.h
request.o: ../functions/functionbase.h ../core/request.h ../core/config.h
request.o: ../core/system.h ../core/notify.h ../../ezc/src/utf8.h
request.o: ../functions/functionparser.h ../functions/adduser.h
request.o: ../functions/cat.h ../functions/chmod.h ../functions/privchanger.h
request.o: ../functions/chown.h ../functions/ckeditor.h ../functions/cp.h
@ -271,18 +281,21 @@ request.o: ../../ezc/src/funinfo.h ../templates/patterncacher.h
request.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
request.o: ../core/log.h ../templates/indexpatterns.h
request.o: ../templates/localefilter.h ../templates/locale.h
request.o: ../core/confparser.h ../core/sessionmanager.h
request.o: ../core/confparser.h ../templates/htmltextstream.h
request.o: ../core/sessionmanager.h
session.o: session.h item.h error.h user.h plugindata.h rebus.h misc.h
sessioncontainer.o: sessioncontainer.h session.h item.h error.h user.h
sessioncontainer.o: plugindata.h rebus.h lastcontainer.h request.h
sessioncontainer.o: requesttypes.h config.h confparser.h htmlfilter.h
sessioncontainer.o: textstream.h log.h misc.h
sessioncontainer.o: textstream.h ../templates/htmltextstream.h
sessioncontainer.o: ../core/textstream.h misc.h log.h
sessionmanager.o: sessionmanager.h sessioncontainer.h session.h item.h
sessionmanager.o: error.h user.h plugindata.h rebus.h lastcontainer.h
sessionmanager.o: request.h requesttypes.h config.h confparser.h htmlfilter.h
sessionmanager.o: textstream.h system.h dirs.h dircontainer.h ../db/db.h
sessionmanager.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
sessionmanager.o: ../core/textstream.h misc.h ../core/error.h log.h
sessionmanager.o: textstream.h ../templates/htmltextstream.h
sessionmanager.o: ../core/textstream.h misc.h system.h dirs.h dircontainer.h
sessionmanager.o: ../db/db.h ../db/dbbase.h ../db/dbconn.h
sessionmanager.o: ../db/dbtextstream.h ../core/error.h log.h
sessionmanager.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
sessionmanager.o: ../core/user.h ../core/group.h ../core/thread.h
sessionmanager.o: ../core/dircontainer.h ../core/ugcontainer.h mounts.h
@ -314,15 +327,17 @@ sessionmanager.o: ../templates/patterncacher.h
sessionmanager.o: ../templates/ckeditorgetparser.h ../core/httpsimpleparser.h
sessionmanager.o: ../core/log.h ../templates/indexpatterns.h
sessionmanager.o: ../templates/localefilter.h ../templates/locale.h
sessionmanager.o: ../core/confparser.h ../core/sessionmanager.h
sessionmanager.o: ../core/confparser.h ../templates/htmltextstream.h
sessionmanager.o: ../core/sessionmanager.h
sessionparser.o: sessionparser.h session.h item.h error.h user.h plugindata.h
sessionparser.o: rebus.h sessioncontainer.h lastcontainer.h request.h
sessionparser.o: requesttypes.h config.h confparser.h htmlfilter.h
sessionparser.o: textstream.h users.h ugcontainer.h ../db/db.h ../db/dbbase.h
sessionparser.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h
sessionparser.o: misc.h ../core/error.h log.h ../db/dbitemquery.h
sessionparser.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h
sessionparser.o: ../core/group.h ../core/thread.h ../core/dircontainer.h
sessionparser.o: textstream.h ../templates/htmltextstream.h
sessionparser.o: ../core/textstream.h misc.h users.h ugcontainer.h ../db/db.h
sessionparser.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
sessionparser.o: ../core/error.h log.h ../db/dbitemquery.h ../core/item.h
sessionparser.o: ../db/dbitemcolumns.h ../core/user.h ../core/group.h
sessionparser.o: ../core/thread.h ../core/dircontainer.h
sessionparser.o: ../core/ugcontainer.h
system.o: system.h dirs.h item.h dircontainer.h ../db/db.h ../db/dbbase.h
system.o: ../db/dbconn.h ../db/dbtextstream.h ../core/textstream.h misc.h
@ -330,14 +345,16 @@ system.o: ../core/error.h log.h textstream.h ../db/dbitemquery.h
system.o: ../core/item.h ../db/dbitemcolumns.h ../core/user.h ../core/group.h
system.o: ../core/thread.h ../core/dircontainer.h ../core/ugcontainer.h
system.o: request.h requesttypes.h session.h error.h user.h plugindata.h
system.o: rebus.h config.h confparser.h htmlfilter.h mounts.h mount.h
system.o: mountparser.h users.h ugcontainer.h lastcontainer.h groups.h
system.o: group.h loadavg.h notify.h ../templatesnotify/templatesnotify.h
system.o: ../../ezc/src/ezc.h ../../ezc/src/utf8.h ../../ezc/src/generator.h
system.o: rebus.h config.h confparser.h htmlfilter.h
system.o: ../templates/htmltextstream.h mounts.h mount.h mountparser.h
system.o: users.h ugcontainer.h lastcontainer.h groups.h group.h loadavg.h
system.o: notify.h ../templatesnotify/templatesnotify.h ../../ezc/src/ezc.h
system.o: ../../ezc/src/utf8.h ../../ezc/src/generator.h
system.o: ../../ezc/src/pattern.h ../../ezc/src/stringconv.h
system.o: ../../ezc/src/functions.h ../../ezc/src/funinfo.h ../core/mount.h
system.o: ../core/config.h ../templates/misc.h ../templates/localefilter.h
system.o: ../templates/locale.h ../core/confparser.h ../templates/templates.h
system.o: ../templates/locale.h ../core/confparser.h
system.o: ../templates/htmltextstream.h ../templates/templates.h
system.o: ../templates/patterncacher.h ../templates/ckeditorgetparser.h
system.o: ../core/httpsimpleparser.h ../core/log.h
system.o: ../templates/indexpatterns.h ../core/request.h ../core/system.h
@ -345,9 +362,9 @@ system.o: ../core/sessionmanager.h
textstream.o: textstream.h misc.h item.h
users.o: users.h user.h ugcontainer.h lastcontainer.h request.h
users.o: requesttypes.h session.h item.h error.h plugindata.h rebus.h
users.o: config.h confparser.h htmlfilter.h textstream.h ../db/db.h
users.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h
users.o: ../core/textstream.h misc.h ../core/error.h log.h
users.o: ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
users.o: config.h confparser.h htmlfilter.h textstream.h
users.o: ../templates/htmltextstream.h ../core/textstream.h misc.h ../db/db.h
users.o: ../db/dbbase.h ../db/dbconn.h ../db/dbtextstream.h ../core/error.h
users.o: log.h ../db/dbitemquery.h ../core/item.h ../db/dbitemcolumns.h
users.o: ../core/user.h ../core/group.h ../core/thread.h
users.o: ../core/dircontainer.h ../core/ugcontainer.h

@ -65,7 +65,7 @@ DirContainer::Iterator DirContainer::End()
DirContainer::SizeType DirContainer::Size()
{
return table.size();
return table.size(); // !! warning: it has O(n)
}
bool DirContainer::Empty()

@ -78,7 +78,7 @@ LastTab::iterator i = FindNotLoggedOut(user_id, session_id);
return;
}
if( last_tab.size() >= LAST_TABLE_SIZE )
if( last_tab.size() >= LAST_TABLE_SIZE ) // last_tab has O(n) complexity
last_tab.erase(last_tab.begin());
LastItem li;

@ -14,157 +14,226 @@
#include "templates/templates.h"
int Atoi(const std::string & str, int base)
int Toi(const std::string & str, int base)
{
return Atoi(str.c_str(), base);
return Toi(str.c_str(), base);
}
int Atoi(const std::wstring & str, int base)
int Toi(const std::wstring & str, int base)
{
return Atoi(str.c_str(), base);
return Toi(str.c_str(), base);
}
int Atoi(const char * str, int base)
int Toi(const char * str, int base)
{
return static_cast<int>(strtol(str, 0, base));
}
int Atoi(const wchar_t * str, int base)
int Toi(const wchar_t * str, int base)
{
return static_cast<int>(wcstol(str, 0, base));
}
long Atol(const std::string & str, int base)
long Tol(const std::string & str, int base)
{
return Atol(str.c_str(), base);
return Tol(str.c_str(), base);
}
long Atol(const std::wstring & str, int base)
long Tol(const std::wstring & str, int base)
{
return Atol(str.c_str(), base);
return Tol(str.c_str(), base);
}
long Atol(const char * str, int base)
long Tol(const char * str, int base)
{
return strtol(str, 0, base);
}
long Atol(const wchar_t * str, int base)
long Tol(const wchar_t * str, int base)
{
return wcstol(str, 0, base);
}
const wchar_t * Itoa(int value, int base)
const wchar_t * Toa(unsigned int value, int base)
{
return Ltoa(value, base);
return Toa(static_cast<unsigned long>(value), base);
}
const wchar_t * Ltoa(long value, int base)
const wchar_t * Toa(unsigned long value, int base)
{
static wchar_t digits[] = L"0123456789ABCDEF";
static wchar_t buffer_[50];
wchar_t * buffer = buffer_;
size_t i1, i2;
long rest;
static wchar_t buffer[50];
size_t len = sizeof(buffer) / sizeof(wchar_t);
i1 = i2 = 0;
Toa(value, buffer, len, base);
if( base < 2 )
base = 2;
return buffer;
}
if( base > 16 )
base = 16;
if( value < 0 )
{
buffer[0] = '-';
buffer += 1;
value = -value;
}
do
{
rest = value % base;
value = value / base;
buffer[i2++] = digits[rest];
}
while(value != 0);
buffer[i2--] = 0;
const wchar_t * Toa(int value, int base)
{
return Toa(static_cast<long>(value), base);
}
for( ; i1 < i2 ; ++i1, --i2)
{
wchar_t temp = buffer[i1];
buffer[i1] = buffer[i2];
buffer[i2] = temp;
}
return buffer_;
const wchar_t * Toa(long value, int base)
{
static wchar_t buffer[50];
size_t len = sizeof(buffer) / sizeof(wchar_t);
Toa(value, buffer, len, base);
return buffer;
}
void AssignString(const char * src, std::wstring & dst, bool clear)
void Toa(int value, std::string & res, int base, bool clear)
{
size_t len;
static char buffer[50];
size_t len = sizeof(buffer) / sizeof(char);
if( clear )
dst.clear();
res.clear();
for(len=0 ; src[len] ; ++len){}
Toa(value, buffer, len, base);
res += buffer;
}
if( dst.capacity() < dst.size() + len )
dst.reserve(dst.size() + len + 128);
for( ; *src ; ++src )
dst += static_cast<unsigned char>(*src);
void Toa(long value, std::string & res, int base, bool clear)
{
static char buffer[50];
size_t len = sizeof(buffer) / sizeof(char);
if( clear )
res.clear();
Toa(value, buffer, len, base);
res += buffer;
}
void AssignString(const std::string & src, std::wstring & dst, bool clear)
void Toa(int value, std::wstring & res, int base, bool clear)
{
static wchar_t buffer[50];
size_t len = sizeof(buffer) / sizeof(wchar_t);
if( clear )
res.clear();
Toa(value, buffer, len, base);
res += buffer;
}
void Toa(long value, std::wstring & res, int base, bool clear)
{
static wchar_t buffer[50];
size_t len = sizeof(buffer) / sizeof(wchar_t);
if( clear )
res.clear();
Toa(value, buffer, len, base);
res += buffer;
}
void AssignString(const char * src, size_t len, std::wstring & dst, bool clear)
{
if( clear )
dst.clear();
if( dst.capacity() < dst.size() + src.size() )
dst.reserve(dst.size() + src.size() + 128);
if( dst.capacity() < dst.size() + len )
dst.reserve(dst.size() + len + 128);
for(size_t i=0 ; i<src.size() ; ++i )
for(size_t i=0 ; i<len ; ++i )
dst += static_cast<unsigned char>(src[i]);
}
void AssignString(const wchar_t * src, std::string & dst, bool clear)
void AssignString(const char * src, std::wstring & dst, bool clear)
{
size_t len;
for(len=0 ; src[len] ; ++len){}
AssignString(src, len, dst, clear);
}
void AssignString(const std::string & src, std::wstring & dst, bool clear)
{
AssignString(src.c_str(), src.size(), dst, clear);
}
void AssignString(const wchar_t * src, size_t len, std::string & dst, bool clear)
{
if( clear )
dst.clear();
for(len=0 ; src[len] ; ++len){}
if( dst.capacity() < dst.size() + len )
dst.reserve(dst.size() + len + 128);
for( ; *src ; ++src )
dst += static_cast<char>(*src);
for(size_t i=0 ; i<len ; ++i)
dst += static_cast<char>(src[i]);
}
void AssignString(const wchar_t * src, std::string & dst, bool clear)
{
size_t len;
for(len=0 ; src[len] ; ++len){}
AssignString(src, len, dst, clear);
}
void AssignString(const std::wstring & src, std::string & dst, bool clear)
{
AssignString(src.c_str(), src.size(), dst, clear);
}
void AssignString(const char * src, size_t len, std::string & dst, bool clear)
{
if( clear )
dst.clear();
if( dst.capacity() < dst.size() + src.size() )
dst.reserve(dst.size() + src.size() + 128);
// we suppose that append is smart enough and we don't have to use reserve()
dst.append(src, len);
}
for(size_t i=0 ; i<src.size() ; ++i )
dst += static_cast<char>(src[i]);
void AssignString(const char * src, std::string & dst, bool clear)
{
size_t len;
for(len=0 ; src[len] ; ++len){}
AssignString(src, len, dst, clear);
}
@ -175,53 +244,47 @@ void AssignString(const std::string & src, std::string & dst, bool clear)
if( clear )
dst.clear();
dst += src;
dst.append(src);
}
void AssignString(const std::wstring & src, std::wstring & dst, bool clear)
void AssignString(const wchar_t * src, size_t len, std::wstring & dst, bool clear)
{
if( clear )
dst.clear();
dst += src;
// we suppose that append is smart enough and we don't have to use reserve()
dst.append(src, len);
}
// !! skasowac, jest juz Itoa
void ToString(std::string & s, int value)
void AssignString(const wchar_t * src, std::wstring & dst, bool clear)
{
static char buffer[50];
sprintf(buffer, "%d", value);
s = buffer;
}
size_t len;
for(len=0 ; src[len] ; ++len){}
void ToString(std::string & s, long value)
{
static char buffer[50];
sprintf(buffer, "%ld", value);
s = buffer;
AssignString(src, len, dst, clear);
}
void ToString(std::wstring & s, int value)
void AssignString(const std::wstring & src, std::wstring & dst, bool clear)
{
static wchar_t buffer[50];
swprintf(buffer, sizeof(buffer)/sizeof(wchar_t), L"%d", value);
s = buffer;
if( clear )
dst.clear();
dst.append(src);
}
void ToString(std::wstring & s, long value)
{
static wchar_t buffer[50];
swprintf(buffer, sizeof(buffer)/sizeof(wchar_t), L"%ld", value);
s = buffer;
}
@ -264,7 +327,6 @@ std::wstring::iterator i;
{
if( !CorrectUrlChar(*i) )
{
//wchar_t c = ChangeLocalChar(*i);
wchar_t c = TemplatesFunctions::locale.Subst(*i);
if( CorrectUrlChar(c) )
@ -309,51 +371,6 @@ void CorrectUrlOnlyAllowedChar(std::wstring & url)
/*
int polish_letters_simple[] =
{ 'a', 'A',
'c', 'C',
's', 'S',
'e', 'E',
'l', 'L',
'o', 'O',
'z', 'Z',
'z', 'Z',
'n', 'N', 0 }; // 0 - terminating
int polish_letters_iso88592[] =
{ 0xb1, 0xa1,
0xe6, 0xc6,
0xb6, 0xa6,
0xea, 0xca,
0xb3, 0xa3,
0xf3, 0xd3,
0xbf, 0xaf,
0xbc, 0xac,
0xf1, 0xd1, 0 };
int ChangeLocalChar(unsigned char c)
{
// if( language == polish_iso88592 )
for(int i = 0 ; polish_letters_iso88592[i] ; ++i)
{
if( polish_letters_simple[i] == 0 )
{
log << log1 << "localization tables don't have the same size" << logend;
return c;
}
if( polish_letters_iso88592[i] == c )
return polish_letters_simple[i];
}
return c;
}
*/
@ -502,14 +519,6 @@ return buffer;
}
const wchar_t * ToStr(int value)
{
static wchar_t buffer[100];
swprintf(buffer, sizeof(buffer)/sizeof(wchar_t), L"%d", value);
return buffer;
}
bool IsWhite(wchar_t s)

@ -18,45 +18,148 @@
#include "item.h"
int Atoi(const std::string & str, int base = 10);
int Atoi(const std::wstring & str, int base = 10);
int Atoi(const char * str, int base = 10);
int Atoi(const wchar_t * str, int base = 10);
long Atol(const std::string & str, int base = 10);
long Atol(const std::wstring & str, int base = 10);
long Atol(const char * str, int base = 10);
long Atol(const wchar_t * str, int base = 10);
/*
conversions between text and numbers
*/
int Toi(const std::string & str, int base = 10);
int Toi(const std::wstring & str, int base = 10);
int Toi(const char * str, int base = 10);
int Toi(const wchar_t * str, int base = 10);
// warning: it uses its own static buffer
// one buffer for both these functions
const wchar_t * Itoa(int value, int base = 10);
const wchar_t * Ltoa(long value, int base = 10);
long Tol(const std::string & str, int base = 10);
long Tol(const std::wstring & str, int base = 10);
long Tol(const char * str, int base = 10);
long Tol(const wchar_t * str, int base = 10);
// if the buffer is too small it will be terminated at the beginning (empty string)
// and the function returns false
template<class CharType>
bool Toa(unsigned long value, CharType * buffer, size_t buf_len, int base = 10)
{
size_t i1, i2;
long rest;
if( buf_len == 0 )
return false;
i1 = i2 = 0;
if( base < 2 ) base = 2;
if( base > 16 ) base = 16;
do
{
rest = value % base;
value = value / base;
buffer[i2++] = (rest < 10) ? char(rest) + '0' : char(rest) - 10 + 'A';
}
while(value != 0 && i2 < buf_len);
if( i2 >= buf_len )
{
buffer[0] = 0; // ops, the buffer was too small
return false;
}
buffer[i2--] = 0;
for( ; i1 < i2 ; ++i1, --i2)
{
CharType temp = buffer[i1];
buffer[i1] = buffer[i2];
buffer[i2] = temp;
}
return true;
}
// if the buffer is too small it will be terminated at the beginning (empty string)
// and the function returns false
template<class CharType>
bool Toa(long value, CharType * buffer, size_t buf_len, int base = 10)
{
if( buf_len == 0 )
return false;
CharType * buf = buffer;
if( value < 0 )
{
buffer[0] = '-';
buf += 1;
buf_len -= 1;
value = -value;
}
bool res = Toa(static_cast<unsigned long>(value), buf, buf_len, base);
if( !res )
buffer[0] = 0;
return res;
}
template<class CharType>
bool Toa(unsigned int value, CharType * buffer, size_t buf_len, int base = 10)
{
return Toa(static_cast<unsigned long>(value), buffer, buf_len, base);
}
template<class CharType>
bool Toa(int value, CharType * buffer, size_t buf_len, int base = 10)
{
return Toa(static_cast<long>(value), buffer, buf_len, base);
}
// warning: it uses its own static buffer
// one buffer for both these functions
const wchar_t * Toa(unsigned int value, int base = 10);
const wchar_t * Toa(unsigned long value, int base = 10);
const wchar_t * Toa(int value, int base = 10);
const wchar_t * Toa(long value, int base = 10);
void Toa(int value, std::string & res, int base = 10, bool clear = true);
void Toa(long value, std::string & res, int base = 10, bool clear = true);
void Toa(int value, std::wstring & res, int base = 10, bool clear = true);
void Toa(long value, std::wstring & res, int base = 10, bool clear = true);
/*
conversions between ascii text and wide characters
(destination is always std::string or std::wstring)
characters are copied as they are without any locales checking
*/
void AssignString(const char * src, size_t len, std::wstring & dst, bool clear = true);
void AssignString(const char * src, std::wstring & dst, bool clear = true);
void AssignString(const std::string & src, std::wstring & dst, bool clear = true);
void AssignString(const wchar_t * src, size_t len, std::string & dst, bool clear = true);
void AssignString(const wchar_t * src, std::string & dst, bool clear = true);
void AssignString(const std::wstring & src, std::string & dst, bool clear = true);
void AssignString(const char * src, size_t len, std::string & dst, bool clear = true);
void AssignString(const char * src, std::string & dst, bool clear = true);
void AssignString(const std::string & src, std::string & dst, bool clear = true);
void AssignString(const wchar_t * src, size_t len, std::wstring & dst, bool clear = true);
void AssignString(const wchar_t * src, std::wstring & dst, bool clear = true);
void AssignString(const std::wstring & src, std::wstring & dst, bool clear = true);
void ToString(std::string & s, int value);
void ToString(std::string & s, long value);
void ToString(std::wstring & s, int value);
void ToString(std::wstring & s, long value);
//int ChangeLocalChar(unsigned char c);
bool CorrectUrlChar(wchar_t c);
void CorrectUrlDots(std::wstring & url);
@ -150,16 +253,7 @@ void ToSmall(std::wstring & s);
const char * SkipWhite(const char * s);
const wchar_t * SkipWhite(const wchar_t * s);
const wchar_t * ToStr(int value); // !! zamienic na ToString() tak jak pozosta³e metody (na poczatku)
/*
bool IsSubString(const char * short_str, const char * long_str);
bool IsSubString(const std::string & short_str, const std::string & long_str);
bool IsSubStringNoCase(const char * short_str, const char * long_str);
bool IsSubStringNoCase(const std::string & short_str, const std::string & long_str);
bool EqualNoCase(const char * str1, const char * str2);
bool EqualNoCase(const std::string & str1, const std::string & str2);
*/
template<class StringType1, class StringType2>
bool IsSubString(const StringType1 * short_str, const StringType2 * long_str)

@ -81,7 +81,7 @@ bool Mount::IsArg(int code, int arg)
for(i=param[code].arg.begin() ; i!=param[code].arg.end() ; ++i)
{
if( Atoi(*i) == arg )
if( Toi(*i) == arg )
return true;
}

@ -19,6 +19,7 @@
#include "error.h"
#include "config.h"
#include "textstream.h"
#include "templates/htmltextstream.h"
class FunctionBase;
@ -45,7 +46,7 @@ struct Request
// headers, page and debug
//std::ostringstream headers, page, debug;
TextStream<std::string> headers;
TextStream<std::wstring> page, debug;
HtmlTextStream page, debug;
// raw parameters
GetTab get_tab;

@ -16,6 +16,7 @@
SessionContainer::SessionContainer()
{
request = 0;
table_size = 0;
}
@ -48,7 +49,7 @@ Table::iterator inext, i = table.begin();
// erasing all indexes
index_id.clear();
index_time.clear();
table_size = 0;
request->session = 0;
}
@ -61,7 +62,8 @@ void SessionContainer::SetLastContainer(LastContainer * plast_container)
SessionContainer::TableSize SessionContainer::Size()
{
return table.size();
// don't use table.size() as it has O(n) complexity on FreeBSD
return table_size;
}
@ -93,9 +95,10 @@ bool SessionContainer::PushBack(const Session & session)
Iterator last = table.insert(table.end(), session);
index_id.insert( std::make_pair(session.id, last) );
index_time.insert( std::make_pair(session.last_time, last) );
table_size += 1;
log << log3 << "SC: added session, id: " << session.id << logend;
return true;
}
@ -141,8 +144,9 @@ Session * old_session = request->session;
request->session = &(*iold->second);
table.erase(iold->second);
request->session = 0;
index_time.erase(iold);
table_size -= 1;
request->session = 0;
log << log3 << "SC: deleted index_time for session id: " << id << logend;
log << log3 << "SC: deleted session, id: " << id << logend;

@ -47,6 +47,9 @@ private:
Request * request;
void DelFromIdIndex(Iterator iter);
// in FreeBSD implementation (GCC) list::size() has linear complexity
// so we use our own table_size with O(1)
size_t table_size;
public:

@ -50,6 +50,12 @@ void SessionManager::SetLastContainer(LastContainer * plast_container)
}
size_t SessionManager::Size()
{
return session_tab.Size();
}
bool SessionManager::IsSession(long id)
{
if( session_tab.FindById(id) == session_tab.End() )
@ -144,7 +150,7 @@ int attempts = 100;
bool SessionManager::SetSessionFromCookie(const std::string & cookie)
{
long id = atol(cookie.c_str());
long id = Tol(cookie.c_str());
SessionContainer::Iterator s = session_tab.FindById(id);
if( s == session_tab.End() )

@ -55,6 +55,8 @@ public:
SessionContainer::Iterator SessionBegin();
SessionContainer::Iterator SessionEnd();
size_t Size();
};

@ -14,6 +14,13 @@
#include "misc.h"
/*
a special class representing a stream buffer
similar to std::ostringstream
StringType can be either std::string or std::wstring
this class doesn't use UTF-8 in any kind
*/
template<class StringType>
class TextStream
{
@ -25,6 +32,8 @@ public:
void Clear();
bool Empty() const;
size_t Size() const;
void Reserve(size_t len);
const StringType & Str() const;
const CharType * CStr() const;
@ -45,8 +54,10 @@ public:
TextStream & operator<<(double);
TextStream & operator<<(const void *);// printing a pointer
TextStream & Write(const CharType * buf, size_t len);
TextStream & write(const CharType * buf, size_t len); // for compatibility with standard library (Ezc uses it)
TextStream & Write(const char * buf, size_t len);
TextStream & Write(const wchar_t * buf, size_t len);
TextStream & write(const char * buf, size_t len); // for compatibility with standard library (Ezc uses it)
TextStream & write(const wchar_t * buf, size_t len);
protected:
@ -74,6 +85,13 @@ size_t TextStream<StringType>::Size() const
return buffer.size();
}
template<class StringType>
void TextStream<StringType>::Reserve(size_t len)
{
buffer.reserve(len);
}
template<class StringType>
const StringType & TextStream<StringType>::Str() const
{
@ -166,9 +184,10 @@ return *this;
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(int v)
{
char buf[50];
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
sprintf(buf, "%d", v);
Toa(v, buf, len);
AssignString(buf, buffer, false);
return *this;
@ -178,9 +197,10 @@ return *this;
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(long v)
{
char buf[50];
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
sprintf(buf, "%ld", v);
Toa(v, buf, len);
AssignString(buf, buffer, false);
return *this;
@ -190,9 +210,10 @@ return *this;
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(unsigned int v)
{
char buf[50];
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
sprintf(buf, "%u", v);
Toa(v, buf, len);
AssignString(buf, buffer, false);
return *this;
@ -202,9 +223,10 @@ return *this;
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(unsigned long v)
{
char buf[50];
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
sprintf(buf, "%lu", v);
Toa(v, buf, len);
AssignString(buf, buffer, false);
return *this;
@ -226,9 +248,13 @@ return *this;
template<class StringType>
TextStream<StringType> & TextStream<StringType>::operator<<(const void * v)
{
char buf[50];
wchar_t buf[50];
size_t len = sizeof(buf) / sizeof(wchar_t);
sprintf(buf, "%p", v);
buf[0] = '0';
buf[1] = 'x';
Toa(reinterpret_cast<unsigned long>(v), buf+2, len-2, 16);
AssignString(buf, buffer, false);
return *this;
@ -236,24 +262,35 @@ return *this;
template<class StringType>
TextStream<StringType> & TextStream<StringType>::Write(const TextStream<StringType>::CharType * buf, size_t len)
TextStream<StringType> & TextStream<StringType>::Write(const char * buf, size_t len)
{
AssignString(buf, len, buffer, false);
return *this;
}
template<class StringType>
TextStream<StringType> & TextStream<StringType>::write(const char * buf, size_t len)
{
if( buffer.capacity() < buffer.size() + len )
buffer.reserve(buffer.size() + len + 256); // !! add some constant
return Write(buf, len);
}
for(size_t i=0 ; i<len ; ++i)
buffer += buf[i];
template<class StringType>
TextStream<StringType> & TextStream<StringType>::Write(const wchar_t * buf, size_t len)
{
AssignString(buf, len, buffer, false);