Commit Graph

94 Commits

Author SHA1 Message Date
marian 2f04202afb Added String::insert().
git-svn-id: http://voip.null.ro/svn/yate@6512 acf43c95-373e-0410-b603-e72c3f656dc1
2021-08-16 06:40:44 +00:00
paulc 8efa8d07cd Fixed several issues exposed by the Microsoft compiler.
git-svn-id: http://voip.null.ro/svn/yate@6459 acf43c95-373e-0410-b603-e72c3f656dc1
2021-02-09 14:08:19 +00:00
oana aaf34c810a Add String::toUInt64() method which parses an uint64_t from a string.
git-svn-id: http://voip.null.ro/svn/yate@6418 acf43c95-373e-0410-b603-e72c3f656dc1
2020-08-05 13:02:53 +00:00
oana 326e4941d7 Add a trace ID to objects.
Add debugging methods variants that print the trace ID.



git-svn-id: http://voip.null.ro/svn/yate@6402 acf43c95-373e-0410-b603-e72c3f656dc1
2020-04-22 12:00:37 +00:00
marian 2775f7bec8 Added String split method using a regular expression to match the delimiter.
git-svn-id: http://voip.null.ro/svn/yate@6382 acf43c95-373e-0410-b603-e72c3f656dc1
2020-02-21 14:13:44 +00:00
marian b55aeef403 Constifyed String::encodeFlags() methods.
git-svn-id: http://voip.null.ro/svn/yate@6349 acf43c95-373e-0410-b603-e72c3f656dc1
2019-03-28 13:55:51 +00:00
sabina 70c892c42c Implementation of encodeFlags() and decodeFlags functions.
git-svn-id: http://voip.null.ro/svn/yate@6341 acf43c95-373e-0410-b603-e72c3f656dc1
2019-01-17 15:24:55 +00:00
marian a0307d368f Added TokenDict64 structure and lookup functions.
git-svn-id: http://voip.null.ro/svn/yate@6340 acf43c95-373e-0410-b603-e72c3f656dc1
2019-01-14 14:57:27 +00:00
oana c1e5a20c9e Add UTF-16 encoding support to UChar class.
git-svn-id: http://voip.null.ro/svn/yate@6313 acf43c95-373e-0410-b603-e72c3f656dc1
2018-04-25 12:16:54 +00:00
paulc 277e34b576 Renamed DebugGoOn to DebugCrit so it better matches its purpose.
Swapped order of DebugCall and DebugNote so DebugCall is less visible.
Changed default debug level to DebugNote.
Modified a few inadequate uses of DebugCrit.


git-svn-id: http://voip.null.ro/svn/yate@6250 acf43c95-373e-0410-b603-e72c3f656dc1
2017-08-01 13:08:23 +00:00
paulc afbeb65da9 Added method for URI escaping an entire list of characters.
Escape status detail characters that may disturb status parsing.


git-svn-id: http://voip.null.ro/svn/yate@6184 acf43c95-373e-0410-b603-e72c3f656dc1
2017-02-16 11:24:25 +00:00
marian eda0aa0102 Added Regexp flag used to avoid regexp re-compile if not changed. Removed valid() method.
git-svn-id: http://voip.null.ro/svn/yate@6099 acf43c95-373e-0410-b603-e72c3f656dc1
2016-03-04 10:24:01 +00:00
marian c033522b9d Fixed bug: check vsnprintf result in String::printf(). Update held string length after printf.
git-svn-id: http://voip.null.ro/svn/yate@6071 acf43c95-373e-0410-b603-e72c3f656dc1
2015-11-24 15:58:55 +00:00
paulc f5a5ad41b9 Made String::printf(const char* format, ...) grow with the format string length.
The helper function string_printf is now static.


git-svn-id: http://voip.null.ro/svn/yate@5963 acf43c95-373e-0410-b603-e72c3f656dc1
2015-03-23 15:37:43 +00:00
marian 4b61ebb6a6 Added String constructor from double. Added assignment and append operators from double.
git-svn-id: http://voip.null.ro/svn/yate@5962 acf43c95-373e-0410-b603-e72c3f656dc1
2015-03-19 13:11:45 +00:00
andrei a9e461461e Clear the string if we failed to obtain the 'printf" formatted one.
git-svn-id: http://voip.null.ro/svn/yate@5961 acf43c95-373e-0410-b603-e72c3f656dc1
2015-03-16 11:39:37 +00:00
andrei 5faef36bb6 Added a better description and more suggestive parameters for String::appendFixed method.
Clear the String in 'printf' method if 'malloc' fails.


