⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 contain.cxx

📁 pwlib源码库
💻 CXX
📖 第 1 页 / 共 5 页
字号:
/* * contain.cxx * * Container Classes * * Portable Windows Library * * Copyright (c) 1993-1998 Equivalence Pty. Ltd. * * The contents of this file are subject to the Mozilla Public License * Version 1.0 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See * the License for the specific language governing rights and limitations * under the License. * * The Original Code is Portable Windows Library. * * The Initial Developer of the Original Code is Equivalence Pty. Ltd. * * Portions are Copyright (C) 1993 Free Software Foundation, Inc. * All Rights Reserved. * * Contributor(s): ______________________________________. * * $Log: contain.cxx,v $ * Revision 1.171  2005/08/08 07:01:58  rjongbloed * Minor changes to remove possible ambiguity where virtual and non-virtual *   functions are overloaded. * Removed commented out code. * * Revision 1.170  2005/05/02 13:10:24  csoutheren * Fixed problem with PString::SetMinSize not always uniquing the string * * Revision 1.169  2005/05/02 09:02:35  csoutheren * Fixed previous fix to contain.cxx which broke PString::MakeUnique * * Revision 1.168  2005/04/28 04:48:41  csoutheren * Changed PContainer::SetSize to not unique a container when the size is unchanged * * Revision 1.167  2005/01/09 06:35:05  rjongbloed * Fixed ability to make Clone() or MakeUnique() of a sorted list. * * Revision 1.166  2004/10/21 13:04:21  rjongbloed * Fixed possibility of const operator[] on PStringArray returning a NULL reference. This *   function should return a non-lvalue PString anyway as it is const! * * Revision 1.165  2004/08/04 00:56:16  csoutheren * Added protection against signed chars triggering asserts in VS.net in debug mode * Thanks to Michal Zygmuntowicz * * Revision 1.164  2004/07/19 13:55:00  csoutheren * Fixed typo flagged as warning by gcc 3.5-20040704 * * Revision 1.163  2004/07/11 07:56:36  csoutheren * Applied jumbo VxWorks patch, thanks to Eize Slange * * Revision 1.162  2004/06/08 01:31:07  csoutheren * Make the test sense correct for the init(NULL) * * Revision 1.161  2004/06/08 01:29:00  csoutheren * Removed memory leak on VS.net caused by unobvious iostream allocation * * Revision 1.160  2004/05/28 23:59:23  csoutheren * Added guards for negative offsets and lengths in various PString functions * * Revision 1.159  2004/05/13 14:52:32  csoutheren * Allow PString::IsEmpty to return TRUE when theArray is NULL * * Revision 1.158  2004/05/04 11:10:37  rjongbloed * Fixed usage of MakeEmpty() with PStringStream. * * Revision 1.157  2004/04/24 06:27:56  rjongbloed * Fixed GCC 3.4.0 warnings about PAssertNULL and improved recoverability on *   NULL pointer usage in various bits of code. * * Revision 1.156  2004/04/18 04:33:37  rjongbloed * Changed all operators that return BOOL to return standard type bool. This is primarily *   for improved compatibility with std STL usage removing many warnings. * * Revision 1.155  2004/04/15 03:50:35  csoutheren * Fixed problem with MakeUnique * * Revision 1.154  2004/04/14 23:34:52  csoutheren * Added plugin for data access * * Revision 1.153  2004/04/12 00:36:05  csoutheren * Added new class PAtomicInteger and added Windows implementation * * Revision 1.152  2004/04/11 06:15:36  csoutheren * Modified to use Atomic_word if available * * Revision 1.151  2004/04/11 02:55:18  csoutheren * Added PCriticalSection for Windows * Added compile time option for PContainer to use critical sections to provide thread safety under some circumstances * * Revision 1.150  2004/04/09 06:38:11  rjongbloed * Fixed compatibility with STL based streams, eg as used by VC++2003 * * Revision 1.149  2004/04/03 23:53:09  csoutheren * Added various changes to improce compatibility with the Sun Forte compiler *   Thanks to Brian Cameron * Added detection of readdir_r version * * Revision 1.148  2004/04/03 08:22:21  csoutheren * Remove pseudo-RTTI and replaced with real RTTI * * Revision 1.147  2004/04/03 06:54:25  rjongbloed * Many and various changes to support new Visual C++ 2003 * * Revision 1.146  2004/03/20 04:20:34  rjongbloed * Fixed some VxWorks port issues especially underrrun memory access in *   the PString::FindLast function,, thanks Eize Slange * * Revision 1.145  2004/02/23 00:44:38  csoutheren * A completely different, other regex include hack to avoid requiring * the sources when using a header-file only environment * * Revision 1.144  2004/02/23 00:26:05  csoutheren * Finally, a generic and elegant fix for the regex include hacks.  Thanks to Roger Hardiman * * Revision 1.143  2004/02/15 03:04:52  rjongbloed * Fixed problem with PSortedList nil variable and assignment between instances, *   pointed out by Ben Lear. * * Revision 1.142  2004/02/11 05:09:14  csoutheren * Fixed problems with regex libraries on Solaris, and with host OS numbering * being a quoted string rather than a number. Thanks to Chad Attermann * Fixed problems SSL detection problems thanks to Michal Zygmuntowicz * * Revision 1.141  2004/02/08 11:13:20  rjongbloed * Fixed crash in heavily loaded multi-threaded systems using simultaneous sorted *   lists, Thanks Federico Pinna, Fabrizio Ammollo and the gang at Reitek S.p.A. * * Revision 1.140  2004/01/17 17:28:25  csoutheren * Changed PString::Empty to be inline in header file * * Revision 1.139  2004/01/16 13:24:38  csoutheren * Changed PString::Empty to be thread-safe * Fixed PContainer::SetMinSize and PAbstractArray::SetSize, thanks to 123@call2ua.com * Fixed PString::FindLast, thanks to Andreas Sikkema * * Revision 1.138  2003/12/14 01:12:00  csoutheren * Added return value to PRegularExpression::operator = again (Doh!) * * Revision 1.137  2003/12/13 23:08:46  csoutheren * Changed PRegularExpression to allow a copy constructor and operator = * * Revision 1.136  2003/12/04 13:12:41  csoutheren * Fixed error in PRegularExpression that caused double delete when incorrect regular expression used * * Revision 1.135  2003/09/17 09:02:13  csoutheren * Removed memory leak detection code * * Revision 1.134  2003/07/28 18:44:01  dsandras * Make use of the libc regex on Linux. * * Revision 1.133  2003/05/14 00:48:33  rjongbloed * Added constructor to string lists/arrays etc that takes a single PString. * Fixed bug in doing a MakeUnique on a container, it would lose the *   DisallowDeleteObjects flag. * * Revision 1.132  2003/04/28 09:14:14  robertj * Fixed bad sign extension problem in PBYTEArray output * * Revision 1.131  2003/04/15 07:08:37  robertj * Changed read and write from streams for base array classes so operates in *   the same way for both PIntArray and PArray<int> etc * * Revision 1.130  2003/03/31 01:24:23  robertj * Added ReadFrom functions for standard container classes such as *   PIntArray and PStringList etc * * Revision 1.129  2003/03/05 08:48:32  robertj * Added PStringArray::ToCharAray() function at suggestion of Ravelli Rossano * * Revision 1.128  2003/02/02 23:29:34  robertj * Fixed bug in RightTrim() (lost off last non blank char), tnanks Joerg Schoemer * * Revision 1.127  2002/12/16 08:10:35  robertj * Fixed infinite loop when converting an illegal (incomplete) UTF-8 string *   to UCS-2, thanks Chih-Wei Huang * * Revision 1.126  2002/11/26 01:08:33  robertj * Fixed problem when using pre-initialised PStringStream greater than 255 *   bytes, would truncate and lose trailing null. Reported by Thien Nguyen * * Revision 1.125  2002/11/12 09:18:03  robertj * Added PString::NumCompare() as functional equivalent of strncmp(). * Added PSortedStringList::GetNextStringsIndex() to do searches of binary *   tree on partal strings. * * Revision 1.124  2002/11/01 05:10:01  robertj * Fixed bug in UTF-8 to UCS-2 conversion, not compiler portable! * * Revision 1.123  2002/10/31 07:33:59  robertj * Changed UTF-8 to UCS-2 conversion function to not include trailing null. * * Revision 1.122  2002/10/31 05:55:55  robertj * Now comprehensively stated that a PString is ALWAYS an 8 bit string as *   there are far too many inheerent assumptions every to make it 16 bit. * Added UTF-8/UCS-2 conversion functions to PString. * * Revision 1.121  2002/10/10 04:43:44  robertj * VxWorks port, thanks Martijn Roest * * Revision 1.120  2002/08/14 00:43:40  robertj * Added ability to have fixed maximum length PStringStream's so does not do *   unwanted malloc()'s while outputing data. * * Revision 1.119  2002/08/06 08:51:36  robertj * Added missing va_end, thanks Klaus Kaempf * * Revision 1.118  2002/06/27 06:59:34  robertj * Removed memory leak display of static that is not really a leak. * * Revision 1.117  2002/06/25 02:24:24  robertj * Improved assertion system to allow C++ class name to be displayed if *   desired, especially relevant to container classes. * * Revision 1.116  2002/06/24 06:18:36  robertj * Fixed bug when getting extra space at start of outputing PBaseArray. * Added ability to not include ASCII in PbaseArray output using ios::fixed. * * Revision 1.115  2002/06/19 04:04:30  robertj * Fixed bug in setting/getting bits from PBitArray, could exceed array bounds. * * Revision 1.114  2002/06/17 09:16:18  robertj * Fixed strange deadlock woth gcc 3.0.2, thanks Artis Kugevics * * Revision 1.113  2002/06/14 13:22:52  robertj * Added PBitArray class. * * Revision 1.112  2002/06/05 12:29:15  craigs * Changes for gcc 3.1 * * Revision 1.111  2002/04/09 02:30:18  robertj * Removed GCC3 variable as __GNUC__ can be used instead, thanks jason Spence * * Revision 1.110  2002/02/15 04:30:39  robertj * Added PString::Empty() to return the primordial empty string. Saves on a *   couple of memory allocations for every empty string ever used. * Changed every place where a const char * is used with PString so that a *   NULL pointer is treated like an empty string instead of asserting. * * Revision 1.109  2002/01/26 23:57:45  craigs * Changed for GCC 3.0 compatibility, thanks to manty@manty.net * * Revision 1.108  2002/01/22 01:03:57  craigs * Added operator += and operator + functions to PStringArray and PStringList * Added AppendString operator to PStringArray * * Revision 1.107  2001/10/30 00:20:12  robertj * Fixed broken signed number conversion from previous change. * * Revision 1.106  2001/10/18 00:35:08  robertj * Fixed problem with Tokenise() includeing empty string at beginning when *   not in onePerSeparator mode and a separator starts the string. * * Revision 1.105  2001/10/17 05:09:22  robertj * Added contructors and assigmnent operators so integer types can be *   automatically converted to strings. * * Revision 1.104  2001/08/11 15:01:44  rogerh * Add Mac OS Carbon changes from John Woods <jfw@jfwhome.funhouse.com> * * Revision 1.103  2001/05/08 23:27:12  robertj * Fixed, yet again, case significance in hash function. * * Revision 1.102  2001/04/26 03:45:19  robertj * Changed PString has function again, use a prime number for modulus. * * Revision 1.101  2001/04/24 02:39:18  robertj * Fixed problem with new string hash function giving negative indexes. * * Revision 1.100  2001/04/23 03:13:16  robertj * Changed PString hash function to better one, thanks Patrick Koorevaar * * Revision 1.99  2001/04/18 04:10:15  robertj * Removed hash function for caseless strings as confuses mixed dictionaries. * * Revision 1.98  2001/04/18 01:20:59  robertj * Fixed problem with hash function for short strings, thanks Patrick Koorevaar. * Also fixed hash function for caseless strings. * * Revision 1.97  2001/03/14 01:51:01  craigs * Changed to handle CRLF at end of PString::ReadFrom as well as LF * * Revision 1.96  2001/02/26 07:50:18  robertj * Updated regular expression parser to latest version from Henry Spencer. * * Revision 1.95  2001/02/21 03:38:37  robertj * Added ability to copy between various string lists/arrays etc during construction. * * Revision 1.94  2001/02/14 22:21:08  robertj * Fixed compiler error on some versions of GCC, thanks Klaus Kaempf. * * Revision 1.93  2001/02/14 06:50:01  robertj * Fixed bug in doing ::flush on a PStringStream, did not set pointers correctly. * * Revision 1.92  2001/02/13 04:39:08  robertj * Fixed problem with operator= in container classes. Some containers will *   break unless the copy is virtual (eg PStringStream's buffer pointers) so *   needed to add a new AssignContents() function to all containers. * * Revision 1.91  2000/12/29 07:36:57  craigs * Fixed problem with Tokenise function returning NULL entries in array * * Revision 1.90  2000/10/12 05:14:41  robertj * Fixed crash caused by previous change, didn;t work if in constructor. * * Revision 1.89  2000/10/09 23:43:58  robertj * Fixed GNU C++ compatibility on last change. * * Revision 1.88  2000/10/09 23:37:17  robertj * Improved PString sprintf functions so no longer limited to 1000 characters, thanks Yuriy Ershov. * * Revision 1.87  2000/06/26 11:17:20  robertj * Nucleus++ port (incomplete). * * Revision 1.86  2000/04/07 06:29:46  rogerh * Add a short term workaround for an Internal Compiler Error on MAC OS X when * returning certain types of PString. Submitted by Kevin Packard. * * Revision 1.85  2000/02/05 22:36:09  craigs * Fixed problem caused by last modification * * Revision 1.84  2000/02/04 19:34:26  craigs * Fixed problem with changing size of referenced objects * * Revision 1.83  2000/01/25 14:05:35  robertj * Added optimisation to array comparisons if referencing same array. * * Revision 1.82  1999/08/18 01:45:13  robertj * Added concatenation function to "base type" arrays. * * Revision 1.81  1999/08/17 03:46:40  robertj * Fixed usage of inlines in optimised version. * * Revision 1.80  1999/08/12 12:12:47  robertj * GCC 2.95 compatibility. * * Revision 1.79  1999/05/28 14:01:53  robertj * Added initialisers to string containers (list, sorted list and set). * * Revision 1.78  1999/04/18 09:36:31  robertj * Get date grammar build. * * Revision 1.77  1999/04/16 14:38:37  craigs * Changes to make getdate.y compile under Linux * * Revision 1.76  1998/10/28 00:58:40  robertj * Changed PStringStream so flush or endl does not clear the string output, this now *    just sets the string to minimum size. * * Revision 1.75  1998/10/13 14:06:18  robertj * Complete rewrite of memory leak detection code. * * Revision 1.74  1998/09/23 06:21:54  robertj * Added open source copyright license. * * Revision 1.73  1998/09/22 02:42:39  robertj * Fixed problem treating unsigned integer as signed in PString contructor. * * Revision 1.72  1998/09/15 08:26:42  robertj * Fixed a number of warnings at maximum optimisation. * * Revision 1.71  1998/09/14 12:36:29  robertj * Fixed bug causing memory leak due to uninitialised member variable for dynamic allocation of arrays. * * Revision 1.70  1998/08/21 05:24:07  robertj * Added hex dump capability to base array types. * Added ability to have base arrays of static memory blocks. * * Revision 1.69  1998/03/17 10:13:23  robertj * Fixed bug in Trim() should do all white space not just the space character. * * Revision 1.68  1998/01/26 00:37:48  robertj * Fixed PString & operator putting space in if right hand side is empty string, it shouldn't.. * Added Execute() functions to PRegularExpression that take PINDEX references instead of PIntArrays. * Added FindRegEx function to PString that returns position and length. * * Revision 1.67  1997/12/11 13:32:49  robertj * Added AsUnsigned() function to convert string to DWORD. * * Revision 1.66  1997/07/08 13:14:41  robertj * Fixed bug where freeing null pointer. * * Revision 1.65  1997/06/08 04:48:04  robertj * Added regular expressions. * * Revision 1.64  1997/03/02 03:41:42  robertj * Fixed bug in not being able to construct a zero length PStringArray. * * Revision 1.63  1996/10/08 13:13:25  robertj * Added operator += and &= for char so no implicit PString construction. * * Revision 1.62  1996/09/14 12:45:57  robertj * Fixed bug in PString::Splice() function, no end of string put in. * * Revision 1.61  1996/08/22 13:21:55  robertj * Fixed major bug in FindLast(), could scan all of memory in negative direction. * * Revision 1.60  1996/08/08 10:08:45  robertj * Directory structure changes for common files. * * Revision 1.59  1996/05/26 03:46:27  robertj * Compatibility to GNU 2.7.x * * Revision 1.58  1996/05/15 10:17:02  robertj * Fixed idiotic bug in string compare, caseless version always matched. * * Revision 1.57  1996/05/09 12:17:10  robertj * Fixed incorrect use of memcmp/strcmp return value. * Added assertion when finding empty string. * * Revision 1.56  1996/04/14 02:52:39  robertj * Fixed bug in PString::FindLast(), never found sub-strings. * * Revision 1.55  1996/03/31 08:58:49  robertj * Fixed hash function for strings to work for caseless strings. * * Revision 1.54  1996/03/16 04:56:59  robertj * Fixed bug in PStringStream assignment oeprator getting pointers wrong. * * Revision 1.53  1996/03/02 03:20:11  robertj * Fixed bug in PString::Find() not finding substring if exactly same as string. * * Revision 1.52  1996/02/22 10:23:54  robertj * Fixed buf in *= operator only comparing up to shortest string. * Fixed bug in & operator for if left string is empty. * * Revision 1.51  1996/02/19 13:34:53  robertj * Removed PCaselessString hash function to fix dictionary match failure. * Fixed *= operator yet again. * * Revision 1.50  1996/02/08 12:20:44  robertj * Added new operators to PString for case insensitive compare and spaced concatenate. * Fixed bug in Find() not finding case insensitive substrings. * * Revision 1.49  1996/02/03 11:08:51  robertj * Changed memcpy to memove to guarentee string operations will work correctly *    when moving overlapping strings around eg in PString::Splice(). * * Revision 1.48  1996/01/28 14:12:22  robertj * Fixed bug in Tokenise() for first token empty and PINDEX unsigned. * * Revision 1.47  1996/01/28 02:53:40  robertj * Added assert into all Compare functions to assure comparison between compatible objects. * Fixed bug in Find() function, subset sum calculation added one to many bytes. * * Revision 1.46  1996/01/24 14:43:19  robertj * Added initialisers to string dictionaries. * * Revision 1.45  1996/01/23 13:17:38  robertj * Added Replace() function to strings. * String searching algorithm rewrite. * * Revision 1.44  1996/01/02 12:51:05  robertj * Mac OS compatibility changes. * Removed requirement that PArray elements have parameterless constructor.. * * Revision 1.43  1995/10/14 15:07:42  robertj * Changed arrays to not break references, but strings still need to. * * Revision 1.42  1995/06/17 00:46:20  robertj * Added flag for PStringArray constructor to create caseless strings. * Fixed bug in arrays when size set to zero. * * Revision 1.41  1995/06/04 12:39:59  robertj * Made char * array all const in PStringArray constructor. * * Revision 1.40  1995/04/25 11:29:38  robertj * Fixed Borland compiler warnings. * * Revision 1.39  1995/04/02 09:27:27  robertj * Added "balloon" help. * * Revision 1.38  1995/03/12 04:46:02  robertj * Fixed use of PCaselessString as dictionary key. * * Revision 1.37  1995/01/15  04:56:28  robertj * Fixed PStringStream for correct pointer calculations in output. * * Revision 1.36  1995/01/10  11:44:13  robertj * Removed PString parameter in stdarg function for GNU C++ compatibility. * * Revision 1.35  1995/01/09  12:32:56  robertj * Removed unnecesary return value from I/O functions. * Changed function names due to Mac port. * * Revision 1.34  1995/01/04  10:57:08  robertj * Changed for HPUX and GNU2.6.x * * Revision 1.33  1995/01/03  09:39:08  robertj * Put standard malloc style memory allocation etc into memory check system. * * Revision 1.32  1994/12/13  11:50:56  robertj * Added MakeUnique() function to all container classes. * * Revision 1.31  1994/12/12  13:13:17  robertj * Fixed bugs in PString mods just made. * * Revision 1.30  1994/12/12  10:16:27  robertj * Restructuring and documentation of container classes. * Renaming of some macros for declaring container classes. * Added some extra functionality to PString. * Added start to 2 byte characters in PString. * Fixed incorrect overrides in PCaselessString. * * Revision 1.29  1994/12/05  11:19:36  robertj * Moved SetMinSize from PAbstractArray to PContainer. * * Revision 1.28  1994/11/28  12:37:29  robertj * Added dummy parameter to container classes. * * Revision 1.27  1994/10/30  11:50:44  robertj * Split into Object classes and Container classes. * Changed mechanism for doing notification callback functions. * * Revision 1.26  1994/10/23  03:43:07  robertj * Changed PBaseArray so can have zero elements in it. * Added Printf style constructor to PString. * * Revision 1.25  1994/09/25  10:49:44  robertj * Added empty functions for serialisation.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -