Commit Graph

14 Commits

Author SHA1 Message Date
prozacx
c4a6f39b53 Pulled in CString changes from my common repository to help facilitate the upcoming webmods changes
Changes include...

- CString -
Addition of LCString typedef to list<CString>

Added four more args to CString::Token()...
	bool bAllowEmpty = false        <-- This default of false is NOT backward compatible but seems way more intuitive
	const CString& sLeft = ""
	const CString& sRight = ""
	bool bTrimQuotes = true

Added CString::OptionSplit()
Added CString::QuoteSplit()

Added two new args to CString::Split()...
	bool bTrimQuotes = true,
	bool bTrimWhiteSpace = false

- CTemplate -
Added new class CTemplateTagHandler to provide capability to add custom tags and vars
Added var name pointer dereferencing in the form of <? VAR Name=*other_var ?> (use ** to start with a literal star)
Added a list of paths that can be used to look for a given filename in multiple locations
Added CTemplate::PrependPath()
Added CTemplate::AppendPath()
Added CTemplate::RemovePath()
Added CTemplate::ClearPath()
Added CTemplate::PrintString() for filling a CString& instead of a stream
Added <? LT ?> which outputs a literal "<?"
Added <? GT ?> which outputs a literal "?>"
Added <? SETBLOCK ?> and <? ENDSETBLOCK ?> for setting a variable's value to the contents between the tags
Added <? EXPAND ?> for expanding a filename to a path using the settable list of paths
Added <? BREAK ?> and <? CONTINUE ?> inner loop tags
Added <? EXIT ?> tag to stop processing
Added <? DEBUG ?> tag for printing to DEBUG()
Added REVERSE keyword to the <? LOOP ?> tag



git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1537 726aef4b-f618-498e-8847-2d620e286838
2009-06-10 05:48:12 +00:00
psychon
dbfad62840 CString now takes a precision for converting floating point numbers
Because the precision defaults to 2, e.g. the traffic stats are now way more
readable.

Thanks to KiNgMaR for the idea and the patch.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1525 726aef4b-f618-498e-8847-2d620e286838
2009-05-27 11:24:26 +00:00
psychon
158c189e48 Remove some unneeded magic from CString::Escape_n() (nothing major)
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1465 726aef4b-f618-498e-8847-2d620e286838
2009-03-31 09:32:16 +00:00
sebastinas
20bbdee968 Fix some weird behavior in CString::Base64Decode and wrapped strings
With the current implementation of CString::Base64Decode the following
code would fail (meaning b would be false):

    CString t = "some very long string ...";
    bool b = (t == t.Base64Encode_n(true).Base64Decode_n());

The same code without wrapping the base64 output would give b = true
as expected.

The new implementation removes all new lines before decoding so
decoding a wrapped base64 text gives the expected result.

Furthermore replaced malloc and free with new and delete and removed
the check for p in CString::Base64Encode since new will throw if it
failed.

The changes don't affect any existing code.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1410 726aef4b-f618-498e-8847-2d620e286838
2009-03-04 18:20:08 +00:00
psychon
f5eff8196f Make CString::Trim*() faster
Before, they would remove one character at a time.
Now they do everything at once.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1322 726aef4b-f618-498e-8847-2d620e286838
2009-01-06 09:43:18 +00:00
psychon
607a7f1c16 Get rid of most strtoul() and atoi() calls and use CString's features instead
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1320 726aef4b-f618-498e-8847-2d620e286838
2009-01-04 10:48:02 +00:00
psychon
08ad0291ea Happy New Year 2009 everyone!
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1317 726aef4b-f618-498e-8847-2d620e286838
2009-01-01 12:22:21 +00:00
psychon
2573b6408e Mark some global vars as const and static and some static local vars as const
This way the compiler puts those vars in .rodata instead of .data and everyone
happy. (Plus we have one symbol less exported)


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1241 726aef4b-f618-498e-8847-2d620e286838
2008-10-07 13:45:34 +00:00
kroimon
5237a24747 Use CString::Equals() everywhere.
* (CString::CaseCmp() == 0) became CString::Equals()
* (CString::CaseCmp() != 0) became !CString::Equals()
* replaced some occurrences of strn?casecmp

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1234 726aef4b-f618-498e-8847-2d620e286838
2008-09-30 15:15:59 +00:00
kroimon
f40b3e78d7 Added CString::Equals()
This new function can be used to replace the old (CaseCmp() == 0) statements.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1232 726aef4b-f618-498e-8847-2d620e286838
2008-09-30 12:58:34 +00:00
kroimon
195681d7d7 Added length argument to CString::StrCmp() like in CString::CaseCmp()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1231 726aef4b-f618-498e-8847-2d620e286838
2008-09-30 12:57:10 +00:00
kroimon
e693acaa66 Added CString::TrimPrefix() and CString::TrimSuffix()
These functions remove prefix/suffix strings if possible.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1224 726aef4b-f618-498e-8847-2d620e286838
2008-09-28 16:59:28 +00:00
kroimon
6766b32e1b Fixed some trailing whitespace / tab mixups and adjusted MD5.cpp to our coding guidelines.
This commit includes absolutely no changes in functionality, only pure cleanup.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1215 726aef4b-f618-498e-8847-2d620e286838
2008-09-26 12:51:36 +00:00
kroimon
57f4288c00 Renamed String.h and String.cpp to ZNCString.h and ZNCString.cpp
and updated all references to these files.

This became neccessary to solve problems on case-insensitive file-systems like Windows and MacOS X.

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1202 726aef4b-f618-498e-8847-2d620e286838
2008-09-13 16:38:41 +00:00