git-svn-id: http://voip.null.ro/svn/yate@5960 acf43c95-373e-0410-b603-e72c3f656dc1
2015-03-13 16:03:42 +00:00
andrei e6c6214688 Added printf style format method for String.
Added utility method to append and align a string on a specified size.


git-svn-id: http://voip.null.ro/svn/yate@5959 acf43c95-373e-0410-b603-e72c3f656dc1
2015-03-13 13:25:35 +00:00
oana a04eb2606f Add function to the String API for locating the last instance of a substring in a string.
git-svn-id: http://voip.null.ro/svn/yate@5916 acf43c95-373e-0410-b603-e72c3f656dc1
2014-10-16 12:34:11 +00:00
paulc 3f68863afd Made static String::hash() capable of incremental hashing.
git-svn-id: http://voip.null.ro/svn/yate@5859 acf43c95-373e-0410-b603-e72c3f656dc1
2014-07-02 07:30:37 +00:00
paulc d56cecb40e Added copyright notices to sources and scripts missing them.
Updated copyright notices for 2014.
Fixed end of lines in many files.


git-svn-id: http://voip.null.ro/svn/yate@5755 acf43c95-373e-0410-b603-e72c3f656dc1
2014-02-05 11:42:17 +00:00
paulc ffa216965e SQL escape single quote by doubling it instead of preceding with backslash.
git-svn-id: http://voip.null.ro/svn/yate@5630 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-27 19:31:18 +00:00
paulc e498bdc20f Fixed 64 bit types usage in Javascript, was broken on 32 bit machines.
git-svn-id: http://voip.null.ro/svn/yate@5612 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-07 09:49:52 +00:00
paulc 86ef36ca7f Separated 32 and 64 bit constructors and assignments for String.
git-svn-id: http://voip.null.ro/svn/yate@5611 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-06 15:42:44 +00:00
paulc 18e10bfd69 Changed license terms in each source file to reference an external file.
git-svn-id: http://voip.null.ro/svn/yate@5609 acf43c95-373e-0410-b603-e72c3f656dc1
2013-08-06 13:38:10 +00:00
paulc 5c91367b63 Added class to handle Unicode characters and their UTF-8 conversions.
Made String handling of UTF-8 and Unicode easier.


git-svn-id: http://voip.null.ro/svn/yate@5507 acf43c95-373e-0410-b603-e72c3f656dc1
2013-05-20 15:00:26 +00:00
paulc 7c8b2d4c38 Added a shared static list of Atom strings and an YATOM macro.
This speeds up signifficantly the Yate RTTI on compilers that HAVE_BLOCK_RETURN.
Made the String comparison operator inline to shave off a few cycles.
Fast handle the comparison in identity case.


git-svn-id: http://voip.null.ro/svn/yate@5449 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 13:19:14 +00:00
oana 804410fec4 Optimized String::msgEscape() and String::msgUnescape() functions.
Added String::append(const char* value, int len) function to the API.
Inlined String::operator+=(const char* value) to use the new String::append() API function.



git-svn-id: http://voip.null.ro/svn/yate@5436 acf43c95-373e-0410-b603-e72c3f656dc1
2013-04-12 12:39:04 +00:00
oana 4914256ecb Slight optimization of String operator += by replacing the use of strncat with strncpy.
git-svn-id: http://voip.null.ro/svn/yate@5412 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-15 16:20:37 +00:00
oana 5872a89ee4 Changed declaration of String::hash() to inline function.
git-svn-id: http://voip.null.ro/svn/yate@5406 acf43c95-373e-0410-b603-e72c3f656dc1
2013-02-14 14:29:41 +00:00
paulc d83aad16d3 Reduce complexity of appending multiple objects to a list.
git-svn-id: http://voip.null.ro/svn/yate@5271 acf43c95-373e-0410-b603-e72c3f656dc1
2012-09-19 10:59:42 +00:00
paulc e88762e14f Added String method that converts to long integer.
git-svn-id: http://voip.null.ro/svn/yate@4899 acf43c95-373e-0410-b603-e72c3f656dc1
2012-02-13 08:27:48 +00:00
paulc 40abd053c0 Fixed meaning of parameter: clump -> clamp.
git-svn-id: http://voip.null.ro/svn/yate@4563 acf43c95-373e-0410-b603-e72c3f656dc1
2011-08-23 15:47:01 +00:00
marian 4fc28f755c String to integer conversion can now check the result against allowed min/max values. Use it in sip module.
git-svn-id: http://voip.null.ro/svn/yate@4562 acf43c95-373e-0410-b603-e72c3f656dc1
2011-08-23 15:14:28 +00:00
paulc 471dd0d96d New YSTRING macro that creates an ad-hoc static const String to speed up comparations and conversions from literal strings.
On unsupported compilers the literal string is returned unchanged.


git-svn-id: http://voip.null.ro/svn/yate@4423 acf43c95-373e-0410-b603-e72c3f656dc1
2011-06-03 12:26:53 +00:00
paulc dcadd1f961 Added methods to extract a fragment of a String up to a separator.
git-svn-id: http://voip.null.ro/svn/yate@4229 acf43c95-373e-0410-b603-e72c3f656dc1
2011-03-28 16:18:45 +00:00
marian 3f936c5459 Optimized String append from ObjList: calculate required space, allocate it and then build the new string.
git-svn-id: http://voip.null.ro/svn/yate@3811 acf43c95-373e-0410-b603-e72c3f656dc1
2010-11-12 16:34:26 +00:00
paulc 56a86e22cd Made the private pointer of Regexp mutable so compile() and matches() can be made const.
Part of a patch by Allan Sandfeld Jensen.


git-svn-id: http://voip.null.ro/svn/yate@3390 acf43c95-373e-0410-b603-e72c3f656dc1
2010-06-17 11:36:52 +00:00
paulc 1584e08737 Use the sdbm string hashing algorithm from http://www.cse.yorku.ca/~oz/hash.html
Patch recommended by Allan Sandfeld Jensen.


git-svn-id: http://voip.null.ro/svn/yate@3372 acf43c95-373e-0410-b603-e72c3f656dc1
2010-06-11 12:29:00 +00:00
paulc 6e23c56d28 Spelling cleanup of a very common error: Retrive -> Retrieve
git-svn-id: http://voip.null.ro/svn/yate@3371 acf43c95-373e-0410-b603-e72c3f656dc1
2010-06-11 11:25:10 +00:00
paulc 2dd651a1bd Use the * precision specification in sprintf to allow format checks.
git-svn-id: http://voip.null.ro/svn/yate@3147 acf43c95-373e-0410-b603-e72c3f656dc1
2010-03-26 09:41:42 +00:00
paulc 794b49a7e2 Improved checking of String appending during race conditions.
git-svn-id: http://voip.null.ro/svn/yate@3137 acf43c95-373e-0410-b603-e72c3f656dc1
2010-03-22 12:15:46 +00:00
paulc 13559bc05a Fortify String appending against concurrency conditions so the resulting string is at most garbled or truncated.
It was possible to overwrite arbitrary amounts of memory if the String itself or the appended value were modified during the appending operation.


git-svn-id: http://voip.null.ro/svn/yate@3133 acf43c95-373e-0410-b603-e72c3f656dc1
2010-03-22 11:30:24 +00:00
paulc 8afde4d6b1 Precompile regular expressions on construction from constant string so it won't need to compile on first call.
git-svn-id: http://voip.null.ro/svn/yate@3046 acf43c95-373e-0410-b603-e72c3f656dc1
2010-01-31 20:05:43 +00:00
paulc 8d74d5d8de String::uriEscape() takes an extra optional parameter with characters that should not be escaped, for specific cases when a protocol makes some characters unreserved.
git-svn-id: http://voip.null.ro/svn/yate@2816 acf43c95-373e-0410-b603-e72c3f656dc1
2009-09-01 14:32:00 +00:00
paulc eb2a9cd5e0 Fixed warnings and a few minor bugs when compiling on a different architecture.
git-svn-id: http://voip.null.ro/svn/yate@2724 acf43c95-373e-0410-b603-e72c3f656dc1
2009-06-19 11:19:20 +00:00
paulc c104e5be07 Fixed some warnings and genuine bugs exposed by newer gcc.
git-svn-id: http://voip.null.ro/svn/yate@2447 acf43c95-373e-0410-b603-e72c3f656dc1
2009-01-20 12:27:53 +00:00
paulc 678a2cac87 Added new String method trimSpaces.
git-svn-id: http://voip.null.ro/svn/yate@2403 acf43c95-373e-0410-b603-e72c3f656dc1
2008-12-19 14:16:53 +00:00
paulc c09ceca574 Added static empty instances of ObjList and NamedList.
git-svn-id: http://voip.null.ro/svn/yate@2280 acf43c95-373e-0410-b603-e72c3f656dc1
2008-10-22 13:32:25 +00:00
marian 96c6505fd1 Fixed bug: String descendants are now calling the parent's changed() method to allow the String to update its data.
git-svn-id: http://voip.null.ro/svn/yate@2049 acf43c95-373e-0410-b603-e72c3f656dc1
2008-07-02 14:49:21 +00:00