home *** CD-ROM | disk | FTP | other *** search
/ Shareware Supreme Volume 6 #1 / swsii.zip / swsii / 099 / STRPP300.ZIP / STR.HIS < prev    next >
Text File  |  1993-04-11  |  9KB  |  260 lines

  1.  
  2.                        String++ Revision History
  3.  
  4. -----------------------------------------------------------------------
  5.  
  6. Version 3.0
  7.  
  8. - Support for Borland's container class library (BCCL). There is a BCCL
  9.   compatible version of String++ in strng.*. You can completely replace
  10.   the String module in the class library and get all the functionality
  11.   of String++. See strng.doc for instructions.
  12.  
  13. - The class has been renamed "String" instead of "string" for compati-
  14.   bility with Borland's container class library. The old class name is
  15.   still supported via a typedef.
  16.  
  17. - Support for regular expressions. There is a new class named RegExp
  18.   that is used to declare a regular expression, and a match() function
  19.   for comparisons. For example, if you want to see if a filename has a
  20.   .BAK extension, you can do this:
  21.  
  22.     String FileName = GetFileName();
  23.     Regexp expr = "\.BAK$";
  24.  
  25.     if(match(FileName, expr) != -1)
  26.       do_something();
  27.  
  28.   You could also use the == operator, which is a substitute for the ~
  29.   operator used in AWK:
  30.  
  31.     if(FileName == expr)
  32.       do_something();
  33.  
  34.   A number of string functions have been overloaded to accept regular
  35.   expressions. Like the other AWK functions included with String++, the
  36.   match function returns the substring's position using C's 0-based
  37.   array position instead of AWK's 1-based array position. Therefore, a
  38.   return value of -1 is used to signify no match. For more information
  39.   regarding regular expressions, consult a book on Unix or AWK (such as
  40.   _The AWK Programming Language_ by Aho, Weinberger, and Kernighan).
  41.  
  42. - There are two other new classes included with String++: FileString
  43.   and ParseString. FileString takes a string that represents a file
  44.   name and decomposes it into separate strings for drive, path, file
  45.   name, and file extension. ParseString is a String-derived class that
  46.   adds functions and operators that are useful in parsing functions.
  47.   The RegExp class uses the ParseString class.
  48.  
  49. - Create strings from floating point numbers. Such strings are format-
  50.   ted using a format specifier as described in printf(). The format
  51.   string can be set by the SetFloatFormat() function or passed in the
  52.   constructor.
  53.  
  54. - The Replace function can be used to replace a substring based on its
  55.   position in the string or based on its contents:
  56.  
  57.       String s1 = "This is an old substring";
  58.     s1.Replace(8, 16, "something else");
  59.   or
  60.     s1.Replace("an old substring", "something else");
  61.  
  62. - Four new Find... functions allow greater flexibilty in locating sub-
  63.   strings.
  64.  
  65. - A cast operator for char will return s[0].
  66.  
  67. - A * operator will also return s[0] (such as char ch = *s1).
  68.  
  69. - The inserter operator << can be used to chain appendages:
  70.  
  71.     s1 << "The value of " << x.Name << " is " << x.Value;
  72.  
  73. - The Justify() function now allows the user to disable trimming a
  74.   string to be justified:
  75.  
  76.     s.Justify(CENTER, 80, CLIP|NOTRIM);
  77.  
  78.   The default is CLIP|TRIM as before.
  79.  
  80. - The Delete function now has a default count value of 1, so that
  81.   s1.Delete(10) will delete only the character at s1[10]. If you want
  82.   to delete from pos to the end-of-string, set count = 0 such as
  83.   s1.Delete(10, 0).
  84.  
  85. - Internal changes have resulted in faster code.
  86.  
  87. - The length of the string is now a data member.
  88.  
  89. - Memory allocation is now controlled by two internal integers: strMin-
  90.   Length and strIncLength. strMinLength determines the minimum amount
  91.   of memory that is allocated for a string, and strIncLength specifies
  92.   the incremental amount of memory that a string will grow by. The
  93.   default values are 16 and 8, respectively. The amount of memory a
  94.   string has allocated is stored in bufferLen (bufferLen actually is
  95.   one byte larger for the NULL termination). Here are some examples:
  96.  
  97.     string s1 = "Hello World";        // s1.bufferLen = 17
  98.     string s1 += ",how are you";        // s1.bufferLen = 25
  99.     string s2 = "String++ Version 3.0"    // s2.bufferLen = 25
  100.  
  101.   The tradeoff here is size for speed. On average each string will
  102.   waste either strMinLength/2 bytes or strIncLength/2 bytes. However,
  103.   if you are doing a lot of manipulation, the extra space will speed up
  104.   string operations since less memory allocation is done. You can set
  105.   these variables by calling the appropriate functions:
  106.  
  107.   SetMinLength(unsigned length)
  108.   SetIncLength(unsigned length)
  109.  
  110.   If you set them both to 1 then the string class will behave like
  111.   Version 2.12 and prior. Remember that setting these variables will
  112.   affect all strings.
  113.  
  114. - Support for obsolete naming conventions (from Version 1.x) has been
  115.   removed.
  116.  
  117. - New functions:
  118.  
  119.   FindFirst()        Find first occurance of a substring
  120.   FindNext()        Find next occurance of a substring
  121.   FindLast()        Find last occurance of a substring
  122.   FindPrev()        Find previous occurance of a substring
  123.   match()        Regular expression matching
  124.   Minimize()        Minimize bufferLen
  125.   Replace()        Replace a substring of s with another string
  126.   SetFloatFormat()      Set the floating point format specifier
  127.   SetIncLength()    Set the minimum incremental length
  128.   SetMinLength()    Set the minimum initial length
  129.   SetSize()        Set bufferLen to a particular size
  130.   operator char        Returns s[0]
  131.   operator *        Returns s[0]
  132.   operator <<        Chains appendages
  133.  
  134. -----------------------------------------------------------------------
  135.  
  136. Version 2.12
  137.  
  138. - Fixed bug in the Copy() function. Copy() will allocate memory for the
  139.   char* and therefore should be passed an uninitialized pointer:
  140.  
  141.   char *p;
  142.   s1.Copy(p);    // allocates memory for p & copies s1 to it
  143.  
  144. - split() is now called with just the array name instead of an address
  145.   to the array:
  146.  
  147.   string *array;
  148.   n = split(str1, &array, " ");        // Old way
  149.   n = split(str1, array, " ");        // New way
  150.  
  151.   Memory for array is still allocated within the split function.
  152.  
  153. - A cast operator has been added. This allows a string instance to be
  154.   passed where a char* is expected. Previously, you had to use the ()
  155.   operator or the ptr() function to return the char* contents of a
  156.   string:
  157.  
  158.   string s = "Hello";
  159.   char p[6];
  160.  
  161.   strcpy(p,s());    // old way
  162.   strcpy(p, s);        // new way
  163.  
  164.   The cast operator returns a const char* just like the () operator.
  165.  
  166. -----------------------------------------------------------------------
  167.  
  168. Version 2.11
  169.  
  170. - Fixed bug in int constructor.
  171.  
  172. -----------------------------------------------------------------------
  173.  
  174. Version 2.10
  175.  
  176. - Derived class String from class string for those who prefer the capi-
  177.   talized spelling.
  178.  
  179. - Minor documentation changes
  180.  
  181. -----------------------------------------------------------------------
  182.  
  183. Version 2.01
  184.  
  185. - Minor bug fixes
  186.  
  187. -----------------------------------------------------------------------
  188.  
  189. Version 2.0
  190.  
  191. - Added iostream support.
  192.  
  193. - Enhanced [] operator can now assign individual characters.
  194.  
  195. - Comparison functions are now implemented as inline.
  196.  
  197. - New general functions:
  198.  
  199.   Insert()    inserts text in str
  200.   Delete()      deletes a substring of str
  201.   Copy()        copies str to a non-const char*
  202.   Trim()    trims leading or trailing multiple chars from str.
  203.   Value()       returns the numeric value (int or long) of str.
  204.  
  205. - Existing methods have been renamed to begin with an uppercase letter,
  206.   such as string::justify() -> string::Justify(). The older naming con-
  207.   ventions are still supported for backwards compatibility. Most member
  208.   methods now operate directly on the string itself instead of returning
  209.   a new string. For example, str1.Justify() will modify str1 instead of
  210.   creating a new string. C-style function names remain all lower-case
  211.   and return newly created strings, so str2 = justify(str1, LEFT, 80)
  212.   will not modify str1.
  213.  
  214. - AWK functions are also implemented as member methods that directly
  215.   modify the string object. These versions begin with an uppercase.
  216.  
  217. - Constructors and = operators added for int & long data types. New
  218.   function Value() returns the numeric value of a string.
  219.  
  220. - The () operator continues to return a const char* to the string
  221.   object's data, but the ptr() method now returns a non-const char*.
  222.   Therefore, if you need to pass a string's contents to a C-style func-
  223.   tion that wants a non-const char*, use ptr():
  224.  
  225.   Old way:
  226.  
  227.         strupr((char *)s1());    // strupr() wants to modify s1 directly
  228.                                 //   so s1 must be cast as non-const
  229.   New way:
  230.  
  231.       strupr(s1.ptr());       // s1.ptr() is now non-const
  232.  
  233.   Returning a non-const char* completely strips the inherent protection
  234.   that the string class offers and can be very dangerous. Use this with
  235.   caution.
  236.  
  237. -----------------------------------------------------------------------
  238.  
  239. Version 1.1
  240.  
  241. - Bug fixes, mostly memory leaks.
  242.  
  243. - Rewrote several functions for improved efficiency.
  244.  
  245. - Improved demo program.
  246.  
  247. - gsub() is generalized with the inclusion of a num parameter.
  248.  
  249. - New justify() function.
  250.  
  251. - New operators * and *=.
  252.  
  253. -----------------------------------------------------------------------
  254.  
  255. Version 1.0
  256.  
  257. - Initial release.
  258.  
  259. -----------------------------------------------------------------------
  260.