home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c221 / 2.ddi / DOC / TOOLS4_2.DOC < prev    next >
Encoding:
Text File  |  1992-04-01  |  315.7 KB  |  12,514 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.                                      Part 2:
  21.                                     Tools.h++
  22.                                  Class Reference
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.                                                         Class Reference
  35.  
  36.  
  37.  
  38.           Because C++ is still a young language, there is no standard
  39.           way to structure a reference manual for a class or group of
  40.           classes.  The reference is presented here as an alphabetical
  41.           listing of classes with their member and global functions
  42.           grouped in categories according to their general use.  The
  43.           categories are not a part of the C++ language, but do provide
  44.           a way of organizing the many functions.
  45.           Each class includes a brief description, an illustration
  46.           showing its inheritance hierarchy, and a synopsis, indicating
  47.           the header file(s) and Smalltalk typedef (if appropriate)
  48.           associated with the class.  The synopsis also shows a
  49.           declaration and definition of a class object, and any typedefs
  50.           that are used.
  51.           Member functions for each class are listed alphabetically.
  52.           Member functions fall into three general types:
  53.           1. Functions that are unique to a class.  The complete
  54.              documentation for these functions is presented in the
  55.              class where they occur.  An example is balance(), a member
  56.              of the class BinaryTree.
  57.           2. Functions that are inherited from a base class without
  58.              being redefined.  The complete documentation for these
  59.              functions is presented in the defining base class.  An
  60.              example is clearAndDestroy(), for class RWBinaryTree,
  61.              which is inherited from class RWCollection.
  62.           3. Functions that are redefined in a derived class.  These
  63.              are usually virtual functions.  The documentation for
  64.              these functions usually directs you to the base class, but
  65.              may also mention peculiarities that are relevant to the
  66.              derived class.  An example is apply(), for class
  67.              RWBinaryTree.
  68.           There are two general methods for finding an object within a
  69.           collection:
  70.           1. One can find an object that is identical to a key (i.e.,
  71.              with the same address).  Member functions that work this
  72.              way generally have names like findReference(), or
  73.              occurrencesOfReference(), etc.  For some of the collection
  74.              classes, this is the only way that you can find an object.
  75.              These types of collections have the word "Identity" in
  76.              their name (RWIdentitySet and RWIdentityDictionary).
  77.  
  78. Tools.h++ Class Library     165
  79.  
  80.  
  81.  
  82.  
  83.  
  84.  
  85.  
  86.  
  87.                       CLASS REFERENCE
  88.  
  89.           2. One can look for an object that is equal to a key.  Here,
  90.              there are two different techniques.  The first is to find
  91.              an object that returns true for a "tester" function,
  92.              perhaps using a hash value to narrow the search.  For the
  93.              Smalltalk-like classes, the tester function is the virtual
  94.              function isEqual().  For the generic collection classes, a
  95.              user-defined tester function must be provided.  The second
  96.              technique is to look for an object that compares equal to
  97.              a key.  These collection functions are sorted collections
  98.              that use the virtual function compareTo() to sort their
  99.              items.  An object is considered to have been "found" when
  100.              compareTo() returns zero.  In the documentation that
  101.              follows, the first technique will be referred to as
  102.              finding an object that isEqual to, the second as compares
  103.              equal to.
  104.           Throughout the documentation, there is frequent reference to
  105.           "self." This should be understood to mean *this.
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134. Rogue Wave      Tools.h++ Class Library                  166
  135.  
  136.  
  137.  
  138.  
  139.  
  140.  
  141.  
  142.  
  143.                       CLASS REFERENCE
  144.  
  145.  
  146.  
  147. class GBitVec(size)
  148.  
  149.  
  150.  
  151.  
  152. Synopsis  #include <gbitvec.h>
  153.           declare(GBitVec,size)
  154.  
  155.           GBitVec(size) a;
  156.  
  157.  
  158.  
  159. Descripti GBitVec(size) is a bit vector of fixed length size.  The length
  160. on        cannot be changed dynamically (see class RWBitVec if you need a
  161.           bit vector whose length can be changed at run time).  Objects of
  162.           type GBitVec(size) are declared with macros defined in the
  163.           standard C++ header file <generic.h>.
  164.           Bits are numbered from 0 through size-1, inclusive.
  165.           No copy constructor has been defined.  Hence, copies use the
  166.           default copy constructor (i.e., a bitwise copy will be made).
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190. Rogue Wave      Tools.h++ Class Library                  167
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.                       CLASS REFERENCE
  200.  
  201. Example   In this example, a bit vector 24 bits long is declared and exercised:
  202.           #include <gbitvec.h>
  203.           declare(GBitVec,24)        // declare a 24 bit long vector
  204.  
  205.           main()
  206.  
  207.           {
  208.  
  209.             GBitVec(24) a, b;        // Allocate two vectors.
  210.  
  211.             a(2) = TRUE;             // Set bit 2 (the third bit) of a on.
  212.  
  213.             b(3) = TRUE;             // Set bit 3 (the fourth bit) of b on.
  214.  
  215.             GBitVec c = a ^ b;       // Set c to the XOR of a and b.
  216.  
  217.           }
  218.  
  219.  
  220.  
  221. Public    GBitVec(size)();
  222. construct Construct a bit vector size elements long, with all bits
  223. ors       initialized to FALSE.
  224.  
  225.           GBitVec(size)(RWBoolean f);
  226.           Construct a bit vector size elements long, with all bits
  227.           initialized to f.
  228.  
  229.    GBitVec(size)(unsigned long v);
  230. Construct a bit vector size elements long, initialized to the bits
  231. of v. If size is greater than sizeof(v), the extra bits will be set
  232. to zero.
  233.  
  234.  
  235. AssignmentGBitVec(sz)&        operator=(const GBitVec(sz)& v);
  236. operators Set each element of self to the corresponding bit value of v.
  237.           Return a reference to self.
  238.  
  239.    GBitVec(sz)&     operator=(RWBoolean f);
  240. Set all elements of self to the boolean value f.
  241.  
  242.  
  243.  
  244.  
  245.  
  246. Rogue Wave      Tools.h++ Class Library                  168
  247.  
  248.  
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.                       CLASS REFERENCE
  256.  
  257.    GBitVec(sz)&     operator&=(const GBitVec(sz)& v);
  258.    GBitVec(sz)&     operator^=(const GBitVec(sz)& v);
  259.    GBitVec(sz)&     operator|=(const GBitVec(sz)& v);
  260. Logical assignments.  Set each element of self to the logical AND,
  261. XOR, or OR, respectively, of self and the corresponding bit in v.
  262.  
  263.  
  264. Indexing  RWBitRef            operator[](int i);
  265. operators Returns a reference to the i'th bit of self.  This reference can be
  266.           used as an lvalue.  The index i must be between 0 and sz-1,
  267.           inclusive.  Bounds checking will occur.
  268.  
  269.    RWBitRef         operator()(int i);
  270. Returns a reference to the i'th bit of self.  This reference can be
  271. used as an lvalue.  The index i must be between 0 and sz-1,
  272. inclusive.  No bounds checking is done.
  273.  
  274.  
  275. Logical   RWBoolean           operator==(const GBitVec(sz)& v) const;
  276. operators Returns TRUE if each bit of self is set to the same value as the
  277.           corresponding bit in v.  Otherwise, returns FALSE.
  278.  
  279.    RWBoolean        operator!=(const GBitVec(sz)& v) const;
  280. Returns FALSE if each bit of self is set to the same value as the
  281. corresponding bit in v.  Otherwise, returns TRUE.
  282.  
  283.  
  284. Public    void                clearBit(int i);
  285. member    Clears (i.e., sets to FALSE) the bit with index i.  The index i
  286. functions must be between 0 and size-1.  No bounds checking is performed.
  287.           The following are equivalent, although clearBit(int) is slightly
  288.           smaller and faster than using operator()(int):
  289.  
  290.                  a(i) = FALSE;
  291.                  a.clearBit(i);
  292.  
  293.    const RWByte*    data() const;
  294. Returns a const pointer to the raw data of self.  Should be used
  295. with care.
  296.  
  297.    void             setBit(int i);
  298. Sets (i.e., sets to TRUE) the bit with index i.  The index i must be
  299. between 0 and size-1.  No bounds checking is performed.  The
  300. following are equivalent, although setBit(int) is slightly smaller
  301.  
  302. Rogue Wave      Tools.h++ Class Library                  169
  303.  
  304.  
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.                       CLASS REFERENCE
  312.  
  313. and faster than using operator()(int)
  314.  
  315.                  a(i) = TRUE;
  316.                  a.setBit(i);
  317.  
  318.    RWBoolean        testBit(int i) const;
  319. Tests the bit with index i.  The index i must be between 0 and size-
  320. 1.  No bounds checking is performed.  The following are equivalent,
  321. although testBit(int) is slightly smaller and faster than using
  322. operator()(int):
  323.  
  324.                  if( a(i) )       doSomething();
  325.                  if( testBit(i) ) doSomething();
  326.  
  327.  
  328.  
  329. Related   GBitVec(sz) operator&(const GBitVec(sz)& v1, const GBitVec(sz)& v2);
  330. global    GBitVec(sz) operator^(const GBitVec(sz)& v1, const GBitVec(sz)& v2);
  331. functions GBitVec(sz) operator|(const GBitVec(sz)& v1, const GBitVec(sz)& v2);
  332.           Return the logical AND, XOR, and OR, respectively, of vectors v1
  333.           and v2.
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342.  
  343.  
  344.  
  345.  
  346.  
  347.  
  348.  
  349.  
  350.  
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358. Rogue Wave      Tools.h++ Class Library                  170
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.                       CLASS REFERENCE
  368.  
  369.  
  370.  
  371. class GDlist(type)                                   GDlist(type)
  372.                                                            |
  373.                                                         RWDlist
  374.                                                            |
  375.                                                         RWSlist
  376.  
  377. Synopsis  #include <gdlist.h>
  378.           declare(GDlist, type)
  379.  
  380.           GDlist(type) a;
  381.  
  382.  
  383.  
  384. Descripti Class GDlist(type) represents a group of ordered elements of type
  385. on        type, not accessible by an external key.  Duplicates are allowed.
  386.           This class is implemented as a doubly-linked list.  Objects of type
  387.           GDlist(type) are declared with macros defined in the standard C++
  388.           header file <generic.h>.
  389.           Objects stored and retrieved with class GDlist(type) do not
  390.           need to inherit class RWCollectable.  However, in order to
  391.           find a particular item within the collection, a user-provided
  392.           global "tester" function is required to test for a "match",
  393.           definable in any consistent way.  This function should have
  394.           prototype:
  395.             RWBoolean yourTesterFunction(const type* c, const void* d);
  396.  
  397.           The argument c is a candidate within the collection to be
  398.           tested for a match.  The argument d is for your convenience
  399.           and will be passed to yourTesterFunction().  The function
  400.           should return TRUE if a "match" is found between c and d.
  401.           In order to simplify the documentation below, an imaginary
  402.           typedef
  403.             typedef void (*yourTester)(const type*, const void*);
  404.  
  405.           has been used for this tester function.
  406.  
  407.  
  408.  
  409.  
  410.  
  411.  
  412.  
  413.  
  414. Rogue Wave      Tools.h++ Class Library                  171
  415.  
  416.  
  417.  
  418.  
  419.  
  420.  
  421.  
  422.  
  423.                       CLASS REFERENCE
  424.  
  425. Example   #include <gdlist.h>
  426.           #include <rstream.h>
  427.  
  428.           declare(GDlist,int)  /* Declare a list of ints */
  429.  
  430.           main()
  431.           {
  432.             GDlist(int) list;                 // Define a list of ints
  433.  
  434.             list.insert(new int(5)); // Insert some ints
  435.             list.insert(new int(7));
  436.             list.insert(new int(1));
  437.             list.prepend(new int(11));
  438.  
  439.             GDlistIterator(int) next(list);
  440.  
  441.             while( int* ip = next() )
  442.               cout << *ip << NL;              // Print out the members
  443.           }
  444.  
  445.           Program output:
  446.              11
  447.  
  448.              5
  449.  
  450.              7
  451.  
  452.                        1
  453.  
  454.  
  455.  
  456. Public       GDlist(type)();
  457. constructors Construct an empty collection.
  458.  
  459.    GDlist(type)(type* a);
  460. Construct a collection with one entry a.
  461.  
  462.    GDlist(type)(const GDlist(type)& a);
  463. Copy constructor.  A shallow copy of a is made.
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470. Rogue Wave      Tools.h++ Class Library                  172
  471.  
  472.  
  473.  
  474.  
  475.  
  476.  
  477.  
  478.  
  479.                       CLASS REFERENCE
  480.  
  481.  
  482. Assignmentvoid                operator=(const GDlist(type)& a);
  483. operator  Assignment operator.  A shallow copy of a is made.
  484.  
  485.  
  486. Public    type*               append(type* a);
  487. member    Adds an item to the end of the collection.  Returns nil if the
  488. functions insertion was unsuccessful.
  489.  
  490.    void             apply( (*ap)(type*, void*), void* );
  491. Visits all the items in the collection in order, from first to last,
  492. calling the user-provided function pointed to by ap for each item.
  493. This function should have prototype:
  494.  
  495.                     void yourApplyFunction(type* c, void*);
  496.  
  497. and can perform any operation on the object at address c.  The last
  498. argument is useful for passing data to the apply function.
  499.  
  500.    type*&           at(int i);
  501. Allows access to the i'th element of the collection.  If i is out of
  502. range then an exception with error TOOL_INDEX will occur.  This
  503. variant can be used as an lvalue.
  504.  
  505.    const type*      at(int i) const;
  506. Allows access to the i'th element of the collection.  If i is out of
  507. range then nil is returned.
  508.  
  509.    void             clear();
  510. Removes all items in the collection.
  511.  
  512.    RWBoolean        contains(yourTester t, const void* d) const;
  513. Returns TRUE if the collection contains an item for which the user-
  514. defined function pointed to by t finds a match with d.
  515.  
  516.    RWBoolean        containsReference(const type* e) const;
  517. Returns TRUE if the collection contains an item with the address e.
  518.  
  519.    unsigned         entries() const;
  520. Returns the number of items in the collection.
  521.  
  522.    type*            find(yourTester t, const void* d) const;
  523. Returns the first item in the collection for which the user-provided
  524. function pointed to by t finds a match with d, or nil if no item is
  525.  
  526. Rogue Wave      Tools.h++ Class Library                  173
  527.  
  528.  
  529.  
  530.  
  531.  
  532.  
  533.  
  534.  
  535.                       CLASS REFERENCE
  536.  
  537. found.
  538.  
  539.    type*            findReference(const type* e) const;
  540. Returns the first item in the collection with the address e, or nil
  541. if no item is found.
  542.  
  543.    type*            first() const;
  544. Returns the first item of the collection.
  545.  
  546.    type*            get();
  547. Returns and removes the first item of the collection.
  548.  
  549.    type*            insert(type* e);
  550. Adds an item to the end of the collection and returns it.  Returns
  551. nil if the insertion was unsuccessful.
  552.  
  553.    type*            insertAfter(int i, type* e);
  554. Adds an item after the i'th item of the collection and returns it.
  555. Returns nil if the insertion was unsuccessful.
  556.  
  557.    RWBoolean        isEmpty() const;
  558. Returns TRUE if the collection is empty, otherwise FALSE.
  559.  
  560.    type*            last() const;
  561. Returns the last item of the collection.
  562.  
  563.    unsigned    occurrencesOf(yourTester t, const void* d) const;
  564. Returns the number of occurrences in the collection for which the
  565. user-provided function pointed to by t finds a match with d.
  566.  
  567.    unsigned   occurrencesOfReference(const type* e) const;
  568. Returns the number of items in the collection with the address e.
  569.  
  570.    type*            prepend(type* a);
  571. Adds an item to the beginning of the collection.  Returns nil if the
  572. insertion was unsuccessful.
  573.  
  574.    type*            remove(yourTester t, const void* d);
  575. Removes and returns the first item from the collection for which the
  576. user-provided function pointed to by t finds a match with d, or
  577. returns nil if no item is found.
  578.  
  579.    type*            removeReference(const type* e);
  580. Removes and returns the first item from the collection with the
  581.  
  582. Rogue Wave      Tools.h++ Class Library                  174
  583.  
  584.  
  585.  
  586.  
  587.  
  588.  
  589.  
  590.  
  591.                       CLASS REFERENCE
  592.  
  593. address e, or returns nil if no item is found.
  594.  
  595.  
  596.  
  597.  
  598.  
  599.  
  600.  
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638. Rogue Wave      Tools.h++ Class Library                  175
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.                       CLASS REFERENCE
  648.  
  649.  
  650.  
  651. class GDlistIterator(type)                    GDlistIterator(type)
  652.                                                        |
  653.                                                 RWDlistIterator
  654.                                                        |
  655.                                                 RWSlistIterator
  656.  
  657. Synopsis  #include <gdlist.h>
  658.           declare(GDlist, type)
  659.  
  660.           GDlist(type) a;
  661.           GDlistIterator(type) I(a);
  662.  
  663.  
  664.  
  665. Descripti Iterator for class GDlist(type), which allows sequential access to
  666. on        all the elements of a doubly-linked list.  Elements are accessed
  667.           in order, in either direction.
  668.           In order to simplify the documentation below, an imaginary
  669.           typedef
  670.             typedef void (*yourTester)(const type*, const void*);
  671.  
  672.           has been used.  See the documentation for class GDlist(type)
  673.           for an explanation of this function.
  674.  
  675. Example   See class GDlist(type)
  676.  
  677.  
  678.  
  679. Public    GDlistIterator(type)( GDlist(type)& list);
  680. construct Construct an iterator for the GDlist(type) list.  Immediately
  681. or        after construction, the iterator is positioned at the last link.
  682.  
  683.  
  684. Public    type*               operator()();
  685. member    Advances the iterator to the next item and returns it.  Returns
  686. operators nil if at the end of the collection.
  687.  
  688.    void             operator++();
  689. Advances the iterator one item.  This operator wraps around to the
  690. start of the list.
  691.  
  692.  
  693.  
  694. Rogue Wave      Tools.h++ Class Library                  176
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.                       CLASS REFERENCE
  704.  
  705.    void             operator--();
  706. Moves the iterator back one item.  This operator wraps around to the
  707. end of the list.
  708.  
  709.    void             operator+=(int n);
  710. Advances the iterator n items.  This operator wraps around to the
  711. start of the list.
  712.  
  713.    void             operator-=(int n);
  714. Moves the iterator back n items.  This operator wraps around to the
  715. end of the list.
  716.  
  717.  
  718. Public    RWBoolean           atFirst() const;
  719. member    Returns TRUE if the iterator is at the start of the list,
  720. functions FALSE otherwise;
  721.  
  722.           RWBoolean           atLast() const;
  723.           Returns TRUE if the iterator is at the end of the list, FALSE
  724.           otherwise;
  725.  
  726.    type*            findNext(yourTester t,const type* d);
  727. Moves the iterator to the next item for which the function pointed
  728. to by t finds a match with d and returns it.  Returns nil if no
  729. match is found, in which case the position of the iterator will be
  730. undefined.
  731.  
  732.    type*            findNextReference(const type* e);
  733. Moves the iterator to the next item with the address e and returns
  734. it.  Returns nil if no match is found, in which case the position of
  735. the iterator will be undefined.
  736.  
  737.    type*            insertAfterPoint(type* a);
  738. Adds item a after the current iterator position and return the item.
  739. The position of the iterator is left unchanged.
  740.  
  741.    type*            key() const;
  742. Returns the item at the current iterator position.
  743.  
  744.    type*            remove();
  745. Removes and returns the item at the current cursor position.
  746. Iterator will be positioned at the next item in list.
  747.  
  748.  
  749.  
  750. Rogue Wave      Tools.h++ Class Library                  177
  751.  
  752.  
  753.  
  754.  
  755.  
  756.  
  757.  
  758.  
  759.                       CLASS REFERENCE
  760.  
  761.    type*            removeNext(yourTester t, const type* d);
  762. Moves the iterator to the next item for which the function pointed
  763. to by t finds a "match" with d and removes and returns it.  Returns
  764. nil if no match is found, in which case the position of the iterator
  765. will be undefined.
  766.  
  767.    type*            removeNextReference(const type* a);
  768. Moves the iterator to the next item with the address e and removes
  769. and returns it.  Returns nil if no match is found, in which case the
  770. position of the iterator will be undefined.
  771.  
  772.    void             toFirst();
  773. Moves the iterator to the start of the list.
  774.  
  775.    void             toLast();
  776. Moves the iterator to the end of the list.
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796.  
  797.  
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806. Rogue Wave      Tools.h++ Class Library                  178
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.                       CLASS REFERENCE
  816.  
  817.  
  818.  
  819. class GQueue(type)                                  GQueue(type)
  820.                                                           |
  821.                                                        RWSlist
  822.  
  823.  
  824.  
  825. Synopsis  #include <gqueue.h>
  826.           declare(GQueue, type)
  827.  
  828.           GQueue(type) a;
  829.  
  830.  
  831.  
  832. Descripti Class GQueue(type) represents a group of ordered elements, not
  833. on        accessible by an external key.  A GQueue(type) is a first in,
  834.           first out (FIFO) sequential list for which insertions are made at
  835.           one end (the "tail"), but all removals are made at the other (the
  836.           "head").  Hence, the ordering is determined externally by the
  837.           ordering of the insertions.  Duplicates are allowed. This class is
  838.           implemented as a singly-linked list.  Objects of type GQueue(type)
  839.           are declared with macros defined in the standard C++ header file
  840.           <generic.h>.
  841.           Objects stored and retrieved with class GQueue(type) do not
  842.           need to inherit class RWCollectable.  However, in order to
  843.           find a particular item within the collection, a user-provided
  844.           global "tester" function is required to test for a "match",
  845.           definable in any consistent way.  This function should have
  846.           prototype:
  847.             RWBoolean yourTesterFunction(const type* c, const void* d);
  848.  
  849.           The argument c is a candidate within the collection to be
  850.           tested for a match.  The argument d is for your convenience
  851.           and will be passed to yourTesterFunction().  The function
  852.           should return TRUE if a "match" is found between c and d.
  853.           In order to simplify the documentation below, an imaginary
  854.           typedef
  855.             typedef void (*yourTester)(const type*, const void*);
  856.  
  857.           has been used for this tester function.
  858.  
  859.  
  860.  
  861.  
  862. Rogue Wave      Tools.h++ Class Library                  179
  863.  
  864.  
  865.  
  866.  
  867.  
  868.  
  869.  
  870.  
  871.                       CLASS REFERENCE
  872.  
  873. Public    GQueue(type)();
  874. construct Construct an empty queue.
  875. ors
  876.  
  877.    GQueue(type)(type* a);
  878. Construct a queue with one entry a.
  879.  
  880.    GQueue(type)(const GQueue(type)& q);
  881. Copy constructor.  A shallow copy of q is made.
  882.  
  883.  
  884. Assignmentvoid                operator=(const GQueue(type)& q);
  885. operator  Assignment operator.  A shallow copy of q is
  886.           made.
  887.  
  888.  
  889. Public    type*               append(type* a);
  890. member    Adds a to the end of the queue and returns it.
  891. functions Returns nil if the insertion was unsuccessful.
  892.  
  893.           void                clear();
  894.           Removes all items from the queue.
  895.  
  896.    RWBoolean        contains(yourTester t, const void* d) const;
  897. Returns TRUE if the queue contains an item for which the user-
  898. defined function pointed to by t finds a match with d.
  899.  
  900.    RWBoolean        containsReference(const type* e) const;
  901. Returns TRUE if the queue contains an item with the address e.
  902.  
  903.    int              entries() const;
  904. Returns the number of items in the queue.
  905.  
  906.    type*            first() const;
  907. Returns the first item in the queue, or nil if the queue is empty.
  908.  
  909.    type*            get();
  910. Returns and removes the first item in the queue.  Returns nil if the
  911. queue is empty.
  912.  
  913.    RWBoolean        isEmpty() const;
  914. Returns TRUE if the queue is empty, otherwise FALSE.
  915.  
  916.  
  917.  
  918. Rogue Wave      Tools.h++ Class Library                  180
  919.  
  920.  
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.                       CLASS REFERENCE
  928.  
  929.    type*            insert(type* a);
  930. Calls append(type*) with a as the argument.
  931.  
  932.    type*            last();
  933. Returns the last (most recently inserted) item in the queue, or nil
  934. if the queue is empty.
  935.  
  936.    unsigned    occurrencesOf(yourTester t, const void* d) const;
  937. Returns the number of items in the queue for which the user-provided
  938. function pointed to by t finds a match with d.
  939.  
  940.    unsigned   occurrencesOfReference(const type* e) const;
  941. Returns the number of items in the queue with the address e.
  942.  
  943.  
  944.  
  945.  
  946.  
  947.  
  948.  
  949.  
  950.  
  951.  
  952.  
  953.  
  954.  
  955.  
  956.  
  957.  
  958.  
  959.  
  960.  
  961.  
  962.  
  963.  
  964.  
  965.  
  966.  
  967.  
  968.  
  969.  
  970.  
  971.  
  972.  
  973.  
  974. Rogue Wave      Tools.h++ Class Library                  181
  975.  
  976.  
  977.  
  978.  
  979.  
  980.  
  981.  
  982.  
  983.                       CLASS REFERENCE
  984.  
  985.  
  986.  
  987. class GSlist(type)                          GSlist(type)
  988.                                                   |
  989.                                                RWSlist
  990.  
  991.  
  992.  
  993. Synopsis  #include <gslist.h>
  994.           declare(GSlist, type)
  995.  
  996.           GSlist(type) a;
  997.  
  998.  
  999.  
  1000. Descripti Class GSlist(type) represents a group of ordered elements of
  1001. on        type type, not accessible by an external key.  Duplicates are
  1002.           allowed.  This class is implemented as a singly-linked list.
  1003.           Objects of type GSlist(type) are declared with macros defined in
  1004.           the standard C++ header file <generic.h>.
  1005.           Objects stored and retrieved with class GSlist(type) do not
  1006.           need to inherit class RWCollectable.  However, in order to
  1007.           find a particular item within the collection, a user-provided
  1008.           global "tester" function is required to test for a "match",
  1009.           definable in any consistent way.  This function should have
  1010.           prototype:
  1011.             RWBoolean yourTesterFunction(const type* c, const void* d);
  1012.  
  1013.           The argument c is a candidate within the collection to be
  1014.           tested for a match.  The argument d is for your convenience
  1015.           and will be passed to yourTesterFunction().  The function
  1016.           should return TRUE if a "match" is found between c and d.
  1017.           In order to simplify the documentation below, an imaginary
  1018.           typedef
  1019.             typedef void (*yourTester)(const type*, const void*);
  1020.  
  1021.           has been used for this tester function.
  1022.  
  1023. Public    GSlist(type)();
  1024. construct Construct an empty collection.
  1025. ors
  1026.  
  1027.    GSlist(type)(type* a);
  1028. Construct a collection with one entry a.
  1029.  
  1030. Rogue Wave      Tools.h++ Class Library                  182
  1031.  
  1032.  
  1033.  
  1034.  
  1035.  
  1036.  
  1037.  
  1038.  
  1039.                       CLASS REFERENCE
  1040.  
  1041.    GSlist(type)(const GSlist(type)& a);
  1042. Copy constructor.  A shallow copy of a is made.
  1043.  
  1044.  
  1045. Assignment void                operator=(const GSlist(type)&);
  1046. operator   Assignment operator.  A shallow copy of a is made.
  1047.  
  1048.  
  1049. Public    type*               append(type* a);
  1050. member    Adds an item to the end of the collection and
  1051. functions returns it.  Returns nil if the insertion was
  1052.           unsuccessful.
  1053.  
  1054.    void             apply( (*ap)(type*, void*), void* );
  1055. Visits all the items in the collection in order, from first to last,
  1056. calling the user-provided function pointed to by ap for each item.
  1057. This function should have prototype:
  1058.  
  1059.                     void yourApplyFunction(type* c, void*);
  1060.  
  1061. and can perform any operation on the object at address c.  The last
  1062. argument is useful for passing data to the apply function.
  1063.  
  1064.    type*&           at(int i);
  1065. Allows access to the i'th element of the collection.  If i is out of
  1066. range then an exception with error TOOL_INDEX will occur.  This
  1067. variant can be used as an lvalue.
  1068.  
  1069.    const type*      at(int i) const;
  1070. Allows access to the i'th element of the collection.  If i is out of
  1071. range then nil is returned.
  1072.  
  1073.    void             clear();
  1074. Removes all items in the collection.
  1075.  
  1076.    RWBoolean        contains(yourTester t, const void* d) const;
  1077. Returns TRUE if the collection contains an item for which the user-
  1078. defined function pointed to by t finds a match with d.
  1079.  
  1080.    RWBoolean        containsReference(const type* e) const;
  1081. Returns TRUE if the collection contains an item with the address e.
  1082.  
  1083.    unsigned         entries() const;
  1084. Returns the number of items in the collection.
  1085.  
  1086. Rogue Wave      Tools.h++ Class Library                  183
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.                       CLASS REFERENCE
  1096.  
  1097.    type*            find(yourTester t, const void* d) const;
  1098. Returns the first item in the collection for which the user-provided
  1099. function pointed to by t finds a match with d, or nil if no item is
  1100. found.
  1101.  
  1102.    type*            findReference(const type* e) const;
  1103. Returns the first item in the collection with the address e, or nil
  1104. if no item is found.
  1105.  
  1106.    type*            first() const;
  1107. Returns the first item of the collection.
  1108.  
  1109.    type*            get();
  1110. Returns and removes the first item of the collection.
  1111.  
  1112.    type*            insert(type* e);
  1113. Adds an item to the end of the collection and returns it.  Returns
  1114. nil if the insertion was unsuccessful.
  1115.  
  1116.    type*            insertAfter(int i, type* e);
  1117. Adds an item after the i'th item of the collection and returns it.
  1118. Returns nil if the insertion was unsuccessful.
  1119.  
  1120.    RWBoolean        isEmpty() const;
  1121. Returns TRUE if the collection is empty, otherwise FALSE.
  1122.  
  1123.    type*            last() const;
  1124. Returns the last item of the collection.
  1125.  
  1126.    unsigned    occurrencesOf(yourTester t, const void* d) const;
  1127. Returns the number of occurrences in the collection for which the
  1128. user-provided function pointed to by t finds a match with d.
  1129.  
  1130.    unsigned    occurrencesOfReference(const type* e) const;
  1131. Returns the number of items in the collection with the address e.
  1132.  
  1133.    type*            prepend(const type* a);
  1134. Adds an item to the beginning of the collection and returns it.
  1135. Returns nil if the insertion was unsuccessful.
  1136.  
  1137.    type*            remove(yourTester t, const void* d);
  1138. Removes and returns the first item from the collection for which the
  1139. user-provided function pointed to by t finds a match with d, or
  1140. returns nil if no item is found.
  1141.  
  1142. Rogue Wave      Tools.h++ Class Library                  184
  1143.  
  1144.  
  1145.  
  1146.  
  1147.  
  1148.  
  1149.  
  1150.  
  1151.                       CLASS REFERENCE
  1152.  
  1153.    type*            removeReference(const type* e);
  1154. Removes and returns the first item from the collection with the
  1155. address e, or returns nil if no item is found.
  1156.  
  1157.  
  1158.  
  1159.  
  1160.  
  1161.  
  1162.  
  1163.  
  1164.  
  1165.  
  1166.  
  1167.  
  1168.  
  1169.  
  1170.  
  1171.  
  1172.  
  1173.  
  1174.  
  1175.  
  1176.  
  1177.  
  1178.  
  1179.  
  1180.  
  1181.  
  1182.  
  1183.  
  1184.  
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198. Rogue Wave      Tools.h++ Class Library                  185
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.                       CLASS REFERENCE
  1208.  
  1209.  
  1210.  
  1211. class GSlistIterator(type)                   GSlistIterator(type)
  1212.                                                        |
  1213.                                                 RWSlistIterator
  1214.  
  1215.  
  1216.  
  1217. Synopsis  #include <gslist.h>
  1218.           declare(GSlist, type)
  1219.  
  1220.           GSlist(type) a;
  1221.           GSlistIterator(type) I(a);
  1222.  
  1223.  
  1224.  
  1225. Descripti Iterator for class GSlist(type), which allows sequential
  1226. on        access to all the elements of a singly-linked list.
  1227.           Elements are accessed in order, in either direction.
  1228.           In order to simplify the documentation below, an imaginary
  1229.           typedef
  1230.             typedef void (*yourTester)(const type*, const void*);
  1231.  
  1232.           has been used.  See the documentation for class GSlist(type)
  1233.           for an explanation of this function.
  1234.  
  1235. Public    GSlistIterator(type)( GSlist(type)& list);
  1236. construct Construct an iterator for the GSlist(type) list.  Immediately
  1237. or        after construction, the iterator is positioned at the last
  1238.           link.
  1239.  
  1240.  
  1241. Public    type*               operator()();
  1242. member    Advances the iterator to the next item and returns it.
  1243. operators Returns nil if at the end of the collection.
  1244.  
  1245.    void             operator++();
  1246. Advances the iterator one item.  This operator wraps around to the
  1247. start of the list.
  1248.  
  1249.    void             operator+=(int n);
  1250. Advances the iterator n items.  This operator wraps around to the
  1251. start of the list.
  1252.  
  1253.  
  1254. Rogue Wave      Tools.h++ Class Library                  186
  1255.  
  1256.  
  1257.  
  1258.  
  1259.  
  1260.  
  1261.  
  1262.  
  1263.                       CLASS REFERENCE
  1264.  
  1265.  
  1266. Public    RWBoolean           atFirst() const;
  1267. member    Returns TRUE if the iterator is at the start of the list,
  1268. functions FALSE otherwise;
  1269.  
  1270.    RWBoolean        atLast() const;
  1271. Returns TRUE if the iterator is at the end of the list, FALSE
  1272. otherwise;
  1273.  
  1274.    type*            findNext(yourTester t,const type* d);
  1275. Moves the iterator to the next item for which the function pointed
  1276. to by t finds a match with d and returns it.  Returns nil if no
  1277. match is found, in which case the position of the iterator will be
  1278. undefined.
  1279.  
  1280.    type*            findNextReference(const type* e);
  1281. Moves the iterator to the next item with the address e and returns
  1282. it.  Returns nil if no match is found, in which case the position of
  1283. the iterator will be undefined.
  1284.  
  1285.    type*            insertAfterPoint(type* a);
  1286. Adds item a after the current iterator position and return the item.
  1287. The position of the iterator is left unchanged.
  1288.  
  1289.    type*            key() const;
  1290. Returns the item at the current iterator position.
  1291.  
  1292.    type*            remove();
  1293. Removes and returns the item at the current cursor position.
  1294. Iterator will be positioned at the next item in list.  In a singly-
  1295. linked list, this is an inefficient operation because the entire
  1296. list must be traversed, looking for the link before the link to be
  1297. removed.
  1298.  
  1299.    type*            removeNext(yourTester t, const type* d);
  1300. Moves the iterator to the next item for which the function pointed
  1301. to by t finds a "match" with d and removes and returns it.  Returns
  1302. nil if no match is found, in which case the position of the iterator
  1303. will be undefined.
  1304.  
  1305.    type*            removeNextReference(const type* e);
  1306. Moves the iterator to the next item with the address e and removes
  1307. and returns it.  Returns nil if no match is found, in which case the
  1308. position of the iterator will be undefined.
  1309.  
  1310. Rogue Wave      Tools.h++ Class Library                  187
  1311.  
  1312.  
  1313.  
  1314.  
  1315.  
  1316.  
  1317.  
  1318.  
  1319.                       CLASS REFERENCE
  1320.  
  1321.    void             toFirst();
  1322. Moves the iterator to the start of the list.
  1323.  
  1324.    void             toLast();
  1325. Moves the iterator to the end of the list.
  1326.  
  1327.  
  1328.  
  1329.  
  1330.  
  1331.  
  1332.  
  1333.  
  1334.  
  1335.  
  1336.  
  1337.  
  1338.  
  1339.  
  1340.  
  1341.  
  1342.  
  1343.  
  1344.  
  1345.  
  1346.  
  1347.  
  1348.  
  1349.  
  1350.  
  1351.  
  1352.  
  1353.  
  1354.  
  1355.  
  1356.  
  1357.  
  1358.  
  1359.  
  1360.  
  1361.  
  1362.  
  1363.  
  1364.  
  1365.  
  1366. Rogue Wave      Tools.h++ Class Library                  188
  1367.  
  1368.  
  1369.  
  1370.  
  1371.  
  1372.  
  1373.  
  1374.  
  1375.                       CLASS REFERENCE
  1376.  
  1377.  
  1378.  
  1379. class GSortedVector(val)                     GSortedVector(val)
  1380.                                                      |
  1381.                                                 GVector(val)
  1382.  
  1383.  
  1384.  
  1385. Synopsis  #include <gsortvec.h>
  1386.           declare(GSortedVector,val)
  1387.           implement(GSortedVector, val)
  1388.  
  1389.           GSortedVector(val) v;      // A sorted vector of val's.
  1390.  
  1391.  
  1392.  
  1393. Descripti Class GSortedVector(val) represents a vector of elements of
  1394. on        type val, sorted using an insertion sort.  The elements can
  1395.           be retrieved using an index or a search.  Duplicates are
  1396.           allowed. Objects of type GSortedVector(val) are declared
  1397.           with macros defined in the standard C++ header file
  1398.           <generic.h>.  Note that class GSortedVector(val) differs
  1399.           from most of the other generic collection classes in that
  1400.           vectors of the type are constructed, rather than pointers
  1401.           to the type.
  1402.           For each type of GSortedVector, you must include one (and only
  1403.           one) call to the macro implement somewhere in your code.
  1404.           Note that because GSortedVector(val) uses GVector(val) as a
  1405.           base class, declaring a sorted vector of type val will also
  1406.           declare a GVector of type val (see the description for
  1407.           GVector(val)).  Implementing a sorted vector of type val will
  1408.           also implement its GVector counterpart.
  1409.           Insertions and retrievals are done using a binary search.
  1410.           Note that the constructor of a GSortedVector(val) requires a
  1411.           pointer to a "comparison function".  This function should have
  1412.           prototype:
  1413.             int comparisonFunction(const val* a, const val* b);
  1414.  
  1415.           and should return an int less than, greater than, or equal to
  1416.           zero, depending on whether the item pointed to by a is less
  1417.           than, greater than, or equal to the item pointed to by b.
  1418.  
  1419.  
  1420.  
  1421.  
  1422. Rogue Wave      Tools.h++ Class Library                  189
  1423.  
  1424.  
  1425.  
  1426.  
  1427.  
  1428.  
  1429.  
  1430.  
  1431.                       CLASS REFERENCE
  1432.  
  1433.  
  1434. Example   Here's an example of a sorted vector of ints:
  1435.  
  1436.             #include <gsortvec.h>
  1437.  
  1438.             #include <rstream.h>
  1439.  
  1440.             // Declare and implement a sorted vector of ints.
  1441.             // Note that as a side effect, this will also declare
  1442.             // and implement a GVector(int)
  1443.  
  1444.             declare(GSortedVector,int)
  1445.             implement(GSortedVector,int)
  1446.  
  1447.             // Declare and define the "comparison function":
  1448.  
  1449.             int compFun(const int* a, const int* b)
  1450.             {
  1451.  
  1452.               return *a - *b;
  1453.  
  1454.             }
  1455.  
  1456.             main()
  1457.  
  1458.             {
  1459.               // Declare and define an instance,
  1460.               // using the comparison function 'compFun':
  1461.  
  1462.               GSortedVector(int) avec(compFun);
  1463.  
  1464.               // Do some insertions:
  1465.               avec.insert(3);           // 3
  1466.               avec.insert(17);          // 3 17
  1467.               avec.insert(5);           // 3  5 17
  1468.  
  1469.               cout << avec(1);          // Prints '5'
  1470.               cout << avec.index(17);   // Prints '2'
  1471.             }
  1472.  
  1473.  
  1474.  
  1475.  
  1476.  
  1477.  
  1478. Rogue Wave      Tools.h++ Class Library                  190
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.                       CLASS REFERENCE
  1488.  
  1489. Public    GSortedVector(val)( int (*f)(const val*, const val*) );
  1490. construct Construct a sorted vector of elements of type val, using the
  1491. ors       comparison function pointed to by f.  The initial capacity of
  1492.           the vector will be set by the value RWDEFAULT_CAPACITY.  The
  1493.           capacity will automatically be increased should too many items
  1494.           be inserted.
  1495.  
  1496.    GSortedVector(val)(int (*f)(const val*, const val*), unsigned N);
  1497. Construct a sorted vector of elements of type val, using the
  1498. comparison function pointed to by f.  The initial capacity of the
  1499. vector will be N.  The capacity will automatically be increased
  1500. should too many items be inserted.
  1501.  
  1502.  
  1503. Public    val                 operator()(int i) const;
  1504. member    Return the i'th value in the vector.  The index i must be
  1505. functions between 0 and the length of the vector less one.  No bounds
  1506.           checking is performed.
  1507.  
  1508.    val              operator[](int i) const;
  1509. Return the i'th value in the vector.  The index i must be between 0
  1510. and the length of the vector less one.  Bounds checking is
  1511. performed.
  1512.  
  1513.    int              index(val v);
  1514. Return the index of the item with value v.  The value "-1" is
  1515. returned if the value does not occur in the vector.  A binary
  1516. search, using the comparison function, is done to find the value.
  1517. If duplicates are present, the index of the first instance is
  1518. returned.
  1519.  
  1520.    RWBoolean        insert(val v);
  1521. Insert the new value v into the vector.  A binary search, using the
  1522. comparison function, is performed to determine where to insert the
  1523. value.  The item will be inserted after any duplicates.  If the
  1524. insertion causes the vector to exceed its capacity, it will
  1525. automatically be resized by an amount given by RWDEFAULT_RESIZE.
  1526.  
  1527.    unsigned         length() const;
  1528. Returns the number of items in the vector (this should not be
  1529. confused with the vector's capacity).
  1530.  
  1531.    void             resize(unsigned newCapacity);
  1532. Resizes the vector to have a new capacity newCapacity or the present
  1533.  
  1534. Rogue Wave      Tools.h++ Class Library                  191
  1535.  
  1536.  
  1537.  
  1538.  
  1539.  
  1540.  
  1541.  
  1542.  
  1543.                       CLASS REFERENCE
  1544.  
  1545. length of the vector, whichever is greater.  I.e., the capacity of a
  1546. vector cannot be reduced to less than its length.
  1547.  
  1548.  
  1549.  
  1550.  
  1551.  
  1552.  
  1553.  
  1554.  
  1555.  
  1556.  
  1557.  
  1558.  
  1559.  
  1560.  
  1561.  
  1562.  
  1563.  
  1564.  
  1565.  
  1566.  
  1567.  
  1568.  
  1569.  
  1570.  
  1571.  
  1572.  
  1573.  
  1574.  
  1575.  
  1576.  
  1577.  
  1578.  
  1579.  
  1580.  
  1581.  
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588.  
  1589.  
  1590. Rogue Wave      Tools.h++ Class Library                  192
  1591.  
  1592.  
  1593.  
  1594.  
  1595.  
  1596.  
  1597.  
  1598.  
  1599.                       CLASS REFERENCE
  1600.  
  1601.  
  1602.  
  1603. class GStack(type)                              GStack(type)
  1604.                                                      |
  1605.                                                   RWSlist
  1606.  
  1607.  
  1608.  
  1609. Synopsis  #include <gstack.h>
  1610.           declare(GStack,type)
  1611.  
  1612.           GStack(type) a;
  1613.  
  1614.  
  1615.  
  1616. Descripti Class GStack(type) represents a group of ordered elements,
  1617. on        not accessible by an external key.  A GStack(type) is a
  1618.           last in, first out (LIFO) sequential list for which
  1619.           insertions and removals are made at the beginning of the
  1620.           list.  Hence, the ordering is determined externally by the
  1621.           ordering of the insertions.  Duplicates are allowed. This
  1622.           class is implemented as a singly-linked list.  Objects of
  1623.           type GStack(type) are declared with macros defined in the
  1624.           standard C++ header file <generic.h>.
  1625.           Objects stored and retrieved with class GStack(type) do not
  1626.           need to inherit class RWCollectable.  However, in order to
  1627.           find a particular item within the collection, a user-provided
  1628.           global "tester" function is required to test for a "match",
  1629.           definable in any consistent way.  This function should have
  1630.           prototype:
  1631.             RWBoolean yourTesterFunction(const type* c, const void* d);
  1632.  
  1633.           The argument c is a candidate within the collection to be
  1634.           tested for a match.  The argument d is for your convenience
  1635.           and will be passed to yourTesterFunction().  The function
  1636.           should return TRUE if a "match" is found between c and d.
  1637.           In order to simplify the documentation below, an imaginary
  1638.           typedef
  1639.             typedef void (*yourTester)(const type*, const void*);
  1640.  
  1641.           has been used for this tester function.
  1642.  
  1643.  
  1644.  
  1645.  
  1646. Rogue Wave      Tools.h++ Class Library                  193
  1647.  
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654.  
  1655.                       CLASS REFERENCE
  1656.  
  1657. Public    GStack(type)();
  1658. construct Construct an empty stack.
  1659. ors
  1660.  
  1661.    GStack(type)(type* a);
  1662. Construct a stack with one entry a.
  1663.  
  1664.    GStack(type)(const GStack(type)& a);
  1665. Copy constructor.  A shallow copy of a is made.
  1666.  
  1667.  
  1668. Assignmen void                operator=(const GStack(type)& a);
  1669. t         Assignment operator.  A shallow copy of a is made.
  1670. operator
  1671.  
  1672.  
  1673. Public    void                clear();
  1674. member    Removes all items from the stack.
  1675. functions
  1676.           RWBoolean           contains(yourTester t, const void* d) const;
  1677.           Returns TRUE if the stack contains an item for which the
  1678.           user-defined function pointed to by t finds a match with d.
  1679.  
  1680.    RWBoolean        containsReference(const type* e) const;
  1681. Returns TRUE if the stack contains an item with the address e.
  1682.  
  1683.    int              entries() const;
  1684. Returns the number of items in the stack.
  1685.  
  1686.    RWBoolean        isEmpty() const;
  1687. Returns TRUE if the stack is empty, otherwise FALSE.
  1688.  
  1689.    unsigned   occurrencesOf(yourTester t, const void* d) const;
  1690. Returns the number of items in the stack for which the user-provided
  1691. function pointed to by t finds a match with d.
  1692.  
  1693.    unsigned   occurrencesOfReference(const type* e) const;
  1694. Returns the number of items in the stack with the address e.
  1695.  
  1696.    type*            pop();
  1697. Removes and returns the item at the top of the stack, or returns nil
  1698. if the stack is empty.
  1699.  
  1700.  
  1701.  
  1702. Rogue Wave      Tools.h++ Class Library                  194
  1703.  
  1704.  
  1705.  
  1706.  
  1707.  
  1708.  
  1709.  
  1710.  
  1711.                       CLASS REFERENCE
  1712.  
  1713.    void             push(type* a);
  1714. Adds an item to the top of the stack.
  1715.  
  1716.    type*            top() const;
  1717. Returns the item at the top of the stack or nil if the stack is
  1718. empty.
  1719.  
  1720.  
  1721.  
  1722.  
  1723.  
  1724.  
  1725.  
  1726.  
  1727.  
  1728.  
  1729.  
  1730.  
  1731.  
  1732.  
  1733.  
  1734.  
  1735.  
  1736.  
  1737.  
  1738.  
  1739.  
  1740.  
  1741.  
  1742.  
  1743.  
  1744.  
  1745.  
  1746.  
  1747.  
  1748.  
  1749.  
  1750.  
  1751.  
  1752.  
  1753.  
  1754.  
  1755.  
  1756.  
  1757.  
  1758. Rogue Wave      Tools.h++ Class Library                  195
  1759.  
  1760.  
  1761.  
  1762.  
  1763.  
  1764.  
  1765.  
  1766.  
  1767.                       CLASS REFERENCE
  1768.  
  1769.  
  1770.  
  1771. class GVector(val)
  1772.  
  1773.  
  1774.  
  1775.  
  1776.  
  1777. Synopsis  #include <gvector.h>
  1778.           declare(GVector,val)
  1779.           implement(GVector,val)
  1780.  
  1781.           GVector(val) a;     // A Vector of val's.
  1782.  
  1783.  
  1784.  
  1785. Descripti Class GVector(val) represents a group of ordered elements,
  1786. on        accessible by an index.  Duplicates are allowed. This class
  1787.           is implemented as an array.  Objects of type GVector(val)
  1788.           are declared with macros defined in the standard C++ header
  1789.           file <generic.h>.  Note that class GVector(val) differs from
  1790.           most of the other generic collection classes in that vectors
  1791.           of any type are constructed, rather than pointers to the
  1792.           type.
  1793.           For each type of GVector, you must include one (and only one)
  1794.           call to the macro implement, somewhere in your code.
  1795.  
  1796. Public    GVector(val)();
  1797. construct Construct an empty vector.
  1798. ors
  1799.  
  1800.    GVector(val)(unsigned n);
  1801. Construct a vector with length n. Contents are undefined.
  1802.  
  1803.    GVector(val)(unsigned n, val v);
  1804. Construct a vector with length n. Each element is assigned the value
  1805. v.  This will require that either val is a built in type (double,
  1806. int, etc.) or that an assignment operation be legal for it.
  1807.  
  1808.    GVector(val)(GVector(val)& s);
  1809. Copy constructor.  The entire vector is copied.  This results in a
  1810. deep copy.
  1811.  
  1812.  
  1813.  
  1814. Rogue Wave      Tools.h++ Class Library                  196
  1815.  
  1816.  
  1817.  
  1818.  
  1819.  
  1820.  
  1821.  
  1822.  
  1823.                       CLASS REFERENCE
  1824.  
  1825.  
  1826. Public    void                operator=(GVector(val)& s);
  1827. member    Assignment operator.  The entire vector is copied.  This
  1828. operators results in a deep copy.
  1829.  
  1830.           val&                operator()(int i);
  1831.           Returns a reference to the the i'th element of self.
  1832.  
  1833.    val&             operator[](int i);
  1834. Returns a reference to the the i'th element of self, with bounds
  1835. checking.
  1836.  
  1837.  
  1838. Public    unsigned            length() const;
  1839. member    Returns the length of the vector.
  1840. functions
  1841.           void                resize(unsigned n);
  1842.           Resize the vector.  If the vector shrinks, it will be
  1843.           truncated.  If the vector grows, then the value of the
  1844.           additional elements will be undefined.
  1845.  
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852.  
  1853.  
  1854.  
  1855.  
  1856.  
  1857.  
  1858.  
  1859.  
  1860.  
  1861.  
  1862.  
  1863.  
  1864.  
  1865.  
  1866.  
  1867.  
  1868.  
  1869.  
  1870. Rogue Wave      Tools.h++ Class Library                  197
  1871.  
  1872.  
  1873.  
  1874.  
  1875.  
  1876.  
  1877.  
  1878.  
  1879.                       CLASS REFERENCE
  1880.  
  1881.  
  1882.  
  1883. class RWBag                                     RWBag
  1884.                                                   |
  1885.                                             RWCollection
  1886.                                                   |
  1887.                                             RWCollectable
  1888.  
  1889. Synopsis  typedef RWBag Bag;  // Smalltalk typedef.
  1890.  
  1891.           #include <rwbag.h>
  1892.           RWBag h;
  1893.  
  1894.  
  1895.  
  1896. Descripti Class RWBag is the simplest kind of collection and corresponds to
  1897. on        the Smalltalk class Bag.  It represents a group of unordered
  1898.           elements, not accessible by an external key.  Duplicates are
  1899.           allowed.
  1900.           An object stored by RWBag must inherit abstract base class
  1901.           RWCollectable, with suitable definition for virtual functions
  1902.           hash() and isEqual() (see class RWCollectable).  The function
  1903.           hash() is used to find objects with the same hash value, then
  1904.           isEqual() is used to confirm the match.
  1905.           Class RWBag is implemented by using an internal hashed
  1906.           dictionary (RWHashDictionary) which keeps track of the number
  1907.           of occurrences of an item.  If an item is added to the
  1908.           collection that compares equal (isEqual) to an existing item
  1909.           in the collection, then the count is incremented.  Note that
  1910.           this means that separate identities are not stored.  Instead,
  1911.           a pointer to the first item is stored and then all subsequent
  1912.           insertions of isEqual objects merely cause the count to be
  1913.           incremented.
  1914.           Member function apply() and the iterator are called repeatedly
  1915.           according to the count for an item.
  1916.  
  1917. Public    RWBag(unsigned n = 101);
  1918. construct Construct an empty bag with an internal dictionary with
  1919. ors       a size that is the next highest prime number that is
  1920.           greater than or equal to n.
  1921.  
  1922.    RWBag(const RWBag& b);
  1923. Copy constructor.  A shallow copy of b will be made.
  1924.  
  1925.  
  1926. Rogue Wave      Tools.h++ Class Library                  198
  1927.  
  1928.  
  1929.  
  1930.  
  1931.  
  1932.  
  1933.  
  1934.  
  1935.                       CLASS REFERENCE
  1936.  
  1937.  
  1938. Public    void                operator=(const RWBag& b);
  1939. member    Assignment operator.  A shallow copy of b will be made.
  1940. operators
  1941.           RWBoolean           operator==(const RWBag& b) const;
  1942.           Returns TRUE if self and bag b have the same number of
  1943.           total entries and if for every key in self there is a
  1944.           corresponding key in b which isEqual and which has the
  1945.           same number of entries.
  1946.  
  1947.  
  1948. Public    virtual void        apply(applyCollectable ap, void*)
  1949. member    Redefined from class RWCollection.  This function has been
  1950. functions redefined to apply the user-supplied function pointed to
  1951.           by ap to each member of the collection in a (generally)
  1952.           unpredictable order.  If an item has been inserted more
  1953.           than once (i.e., more than one item isEqual), then apply()
  1954.           will be called that many times.  The user-supplied
  1955.           function should not do anything that could change the hash
  1956.           value of the items.
  1957.  
  1958.    virtual unsigned binaryStoreSize() const;
  1959. Inherited from class RWCollection.
  1960.  
  1961.    virtual void     clear();
  1962. Redefined from class RWCollection.
  1963.  
  1964.    virtual void     clearAndDestroy();
  1965. Inherited from class RWCollection.
  1966.  
  1967.    virtual int      compareTo(const RWCollectable* a) const;
  1968. Inherited from class RWCollectable.
  1969.  
  1970.    virtual RWBoolean      contains(const RWCollectable* target) const;
  1971. Inherited from class RWCollection.
  1972.  
  1973.    virtual unsigned entries() const;
  1974. Redefined from class RWCollection.
  1975.  
  1976.    virtual RWCollectable* find(const RWCollectable* target) const;
  1977. Redefined from class RWCollection.  The first item that was inserted
  1978. into the Bag and which equals target is returned or nil if no item
  1979. is found.  Hashing is used to narrow the search.
  1980.  
  1981.  
  1982. Rogue Wave      Tools.h++ Class Library                  199
  1983.  
  1984.  
  1985.  
  1986.  
  1987.  
  1988.  
  1989.  
  1990.  
  1991.                       CLASS REFERENCE
  1992.  
  1993.    virtual unsigned hash() const;
  1994. Inherited from class RWCollectable.
  1995.  
  1996.    virtual RWCollectable* insert(RWCollectable* c);
  1997. Redefined from class RWCollection.  Inserts the item c into the
  1998. collection and returns it, or if an item was already in the
  1999. collection that isEqual to c, then returns the old item and
  2000. increments its count.
  2001.  
  2002.    RWCollectable*   insertWithOccurrences(RWCollectable* c , unsigned n);
  2003. Inserts the item c into the collection with count n and returns it,
  2004. or if an item was already in the collection that isEqual to c, then
  2005. returns the old item and increments its count by n.
  2006.  
  2007.    virtual ClassID  isA() const;
  2008. Redefined from class RWCollectable to return __RWBAG.
  2009.  
  2010.    virtual RWBoolean      isEmpty() const;
  2011. Redefined from class RWCollection.
  2012.  
  2013.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  2014. Inherited from class RWCollectable.
  2015.  
  2016.    virtual unsigned occurrencesOf (const RWCollectable* target) const;
  2017. Redefined from class RWCollection.  Returns the number of items that
  2018. are equal to the item pointed to by target.
  2019.  
  2020.    virtual RWCollectable* remove(const RWCollectable* target);
  2021. Redefined from class RWCollection.  Removes and returns the item
  2022. that isEqual to the item pointed to by target.  Returns nil if no
  2023. item was found.
  2024.  
  2025.    virtual void     removeAndDestroy(const RWCollectable* target);
  2026. Inherited from class RWCollection.
  2027.  
  2028.    void             resize(unsigned n = 0);
  2029. Resizes the internal hash table to the next highest prime number
  2030. above n, or, if n==0, to the next prime number greater than twice
  2031. the current size.
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038. Rogue Wave      Tools.h++ Class Library                  200
  2039.  
  2040.  
  2041.  
  2042.  
  2043.  
  2044.  
  2045.  
  2046.  
  2047.                       CLASS REFERENCE
  2048.  
  2049.    virtual void     restoreGuts(RWvistream&);
  2050.    virtual void     restoreGuts(RWFile&);
  2051.    virtual void     saveGuts(RWvostream&) const;
  2052.    virtual void     saveGuts(RWFile&) const;
  2053. Inherited from class RWCollection.
  2054.  
  2055.    static RWCollectable*  restoreFrom(RWvistream&);
  2056.    static RWCollectable*  restoreFrom(RWFile&);
  2057.    void                   saveOn(RWvostream&) const;
  2058.    void                   saveOn(RWFile&) const;
  2059. Inherited from class RWCollectable.
  2060.  
  2061.  
  2062.  
  2063.  
  2064.  
  2065.  
  2066.  
  2067.  
  2068.  
  2069.  
  2070.  
  2071.  
  2072.  
  2073.  
  2074.  
  2075.  
  2076.  
  2077.  
  2078.  
  2079.  
  2080.  
  2081.  
  2082.  
  2083.  
  2084.  
  2085.  
  2086.  
  2087.  
  2088.  
  2089.  
  2090.  
  2091.  
  2092.  
  2093.  
  2094. Rogue Wave      Tools.h++ Class Library                  201
  2095.  
  2096.  
  2097.  
  2098.  
  2099.  
  2100.  
  2101.  
  2102.  
  2103.                       CLASS REFERENCE
  2104.  
  2105.  
  2106.  
  2107. class RWBagIterator                            RWBagIterator
  2108.                                                      |
  2109.                                                  RWIterator
  2110.  
  2111.  
  2112.  
  2113. Synopsis  #include <rwbag.h>
  2114.  
  2115.           RWBag b;
  2116.           RWBagIterator it(b);
  2117.  
  2118.  
  2119.  
  2120. Descripti Iterator for class RWBag, which allows sequential access to
  2121. on        all the elements of RWBag.  Note that because a RWBag is
  2122.           unordered, elements are not accessed in any particular
  2123.           order.  If an item was inserted N times into the
  2124.           collection, then it will be visited N times.
  2125.  
  2126. Public    RWBagIterator(const RWBag&);
  2127. construct Construct an iterator for a RWBag.  After construction,
  2128. or        the position of the iterator is undefined.
  2129.  
  2130.  
  2131. Public    virtual RWCollectable*    operator()();
  2132. member    Redefined from class RWIterator.  Advances the iterator
  2133. operator  to the next item and returns it. Returns nil when the
  2134.           end of the collection is reached.
  2135.  
  2136.  
  2137. Public    virtual RWCollectable*  findNext(const RWCollectable* target);
  2138. member    Redefined from class RWIterator.  Moves iterator to the
  2139. functions next item which isEqual to the object pointed to by
  2140.           target and returns it.  Hashing is used to find the
  2141.           target.  If no item is found, returns nil and the
  2142.           position of the iterator will be undefined.
  2143.  
  2144.    virtual         RWCollectable*   key() const;
  2145. Redefined from class RWIterator.  Returns the item at the current
  2146. iterator position.
  2147.  
  2148.  
  2149.  
  2150. Rogue Wave      Tools.h++ Class Library                  202
  2151.  
  2152.  
  2153.  
  2154.  
  2155.  
  2156.  
  2157.  
  2158.  
  2159.                       CLASS REFERENCE
  2160.  
  2161.    virtual void     reset();
  2162. Redefined from class RWIterator.  Resets the iterator to its
  2163. starting state.
  2164.  
  2165.  
  2166.  
  2167.  
  2168.  
  2169.  
  2170.  
  2171.  
  2172.  
  2173.  
  2174.  
  2175.  
  2176.  
  2177.  
  2178.  
  2179.  
  2180.  
  2181.  
  2182.  
  2183.  
  2184.  
  2185.  
  2186.  
  2187.  
  2188.  
  2189.  
  2190.  
  2191.  
  2192.  
  2193.  
  2194.  
  2195.  
  2196.  
  2197.  
  2198.  
  2199.  
  2200.  
  2201.  
  2202.  
  2203.  
  2204.  
  2205.  
  2206. Rogue Wave      Tools.h++ Class Library                  203
  2207.  
  2208.  
  2209.  
  2210.  
  2211.  
  2212.  
  2213.  
  2214.  
  2215.                       CLASS REFERENCE
  2216.  
  2217.  
  2218.  
  2219. class RWBinaryTree                               RWBinaryTree
  2220.                                                       |
  2221.                                                  RWCollection
  2222.                                                       |
  2223.                                                 RWCollectable
  2224.  
  2225.  
  2226. Synopsis  typedef RWBinaryTree SortedCollection;   // Smalltalk typedef.
  2227.  
  2228.           #include <bintree.h>
  2229.           RWBinaryTree bt;
  2230.  
  2231.  
  2232.  
  2233. Descripti Class RWBinaryTree represents a group of ordered elements,
  2234. on        internally sorted by the compareTo() function.  Duplicates
  2235.           are allowed.  An object stored by a RWBinaryTree must
  2236.           inherit abstract base class RWCollectable.
  2237.  
  2238. Public    RWBinaryTree();
  2239. construct Construct an empty sorted collection.
  2240. ors
  2241.  
  2242.    RWBinaryTree(const RWBinaryTree& t);
  2243. Copy constructor.  Constructs a shallow copy from t.  Member
  2244. function balance() (see below), is called before returning.
  2245.  
  2246.    virtual          ~RWBinaryTree();
  2247. Redefined from RWCollection.  Calls clear().
  2248.  
  2249.  
  2250.  
  2251.  
  2252.  
  2253.  
  2254.  
  2255.  
  2256.  
  2257.  
  2258.  
  2259.  
  2260.  
  2261.  
  2262. Rogue Wave      Tools.h++ Class Library                  204
  2263.  
  2264.  
  2265.  
  2266.  
  2267.  
  2268.  
  2269.  
  2270.  
  2271.                       CLASS REFERENCE
  2272.  
  2273.  
  2274. Public    void  operator=(const RWBinaryTree& bt);
  2275. member    Sets self to a shallow copy of bt.
  2276. operators
  2277.           RWBoolean           operator<=(const RWBinaryTree& bt) const;
  2278.           Returns TRUE if self is a subset of the collection bt.
  2279.           That is, every item in self must compare equal to an item
  2280.           in bt.
  2281.  
  2282.  
  2283.  
  2284.    RWBoolean        operator==(const RWBinaryTree& bt) const;
  2285. Returns TRUE if self and bt are equivalent.  That is, they must have
  2286. the same number of items and every item in self must compare equal
  2287. to an item in bt.
  2288.  
  2289.  
  2290. Public    virtual void   apply(applyCollectable ap, void*)
  2291. member    Redefined from class RWCollection to apply the user-supplied
  2292. functions function pointed to by ap to each member of the collection,
  2293.           in order, from smallest to largest.  This supplied function
  2294.           should not do anything to the items that could change the
  2295.           ordering of the collection.
  2296.  
  2297.    void             balance();
  2298. Special function to balances the tree.  In a perfectly balanced
  2299. binary tree with no duplicate elements, the number of nodes from the
  2300. root to any external (leaf) node differs by at most 1 node.  Since
  2301. this collection allows duplicate elements, a perfectly balanced tree
  2302. is not always possible.
  2303.  
  2304.    virtual unsigned binaryStoreSize() const;
  2305. Inherited from class RWCollection.
  2306.  
  2307.    virtual void     clear();
  2308. Redefined from class RWCollection.
  2309.  
  2310.    virtual void     clearAndDestroy();
  2311. Inherited from class RWCollection.
  2312.  
  2313.    virtual int      compareTo(const RWCollectable* a) const;
  2314. Inherited from class RWCollectable.
  2315.  
  2316.  
  2317.  
  2318. Rogue Wave      Tools.h++ Class Library                  205
  2319.  
  2320.  
  2321.  
  2322.  
  2323.  
  2324.  
  2325.  
  2326.  
  2327.                       CLASS REFERENCE
  2328.  
  2329.    virtual RWBoolean      contains(const RWCollectable* target) const;
  2330. Inherited from class RWCollection.
  2331.  
  2332.    virtual unsigned entries() const;
  2333. Redefined from class RWCollection.
  2334.  
  2335.    virtual         RWCollectable*   find(const RWCollectable* target) const;
  2336. Redefined from class RWCollection.  Returns the first item that
  2337. compares equal to the item pointed to by target, or nil if no item
  2338. was found..
  2339.  
  2340.    virtual unsigned hash() const;
  2341. Inherited from class RWCollectable.
  2342.  
  2343.    virtual         RWCollectable*   insert(RWCollectable* c);
  2344. Redefined from class RWCollection.  Inserts the item c into the
  2345. collection and returns it.  Returns nil if the insertion was
  2346. unsuccessful.  The item c is inserted according to the value
  2347. returned by compareTo().
  2348.  
  2349.    virtual ClassID  isA() const;
  2350. Redefined from class RWCollectable to return __RWBINARYTREE.
  2351.  
  2352.    virtual RWBoolean      isEmpty() const;
  2353. Redefined from class RWCollection.
  2354.  
  2355.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  2356. Inherited from class RWCollectable.
  2357.  
  2358.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  2359. Redefined from class RWCollection.  Returns the number of items that
  2360. compare equal to the item pointed to by target.
  2361.  
  2362.    virtual          RWCollectable*   remove(const RWCollectable* target);
  2363. Redefined from class RWCollection.  Removes the first item that
  2364. compares equal to the object pointed to by target and returns it.
  2365. Returns nil if no item was found.
  2366.  
  2367.    virtual void     removeAndDestroy(const RWCollectable* target);
  2368. Inherited from class RWCollection.
  2369.  
  2370.    virtual void     restoreGuts(RWvistream&);
  2371.    virtual void     restoreGuts(RWFile&);
  2372. Redefined from class RWCollection to balance the binary tree after
  2373.  
  2374. Rogue Wave      Tools.h++ Class Library                  206
  2375.  
  2376.  
  2377.  
  2378.  
  2379.  
  2380.  
  2381.  
  2382.  
  2383.                       CLASS REFERENCE
  2384.  
  2385. reading the elements.
  2386.  
  2387.    virtual void     saveGuts(RWvostream&) const;
  2388.    virtual void     saveGuts(RWFile&) const;
  2389. Inherited from class RWCollection.
  2390.  
  2391.    static        RWCollectable*    restoreFrom(RWvistream&);
  2392.    static        RWCollectable*    restoreFrom(RWFile&);
  2393.    void             saveOn(RWvostream&) const;
  2394.    void             saveOn(RWFile&) const;
  2395. Inherited from class RWCollectable.
  2396.  
  2397.  
  2398.  
  2399.  
  2400.  
  2401.  
  2402.  
  2403.  
  2404.  
  2405.  
  2406.  
  2407.  
  2408.  
  2409.  
  2410.  
  2411.  
  2412.  
  2413.  
  2414.  
  2415.  
  2416.  
  2417.  
  2418.  
  2419.  
  2420.  
  2421.  
  2422.  
  2423.  
  2424.  
  2425.  
  2426.  
  2427.  
  2428.  
  2429.  
  2430. Rogue Wave      Tools.h++ Class Library                  207
  2431.  
  2432.  
  2433.  
  2434.  
  2435.  
  2436.  
  2437.  
  2438.  
  2439.                       CLASS REFERENCE
  2440.  
  2441.  
  2442.  
  2443. class RWBinaryTreeIterator              RWBinaryTreeIterato
  2444.                                                   r
  2445.                                                   |
  2446.                                              RWIterator
  2447.  
  2448.  
  2449. Synopsis  // Smalltalk typedef:
  2450.           typedef RWBinaryTreeIterator SortedCollectionIterator;
  2451.  
  2452.           #include <bintree.h>
  2453.           RWBinaryTree bt;
  2454.           RWBinaryTreeIterator iterate(bt);
  2455.  
  2456.  
  2457.  
  2458. Descripti Iterator for class RWBinaryTree.  Traverses the tree from the
  2459. on        "smallest" to "largest" element, where "smallest" and "largest"
  2460.           are defined by the virtual function compareTo().  Note that this
  2461.           approach is generally less efficient than using the member
  2462.           function RWBinaryTree::apply().
  2463.  
  2464. Public    RWBinaryTreeIterator(const RWBinaryTree&);
  2465. construct Constructs an iterator for a RWBinaryTree.  Immediately
  2466. or        after construction, the position of the iterator is
  2467.           undefined until positioned.
  2468.  
  2469.  
  2470. Public    virtual                RWCollectable*      operator()();
  2471. member    Redefined from class RWIterator.  Advances iterator to the
  2472. operator  next "largest" element and returns a pointer to it.  Returns
  2473.           nil when the end of the collection is reached.
  2474.  
  2475.  
  2476. Public    virtual RWCollectable*    findNext(const RWCollectable* target);
  2477. member    Redefined from class RWIterator.  Moves iterator to the next
  2478. functions item which compares equal to the object pointed to by target
  2479.           and returns it.  If no item is found, returns nil and the
  2480.           position of the iterator will be undefined.
  2481.  
  2482.    virtual void     reset();
  2483. Redefined from class RWIterator.  Resets iterator to its state at
  2484. construction.
  2485.  
  2486. Rogue Wave      Tools.h++ Class Library                  208
  2487.  
  2488.  
  2489.  
  2490.  
  2491.  
  2492.  
  2493.  
  2494.  
  2495.                       CLASS REFERENCE
  2496.  
  2497.    virtual         RWCollectable*   key() const;
  2498. Redefined from class RWIterator.  Returns the item at the current
  2499. iterator position.
  2500.  
  2501.  
  2502.  
  2503.  
  2504.  
  2505.  
  2506.  
  2507.  
  2508.  
  2509.  
  2510.  
  2511.  
  2512.  
  2513.  
  2514.  
  2515.  
  2516.  
  2517.  
  2518.  
  2519.  
  2520.  
  2521.  
  2522.  
  2523.  
  2524.  
  2525.  
  2526.  
  2527.  
  2528.  
  2529.  
  2530.  
  2531.  
  2532.  
  2533.  
  2534.  
  2535.  
  2536.  
  2537.  
  2538.  
  2539.  
  2540.  
  2541.  
  2542. Rogue Wave      Tools.h++ Class Library                  209
  2543.  
  2544.  
  2545.  
  2546.  
  2547.  
  2548.  
  2549.  
  2550.  
  2551.                       CLASS REFERENCE
  2552.  
  2553.  
  2554.  
  2555. class RWbistream                                    RWbistream
  2556.                                                          |
  2557.                                                     RWvistream
  2558.                                                          |
  2559.                                                         ios
  2560.  
  2561.                                            (V2.X style iostreams, only)
  2562.  
  2563. Synopsis  #include <bstream.h>
  2564.  
  2565.           RWbistream bstr(cin);      // Construct a RWbistream, using cin's
  2566.           streambuf
  2567.  
  2568.  
  2569.  
  2570. Descripti Class RWbistream specializes the abstract base class RWvistream
  2571. on        to restore variables stored in binary format by RWbostream.
  2572.  
  2573.           You can think of it as a binary veneer over an associated
  2574.           streambuf.  Because the RWbistream retains no information
  2575.           about the state of its associated streambuf, its use can be
  2576.           freely exchanged with other users of the streambuf (such as an
  2577.           istream or ifstream).
  2578.           The restore is independent of whether the compiler is using
  2579.           AT&T V1.2 style "streams", or the newer V2.X style "iostreams"
  2580.           -- the user need not be concerned with which style is actually
  2581.           being used.  See class RWvistream for details.
  2582.           RWbistream can be interrogated as to the stream state using
  2583.           member functions good(), bad(), eof(), etc.
  2584.  
  2585.  
  2586.  
  2587.  
  2588.  
  2589.  
  2590.  
  2591.  
  2592.  
  2593.  
  2594.  
  2595.  
  2596.  
  2597.  
  2598. Rogue Wave      Tools.h++ Class Library                  210
  2599.  
  2600.  
  2601.  
  2602.  
  2603.  
  2604.  
  2605.  
  2606.  
  2607.                       CLASS REFERENCE
  2608.  
  2609. Example  This example assumes that V2.X style "iostreams" are being used. See
  2610.          RWbostream for an example of how the file "data.dat" might be created.
  2611.           #include <bstream.h>
  2612.           #include <fstream.h>
  2613.  
  2614.           main()
  2615.           {
  2616.            ifstream   fstr("data.dat");   // Open an input file
  2617.            RWbistream bstr(fstr);         // Construct RWbistream from it
  2618.  
  2619.            int i;
  2620.            float f;
  2621.            double d;
  2622.  
  2623.            bstr >> i;  // Restore an int that was stored in binary
  2624.             bstr >> f >> d;          // Restore a float & double
  2625.           }
  2626.  
  2627.  
  2628.  
  2629. Public    RWbistream(streambuf* s);
  2630. onstructo Construct a RWbistream from the streambuf s.
  2631. rs
  2632.  
  2633.    RWbistream(istream& str);
  2634. Construct a RWbistream using the streambuf associated with the
  2635. istream str.
  2636.  
  2637.  
  2638. Public    virtual int         get();
  2639. member    Redefined from class RWvistream.  Get and return the next
  2640. functions character from the input stream.  Returns EOF if end of file
  2641.           is encountered.
  2642.  
  2643.    virtual RWvistream&    get(char& c);
  2644. Redefined from class RWvistream.  Get the next char and store it in
  2645. c.
  2646.  
  2647.    virtual RWvistream&    get(unsigned char& c);
  2648. Redefined from class RWvistream.  Get the next unsigned char and
  2649. store it in c.
  2650.  
  2651.    virtual RWvistream&    get(char* v, unsigned N);
  2652. Redefined from class RWvistream.  Get a vector of char's and store
  2653.  
  2654. Rogue Wave      Tools.h++ Class Library                  211
  2655.  
  2656.  
  2657.  
  2658.  
  2659.  
  2660.  
  2661.  
  2662.  
  2663.                       CLASS REFERENCE
  2664.  
  2665. then in the array beginning at v.  If the restore is stopped
  2666. prematurely, get stores whatever it can in v, and sets the failbit.
  2667. Note that the vector is treated as a vector of numbers, not
  2668. characters.  If you wish to restore a character string, use function
  2669. getString(char*, int).
  2670.  
  2671.    virtual RWvistream&    get(double* v, unsigned N);
  2672. Redefined from class RWvistream.  Get a vector of double's and store
  2673. then in the array beginning at v.  If the restore is stopped
  2674. prematurely, get stores whatever it can in v, and sets the failbit.
  2675.  
  2676.    virtual RWvistream&    get(float* v, unsigned N);
  2677. Redefined from class RWvistream.  Get a vector of float's and store
  2678. then in the array beginning at v.  If the restore is stopped
  2679. prematurely, get stores whatever it can in v, and sets the failbit.
  2680.  
  2681.    virtual RWvistream&    get(int* v, unsigned N);
  2682. Redefined from class RWvistream.  Get a vector of int's and store
  2683. then in the array beginning at v.  If the restore is stopped
  2684. prematurely, get stores whatever it can in v, and sets the failbit.
  2685.  
  2686.    virtual RWvistream&    get(long* v, unsigned N);
  2687. Redefined from class RWvistream.  Get a vector of long's and store
  2688. then in the array beginning at v.  If the restore is stopped
  2689. prematurely, get stores whatever it can in v, and sets the failbit.
  2690.  
  2691.    virtual RWvistream&    get(short* v, unsigned N);
  2692. Redefined from class RWvistream.  Get a vector of short's and store
  2693. then in the array beginning at v.  If the restore is stopped
  2694. prematurely, get stores whatever it can in v, and sets the failbit.
  2695.  
  2696.    virtual RWvistream&    get(unsigned char* v, unsigned N);
  2697. Redefined from class RWvistream.  Get a vector of unsigned char's
  2698. and store then in the array beginning at v.  If the restore is
  2699. stopped prematurely, get stores whatever it can in v, and sets the
  2700. failbit.  Note that the vector is treated as a vector of numbers,
  2701. not characters.  If you wish to restore a character string, use
  2702. function getString(char*, int).
  2703.  
  2704.    virtual RWvistream&    get(unsigned short* v, unsigned N);
  2705. Redefined from class RWvistream.  Get a vector of unsigned short's
  2706. and store then in the array beginning at v.  If the restore is
  2707. stopped prematurely, get stores whatever it can in v, and sets the
  2708. failbit.
  2709.  
  2710. Rogue Wave      Tools.h++ Class Library                  212
  2711.  
  2712.  
  2713.  
  2714.  
  2715.  
  2716.  
  2717.  
  2718.  
  2719.                       CLASS REFERENCE
  2720.  
  2721.    virtual RWvistream&    get(unsigned int* v, unsigned N);
  2722. Redefined from class RWvistream.  Get a vector of unsigned int's and
  2723. store then in the array beginning at v.  If the restore is stopped
  2724. prematurely, get stores whatever it can in v, and sets the failbit.
  2725.  
  2726.    virtual RWvistream&    get(unsigned long* v, unsigned N);
  2727. Redefined from class RWvistream.  Get a vector of unsigned long's
  2728. and store then in the array beginning at v.  If the restore is
  2729. stopped prematurely, get stores whatever it can in v, and sets the
  2730. failbit.
  2731.  
  2732.    virtual RWvistream&    getString(char* s, unsigned N);
  2733. Redefined from class RWvistream.  Restores a character string from
  2734. the input stream and stores it in the array beginning at s.  The
  2735. function stops reading at the end of the string or after N-1
  2736. characters, whichever comes first.  If the latter, then the failbit
  2737. of the stream will be set.  In either case, the string will be
  2738. terminated with a null byte.
  2739.  
  2740.    virtual RWvistream&    operator>>(char& c);
  2741. Redefined from class RWvistream.  Get the next character from the
  2742. input stream and store it in c.
  2743.  
  2744.    virtual RWvistream&    operator>>(double& d);
  2745. Redefined from class RWvistream.  Get the next double from the input
  2746. stream and store it in d.
  2747.  
  2748.    virtual RWvistream&    operator>>(float& f);
  2749. Redefined from class RWvistream.  Get the next float from the input
  2750. stream and store it in f.
  2751.  
  2752.    virtual RWvistream&    operator>>(int& i);
  2753. Redefined from class RWvistream.  Get the next int from the input
  2754. stream and store it in i.
  2755.  
  2756.    virtual RWvistream&    operator>>(long& l);
  2757. Redefined from class RWvistream.  Get the next long from the input
  2758. stream and store it in l.
  2759.  
  2760.    virtual RWvistream&    operator>>(short& s);
  2761. Redefined from class RWvistream.  Get the next short from the input
  2762. stream and store it in s.
  2763.  
  2764.  
  2765.  
  2766. Rogue Wave      Tools.h++ Class Library                  213
  2767.  
  2768.  
  2769.  
  2770.  
  2771.  
  2772.  
  2773.  
  2774.  
  2775.                       CLASS REFERENCE
  2776.  
  2777.    virtual RWvistream&    operator>>(unsigned char& c);
  2778. Redefined from class RWvistream.  Get the next unsigned char from
  2779. the input stream and store it in c.
  2780.  
  2781.    virtual RWvistream&    operator>>(unsigned short& s);
  2782. Redefined from class RWvistream.  Get the next unsigned short from
  2783. the input stream and store it in s.
  2784.  
  2785.    virtual RWvistream&    operator>>(unsigned int& i);
  2786. Redefined from class RWvistream.  Get the next unsigned int from the
  2787. input stream and store it in i.
  2788.  
  2789.    virtual RWvistream&    operator>>(unsigned long& l);
  2790. Redefined from class RWvistream.  Get the next unsigned long from
  2791. the input stream and store it in l.
  2792.  
  2793.  
  2794.  
  2795.  
  2796.  
  2797.  
  2798.  
  2799.  
  2800.  
  2801.  
  2802.  
  2803.  
  2804.  
  2805.  
  2806.  
  2807.  
  2808.  
  2809.  
  2810.  
  2811.  
  2812.  
  2813.  
  2814.  
  2815.  
  2816.  
  2817.  
  2818.  
  2819.  
  2820.  
  2821.  
  2822. Rogue Wave      Tools.h++ Class Library                  214
  2823.  
  2824.  
  2825.  
  2826.  
  2827.  
  2828.  
  2829.  
  2830.  
  2831.                       CLASS REFERENCE
  2832.  
  2833.  
  2834.  
  2835. class RWBitVec
  2836.  
  2837.  
  2838.  
  2839.  
  2840.  
  2841. Synopsis  #include <bitvec.h>
  2842.  
  2843.           RWBitVec v;
  2844.  
  2845.  
  2846.  
  2847. Descripti Class RWBitVec is a bitvector whose length can be changed
  2848. on        dynamically at run time.  Because this requires an extra level
  2849.           of indirection, this makes it slightly less efficient than
  2850.           class GBitVec(size), whose length is fixed at compile time.
  2851.  
  2852. Example   #include <bitvec.h>
  2853.           #include <rstream.h>
  2854.  
  2855.           main()
  2856.  
  2857.           {
  2858.             // Allocate a vector with 20 bits, set to TRUE:
  2859.             RWBitVec av(20, TRUE);
  2860.  
  2861.             av(2) = FALSE;           // Turn bit 2 off
  2862.             av.clearBit(7);          // Turn bit 7 off
  2863.             av.setBit(2);            // Turn bit 2 back on
  2864.  
  2865.  
  2866.             for(int i=11; i<=14; i++) av(i) = FALSE;
  2867.  
  2868.             cout << av << NL;        // Print the vector out
  2869.           }
  2870.  
  2871.           Program output:
  2872.  
  2873.  
  2874.  
  2875.  
  2876.  
  2877.  
  2878. Rogue Wave      Tools.h++ Class Library                  215
  2879.  
  2880.  
  2881.  
  2882.  
  2883.  
  2884.  
  2885.  
  2886.  
  2887.                       CLASS REFERENCE
  2888.  
  2889.                        [
  2890.                        1 1 1 1 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 1
  2891.                        ]
  2892.  
  2893.  
  2894.  
  2895.  
  2896. Public    RWBitVec();
  2897. constructoConstruct a zero lengthed (null) vector.
  2898. rs
  2899.  
  2900.    RWBitVec(unsigned N);
  2901. Construct a vector with N bits.  The initial value of the bits is
  2902. undefined.
  2903.  
  2904.    RWBitVec(unsigned N, RWBoolean initVal);
  2905. Construct a vector with N bits, each set to the Boolean value
  2906. initVal.
  2907.  
  2908.    RWBitVec(const RWByte* bp, unsigned N);
  2909. Construct a vector with N bits, initialized to the data in the array
  2910. of bytes pointed to by bp.  This array must be at least long enough
  2911. to contain N bits.  The identifier RWByte is a typedef for an
  2912. unsigned char.
  2913.  
  2914.    RWBitVec(const RWBitVec& v);
  2915. Copy constructor.  Uses value semantics -- the constructed vector
  2916. will be a copy of v.
  2917.  
  2918.    ~RWBitVec();
  2919. The destructor.  Releases any allocated memory.
  2920.  
  2921.  
  2922. Assignment RWBitVec&           operator=(const RWBitVec& v);
  2923. operators  Assignment operator.  Value semantics are used -- self
  2924.            will be a copy of v.
  2925.  
  2926.    RWBitVec&        operator=(RWBoolean b);
  2927. Assignment operator.  Sets every bit in self to the boolean value b.
  2928.  
  2929.    RWBitVec&        operator&=(const RWBitVec& v);
  2930.    RWBitVec&        operator^=(const RWBitVec& v);
  2931.    RWBitVec&        operator|=(const RWBitVec& v);
  2932. Logical assignments.  Set each element of self to the logical AND,
  2933.  
  2934. Rogue Wave      Tools.h++ Class Library                  216
  2935.  
  2936.  
  2937.  
  2938.  
  2939.  
  2940.  
  2941.  
  2942.  
  2943.                       CLASS REFERENCE
  2944.  
  2945. XOR, or OR, respectively, of self and the corresponding bit in v.
  2946. Self and v must have the same number of elements (i.e., be
  2947. conformal) or an exception will occur with error number TOOL_NEVECL.
  2948.  
  2949.  
  2950. Indexing  RWBitRef            operator[](int i);
  2951. operators Returns a reference to bit i of self.  A helper class,
  2952. :         RWBitRef, is used.  The result can be used as an lvalue.
  2953.           The index i must be between 0 and the length of the vector
  2954.           less one.  Bounds checking is performed.  If the index is
  2955.           out of range, then an exception will occur with error value
  2956.           TOOL_INDEX.
  2957.  
  2958.    RWBitRef         operator()(int i);
  2959. Returns a reference to bit i of self.  A helper class, RWBitRef, is
  2960. used.  The result can be used as an lvalue.  The index i must be
  2961. between 0 and the length of the vector less one.  Bounds checking is
  2962. performed only if the preprocessor macro BOUNDS_CHECK has been
  2963. defined before including the header file bitvec.h.  If so, and if
  2964. the index is out of range, then an exception will occur with error
  2965. value TOOL_INDEX.
  2966.  
  2967.    RWBoolean        operator[](int i) const;
  2968. Returns the boolean value of bit i.  The result cannot be used as an
  2969. lvalue.  The index i must be between 0 and the length of the vector
  2970. less one.  Bounds checking is performed.  If the index is out of
  2971. range, then an exception will occur with error value TOOL_INDEX.
  2972.  
  2973.    RWBoolean        operator()(int i) const;
  2974. Returns the boolean value of bit i.  The result cannot be used as an
  2975. lvalue.  The index i must be between 0 and the length of the vector
  2976. less one.  Bounds checking is performed only if the preprocessor
  2977. macro BOUNDS_CHECK has been defined before including the header file
  2978. bitvec.h.  If so, and if the index is out of range, then an
  2979. exception will occur with error value TOOL_INDEX.
  2980.  
  2981.  
  2982. Logical   RWBoolean           operator==(const RWBitVec& u) const;
  2983. operators Returns TRUE if self and v have the same length and if each
  2984.           bit of self is set to the same value as the corresponding
  2985.           bit in v.  Otherwise, returns FALSE.
  2986.  
  2987.    RWBoolean        operator!=(const RWBitVec& u) const;
  2988. Returns FALSE if self and v have the same length and if each bit of
  2989.  
  2990. Rogue Wave      Tools.h++ Class Library                  217
  2991.  
  2992.  
  2993.  
  2994.  
  2995.  
  2996.  
  2997.  
  2998.  
  2999.                       CLASS REFERENCE
  3000.  
  3001. self is set to the same value as the corresponding bit in v.
  3002. Otherwise, returns TRUE.
  3003.  
  3004.    RWBoolean        operator==(RWBoolean b) const;
  3005. Returns TRUE if every bit of self is set to the boolean value b.
  3006. Otherwise FALSE.
  3007.  
  3008.    RWBoolean        operator!=(RWBoolean b) const;
  3009. Returns FALSE if every bit of self is set to the boolean value b.
  3010. Otherwise TRUE.
  3011.  
  3012.  
  3013. Public    void                clearBit(int i);
  3014. member    Clears (i.e., sets to FALSE) the bit with index i.  The index
  3015. functions i must be between 0 and the length of the vector less one.
  3016.           No bounds checking is performed.  The following are
  3017.           equivalent, although clearBit(int) is slightly smaller and
  3018.           faster than using operator()(int):
  3019.                  a(i) = FALSE;
  3020.                  a.clearBit(i);
  3021.  
  3022.    const RWByte*    data() const;
  3023. Returns a const pointer to the raw data of self.  Should be used
  3024. with care.
  3025.  
  3026.    unsigned         hash() const;
  3027. Returns a value suitable for hashing.
  3028.  
  3029.    RWBoolean        isEqual(const RWBitVec& v) const;
  3030. Returns TRUE if self and v have the same length and if each bit of
  3031. self is set to the same value as the corresponding bit in v.
  3032. Otherwise, returns FALSE.
  3033.  
  3034.    unsigned         length() const;
  3035. Returns the number of bits in the vector.
  3036.  
  3037.    ostream&         printOn(ostream& s) const;
  3038. Print the vector v on the output stream s.  See the example above
  3039. for a sample of the format.
  3040.  
  3041.    void             resize(unsigned N);
  3042. Resizes the vector to have length N.  If this results in a
  3043. lengthening of the vector, the additional bits will be set to FALSE.
  3044.  
  3045.  
  3046. Rogue Wave      Tools.h++ Class Library                  218
  3047.  
  3048.  
  3049.  
  3050.  
  3051.  
  3052.  
  3053.  
  3054.  
  3055.                       CLASS REFERENCE
  3056.  
  3057.    void             restoreFrom(RWvistream& s);
  3058. Restores a vector that was stored using member function
  3059. storeOn(RWvostream&).
  3060.  
  3061.    void             restoreFrom(RWFile& f);
  3062. Restores a vector stored on a RWFile using member function
  3063. storeOn(RWFile&).
  3064.  
  3065.    void             saveOn(RWVostream& s) const;
  3066. Stores self to a virtual output stream.
  3067.  
  3068.    void             saveOn(RWFile& f) const;
  3069. Stores self to an RWFile.
  3070.  
  3071.    istream&         scanFrom(istream&);
  3072. Read the bit vector from the input stream s.  The vector will
  3073. dynamically be resized as necessary.  The vector should be in the
  3074. same format printed by member function printOn(ostream&).
  3075.  
  3076.    void             setBit(int i);           // Set bit i
  3077. Sets (i.e., sets to TRUE) the bit with index i.  The index i must be
  3078. between 0 and size-1.  No bounds checking is performed.  The
  3079. following are equivalent, although setBit(int) is slightly smaller
  3080. and faster than using operator()(int):
  3081.                  a(i) = TRUE;
  3082.                  a.setBit(i);
  3083.  
  3084.    RWBoolean        testBit(int i) const;
  3085. Tests the bit with index i.  The index i must be between 0 and size-
  3086. 1.  No bounds checking is performed.  The following are equivalent,
  3087. although testBit(int) is slightly smaller and faster than using
  3088. operator()(int):
  3089.                  if( a(i) )       doSomething();
  3090.                  if( testBit(i) ) doSomething();
  3091.  
  3092.  
  3093.  
  3094.  
  3095.  
  3096.  
  3097.  
  3098.  
  3099.  
  3100.  
  3101.  
  3102. Rogue Wave      Tools.h++ Class Library                  219
  3103.  
  3104.  
  3105.  
  3106.  
  3107.  
  3108.  
  3109.  
  3110.  
  3111.                       CLASS REFERENCE
  3112.  
  3113. Related   RWBitVec            operator!(const RWBitVec& v);
  3114. global    Unary operator that returns the logical negation of vector
  3115. functions v.
  3116.  
  3117.    RWBitVec         operator&(const RWBitVec&,const RWBitVec&);
  3118.    RWBitVec         operator^(const RWBitVec&,const RWBitVec&);
  3119.    RWBitVec         operator|(const RWBitVec&,const RWBitVec&);
  3120. Returns a vector that is the logical AND, XOR, or OR of the vectors
  3121. v1 and v2.  The two vectors must have the same length or an
  3122. exception will occur with error number TOOL_NEVECL.
  3123.  
  3124.    ostream&         operator<<(ostream& s, const RWBitVec& v);
  3125. Calls v.printOn(s).
  3126.  
  3127.    istream&         operator>>(istream& s, RWBitVec& v);
  3128. Calls v.scanFrom(s).
  3129.  
  3130.    int              sum(const RWBitVec& v);
  3131. Returns the total number of bits set in the vector v.
  3132.  
  3133.  
  3134.  
  3135.  
  3136.  
  3137.  
  3138.  
  3139.  
  3140.  
  3141.  
  3142.  
  3143.  
  3144.  
  3145.  
  3146.  
  3147.  
  3148.  
  3149.  
  3150.  
  3151.  
  3152.  
  3153.  
  3154.  
  3155.  
  3156.  
  3157.  
  3158. Rogue Wave      Tools.h++ Class Library                  220
  3159.  
  3160.  
  3161.  
  3162.  
  3163.  
  3164.  
  3165.  
  3166.  
  3167.                       CLASS REFERENCE
  3168.  
  3169.  
  3170.  
  3171. class RWbostream                                     RWbostream
  3172.                                                          |
  3173.                                                      RWvostream
  3174.                                                          |
  3175.                                                         ios
  3176.  
  3177.                                             (V2.X style iostreams, only)
  3178.  
  3179. Synopsis  #include <bstream.h>
  3180.  
  3181.           // Construct a RWbostream, using cout's streambuf:
  3182.           RWbostream bstr(cout);
  3183.  
  3184.  
  3185.  
  3186. Descripti Class RWbostream specializes the abstract base class RWvostream
  3187. on        to store variables in binary format.  The results can be
  3188.           restored by using its counterpart RWbistream.
  3189.           You can think of it as a binary veneer over an associated
  3190.           streambuf.  Because the RWbostream retains no information
  3191.           about the state of its associated streambuf, its use can be
  3192.           freely exchanged with other users of the streambuf (such as
  3193.           ostream or ofstream).
  3194.           Note that variables should not be separated with whitespace.
  3195.           Such whitespace would be interpreted literally and would have
  3196.           to be read back in as a character string.
  3197.           Storage is independent of whether the compiler is using AT&T
  3198.           V1.2 style "streams", or the newer V2.X style "iostreams" --
  3199.           the user need not be concerned with which style is actually
  3200.           being used.  See class RWvostream for details.
  3201.           RWbostream can be interrogated as to the stream state using
  3202.           member functions good(), bad(), eof(), etc.
  3203.  
  3204.  
  3205.  
  3206.  
  3207.  
  3208.  
  3209.  
  3210.  
  3211.  
  3212.  
  3213.  
  3214. Rogue Wave      Tools.h++ Class Library                  221
  3215.  
  3216.  
  3217.  
  3218.  
  3219.  
  3220.  
  3221.  
  3222.  
  3223.                       CLASS REFERENCE
  3224.  
  3225. Example   This example assumes that V2.X style "iostreams" are being used.
  3226.           See RWbistream for an example of how the file "data.dat" might be
  3227.           read back in.
  3228.           #include <bstream.h>
  3229.           #include <fstream.h>
  3230.  
  3231.           main()
  3232.           {
  3233.             ofstream fstr("data.dat");      // Open an output file
  3234.             RWbostream bstr(fstr);          // Construct an RWbostream from it
  3235.  
  3236.             int i = 5;
  3237.             float f = 22.1;
  3238.             double d = -0.05;
  3239.  
  3240.             bstr << i;               // Store an int in binary
  3241.             bstr << f << d;                 // Store a float & double
  3242.           }
  3243.  
  3244.  
  3245.  
  3246. Public    RWbostream(streambuf* s);
  3247. construct Construct a RWbostream from the streambuf s.
  3248. ors
  3249.  
  3250.    RWbostream(ostream& str);
  3251. Construct a RWbostream from the streambuf associated with the output
  3252. stream str.
  3253.  
  3254.  
  3255. Public    virtual RWvostream& operator<<(const char* s);
  3256. member    Redefined from class RWvostream.  Store the character
  3257. functions string starting at s to the output stream in binary.  The
  3258.           character string is expected to be null terminated.
  3259.  
  3260.    virtual RWvostream&    operator<<(char c);
  3261. Redefined from class RWvostream.  Store the char c to the output
  3262. stream in binary.  Note that c is treated as a character, not a
  3263. number.
  3264.  
  3265.    virtual RWvostream&    operator<<(unsigned char c);
  3266. Redefined from class RWvostream.  Store the unsigned char c to the
  3267. output stream in binary.  Note that c is treated as a character, not
  3268. a number.
  3269.  
  3270. Rogue Wave      Tools.h++ Class Library                  222
  3271.  
  3272.  
  3273.  
  3274.  
  3275.  
  3276.  
  3277.  
  3278.  
  3279.                       CLASS REFERENCE
  3280.  
  3281.    virtual RWvostream&    operator<<(double d);
  3282. Redefined from class RWvostream.  Store the double d to the output
  3283. stream in binary.
  3284.  
  3285.    virtual RWvostream&    operator<<(float f);
  3286. Redefined from class RWvostream.  Store the float f to the output
  3287. stream in binary.
  3288.  
  3289.    virtual RWvostream&    operator<<(int i);
  3290. Redefined from class RWvostream.  Store the int i to the output
  3291. stream in binary.
  3292.  
  3293.    virtual RWvostream&    operator<<(unsigned int i);
  3294. Redefined from class RWvostream.  Store the unsigned int i to the
  3295. output stream in binary.
  3296.  
  3297.    virtual RWvostream&    operator<<(long l);
  3298. Redefined from class RWvostream.  Store the long l to the output
  3299. stream in binary.
  3300.  
  3301.    virtual RWvostream&    operator<<(unsigned long l);
  3302. Redefined from class RWvostream.  Store the unsigned long l to the
  3303. output stream in binary.
  3304.  
  3305.    virtual RWvostream&    operator<<(short s);
  3306. Redefined from class RWvostream.  Store the short s to the output
  3307. stream in binary.
  3308.  
  3309.    virtual RWvostream&    operator<<(unsigned short s);
  3310. Redefined from class RWvostream.  Store the unsigned short s to the
  3311. output stream in binary.
  3312.  
  3313.    virtual RWvostream&    put(char c);
  3314. Redefined from class RWvostream.  Store the character c to the
  3315. output stream, preserving its value in binary.
  3316.  
  3317.    virtual RWvostream&    put(unsigned char c);
  3318. Redefined from class RWvostream.  Store the character c to the
  3319. output stream, preserving its value in binary.
  3320.  
  3321.    virtual RWvostream&    put(const char* p, unsigned N);
  3322. Redefined from class RWvostream.  Store the vector of chars starting
  3323. at p to the output stream in binary.  The characters should be
  3324. treated as literal numbers (i.e., not as a character string).
  3325.  
  3326. Rogue Wave      Tools.h++ Class Library                  223
  3327.  
  3328.  
  3329.  
  3330.  
  3331.  
  3332.  
  3333.  
  3334.  
  3335.                       CLASS REFERENCE
  3336.  
  3337.    virtual RWvostream&    put(const unsigned char* p, unsigned N);
  3338. Redefined from class RWvostream.  Store the vector of unsigned chars
  3339. starting at p to the output stream in binary.  The characters should
  3340. be treated as literal numbers (i.e., not as a character string).
  3341.  
  3342.    virtual RWvostream&    put(const short* p, unsigned N);
  3343. Redefined from class RWvostream.  Store the vector of shorts
  3344. starting at p to the output stream in binary.
  3345.  
  3346.    virtual RWvostream&    put(const unsigned short* p, unsigned N);
  3347. Redefined from class RWvostream.  Store the vector of unsigned
  3348. shorts starting at p to the output stream in binary.
  3349.  
  3350.    virtual RWvostream&    put(const int* p, unsigned N);
  3351. Redefined from class RWvostream.  Store the vector of ints starting
  3352. at p to the output stream in binary.
  3353.  
  3354.    virtual RWvostream&    put(const unsigned int* p, unsigned N);
  3355. Redefined from class RWvostream.  Store the vector of unsigned ints
  3356. starting at p to the output stream in binary.
  3357.  
  3358.    virtual RWvostream&    put(const long* p, unsigned N);
  3359. Redefined from class RWvostream.  Store the vector of longs starting
  3360. at p to the output stream in binary.
  3361.  
  3362.    virtual RWvostream&    put(const unsigned long* p, unsigned N);
  3363. Redefined from class RWvostream.  Store the vector of unsigned longs
  3364. starting at p to the output stream in binary.
  3365.  
  3366.    virtual RWvostream&    put(const float* p, unsigned N);
  3367. Redefined from class RWvostream.  Store the vector of floats
  3368. starting at p to the output stream in binary.
  3369.  
  3370.    virtual RWvostream&    put(const double* p, unsigned N);
  3371. Redefined from class RWvostream.  Store the vector of doubles
  3372. starting at p to the output stream in binary.
  3373.  
  3374.  
  3375.  
  3376.  
  3377.  
  3378.  
  3379.  
  3380.  
  3381.  
  3382. Rogue Wave      Tools.h++ Class Library                  224
  3383.  
  3384.  
  3385.  
  3386.  
  3387.  
  3388.  
  3389.  
  3390.  
  3391.                       CLASS REFERENCE
  3392.  
  3393.  
  3394.  
  3395. class RWBTree                                         RWBTree
  3396.                                                          |
  3397.                                                     RWCollection
  3398.                                                          |
  3399.                                                    RWCollectable
  3400.  
  3401. Synopsis  #include <btree.h>
  3402.           RWBTree a;
  3403.  
  3404.  
  3405.  
  3406. Descripti Class RWBTree represents a group of ordered elements, not
  3407. on        accessible by an external key.  Duplicates are not allowed.  An
  3408.           object stored by class RWBTree must inherit abstract base class
  3409.           RWCollectable -- the elements are ordered internally according to
  3410.           the value returned by virtual function compareTo() (see class
  3411.           RWCollectable).
  3412.           This class has certain advantages over class RWBinaryTree.
  3413.           First, the B-Tree is automatically balanced.  (With class
  3414.           RWBinaryTree, you must call member function balance()
  3415.           explicitly to balance the tree.)  Nodes are never allowed to
  3416.           have less than a certain number of items (called the order).
  3417.           The default order is 50, but may be changed by resetting the
  3418.           value of the static constant "order" in the header file
  3419.           <btree.h> and recompiling.  Larger values will result in
  3420.           shallower trees, but less efficient use of memory.
  3421.           Because many keys are held in a single node, class RWBTree
  3422.           also tends to fragment memory less.
  3423.  
  3424. Public    RWBTree();
  3425. construct Construct an empty B-Tree.
  3426. or
  3427.  
  3428.    RWBTree(const RWBTree& btr);
  3429. Construct self as a shallow copy of btr.
  3430.  
  3431.    virtual          ~RWBTree();
  3432. Redefined from RWCollection.  Calls clear().
  3433.  
  3434.  
  3435.  
  3436.  
  3437.  
  3438. Rogue Wave      Tools.h++ Class Library                  225
  3439.  
  3440.  
  3441.  
  3442.  
  3443.  
  3444.  
  3445.  
  3446.  
  3447.                       CLASS REFERENCE
  3448.  
  3449.  
  3450. Public    void                operator=(const RWBTree& btr);
  3451. member    Set self to a shallow copy of btr.
  3452. operators
  3453.           RWBoolean           operator<=(const RWBTree& btr) const;
  3454.           Returns TRUE if self is a subset of btr.  That is, for every
  3455.           item in self, there must be an item in btr that compares
  3456.           equal.
  3457.  
  3458.    RWBoolean        operator==(const RWBTree& btr) const;
  3459. Returns TRUE if self and btr are equivalent.  That is, they must
  3460. have the same number of items and for every item in self, there must
  3461. be an item in btr that compares equal.
  3462.  
  3463.  
  3464. Public    virtual void          apply(applyCollectable ap, void*)
  3465. member    Redefined from class RWCollection to apply the user-supplied
  3466. functions function pointed to by ap to each member of the collection,
  3467.           in order, from smallest to largest.  This supplied function
  3468.           should not do anything to the items that could change the
  3469.           ordering of the collection.
  3470.  
  3471.    virtual         unsigned   binaryStoreSize() const;
  3472. Inherited from class RWCollection.
  3473.  
  3474.    virtual         void       clear();
  3475. Redefined from class RWCollection.
  3476.  
  3477.    virtual         void       clearAndDestroy();
  3478. Inherited from class RWCollection.
  3479.  
  3480.    virtual         int        compareTo(const RWCollectable* a) const;
  3481. Inherited from class RWCollectable.
  3482.  
  3483.    virtual         RWBoolean  contains(const RWCollectable* target) const;
  3484. Inherited from class RWCollection.
  3485.  
  3486.    virtual         unsigned   entries() const;
  3487. Redefined from class RWCollection.
  3488.  
  3489.    virtual         RWCollectable*   find(const RWCollectable* target) const;
  3490. Redefined from class RWCollection.  The first item that compares
  3491. equal to the object pointed to by target is returned or nil if no
  3492. item is found.
  3493.  
  3494. Rogue Wave      Tools.h++ Class Library                  226
  3495.  
  3496.  
  3497.  
  3498.  
  3499.  
  3500.  
  3501.  
  3502.  
  3503.                       CLASS REFERENCE
  3504.  
  3505.    virtual         unsigned   hash() const;
  3506. Inherited from class RWCollectable.
  3507.  
  3508.    unsigned         height() const;
  3509. Special member function of this class.  Returns the height of the
  3510. tree, defined as the number of nodes traversed while descending from
  3511. the root node to an external (leaf) node.
  3512.  
  3513.    virtual         RWCollectable*   insert(RWCollectable* c);
  3514. Redefined from class RWCollection.  Inserts the item c into the
  3515. collection and returns it.  Returns nil if the insertion was
  3516. unsuccessful.  The item c is inserted according to the value
  3517. returned by compareTo().
  3518.  
  3519.    virtual ClassID  isA() const;
  3520. Redefined from class RWCollectable to return __RWBTREE.
  3521.  
  3522.    virtual RWBoolean      isEmpty() const;
  3523. Redefined from class RWCollection.
  3524.  
  3525.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  3526. Inherited from class RWCollectable.
  3527.  
  3528.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  3529. Redefined from class RWCollection.  Returns the number of items that
  3530. compare equal to target.  Since duplicates are not allowed, this
  3531. function can only return 0 or 1.
  3532.  
  3533.    virtual         RWCollectable*   remove(const RWCollectable* target);
  3534. Redefined from class RWCollection.  Removes and returns the first
  3535. item that compares equal to the object pointed to by target.
  3536. Returns nil if no item was found.
  3537.  
  3538.    virtual void     removeAndDestroy(const RWCollectable* target);
  3539. Inherited from class RWCollection.
  3540.  
  3541.    virtual void     restoreGuts(RWvistream&);
  3542.    virtual void     restoreGuts(RWFile&);
  3543.    virtual void     saveGuts(RWvostream&) const;
  3544.    virtual void     saveGuts(RWFile&) const;
  3545. Inherited from class RWCollection.
  3546.  
  3547.    static        RWCollectable*    restoreFrom(RWvistream&);
  3548.    static        RWCollectable*    restoreFrom(RWFile&);
  3549.  
  3550. Rogue Wave      Tools.h++ Class Library                  227
  3551.  
  3552.  
  3553.  
  3554.  
  3555.  
  3556.  
  3557.  
  3558.  
  3559.                       CLASS REFERENCE
  3560.  
  3561.    void             saveOn(RWvostream&) const;
  3562.    void             saveOn(RWFile&) const;
  3563. Inherited from class RWCollectable.
  3564.  
  3565.  
  3566.  
  3567.  
  3568.  
  3569.  
  3570.  
  3571.  
  3572.  
  3573.  
  3574.  
  3575.  
  3576.  
  3577.  
  3578.  
  3579.  
  3580.  
  3581.  
  3582.  
  3583.  
  3584.  
  3585.  
  3586.  
  3587.  
  3588.  
  3589.  
  3590.  
  3591.  
  3592.  
  3593.  
  3594.  
  3595.  
  3596.  
  3597.  
  3598.  
  3599.  
  3600.  
  3601.  
  3602.  
  3603.  
  3604.  
  3605.  
  3606. Rogue Wave      Tools.h++ Class Library                  228
  3607.  
  3608.  
  3609.  
  3610.  
  3611.  
  3612.  
  3613.  
  3614.  
  3615.                       CLASS REFERENCE
  3616.  
  3617.  
  3618.  
  3619. class RWBTreeDictionary                          RWBTreeDictionary
  3620.                                                          |
  3621.                                                       RWBTree
  3622.                                                          |
  3623.                                                    RWCollection
  3624.                                                          |
  3625.                                                    RWCollectable
  3626.  
  3627. Synopsis  #include <btrdict.h>
  3628.  
  3629.           RWBTreeDictionary a;
  3630.  
  3631.  
  3632.  
  3633. Descripti Dictionary class implemented as a B-Tree, for the storage and
  3634. on        retrieval of key-value pairs.  Both the keys and values must
  3635.           inherit abstract base class RWCollectable -- the elements are
  3636.           ordered internally according to the value returned by virtual
  3637.           function compareTo() of the key (see class RWCollectable).
  3638.           Duplicate keys are not allowed.
  3639.           The B-Tree is balanced.  That is, nodes are never allowed to
  3640.           have less than a certain number of items (called the order).
  3641.           The default order is 50, but may be changed by resetting the
  3642.           value of the static constant "order" in the header file
  3643.           <btree.h> and recompiling.  Larger values will result in
  3644.           shallower trees, but less efficient use of memory.
  3645.  
  3646. Public    RWBTreeDictionary();
  3647. construct Constructs an empty B-Tree dictionary.
  3648. ors
  3649.  
  3650.  
  3651. Public    void    applyToKeyAndValue(applyKeyAndValue ap, void*)
  3652. member    Applies the user-supplied function pointed to by ap to each
  3653. functions key-value pair of the collection, in order, from smallest to
  3654.           largest.
  3655.  
  3656.    virtual unsigned binaryStoreSize() const
  3657. Inherited from class RWCollection.
  3658.  
  3659.    virtual void     clear();
  3660. Redefined from class RWCollection.  Removes all key-value pairs from
  3661.  
  3662. Rogue Wave      Tools.h++ Class Library                  229
  3663.  
  3664.  
  3665.  
  3666.  
  3667.  
  3668.  
  3669.  
  3670.  
  3671.                       CLASS REFERENCE
  3672.  
  3673. the collection.
  3674.  
  3675.    virtual void     clearAndDestroy();
  3676. Redefined from class RWCollection.  Removes all key-value pairs in
  3677. the collection, and deletes both the key and the value.
  3678.  
  3679.    virtual int      compareTo(const RWCollectable* a) const;
  3680. Inherited from class RWCollectable.
  3681.  
  3682.    virtual RWBoolean      contains(const RWCollectable* target) const;
  3683. Inherited from class RWCollection.
  3684.  
  3685.    virtual unsigned entries() const;
  3686. Redefined from class RWCollection.
  3687.  
  3688.    virtual         RWCollectable*   find(const RWCollectable* key) const;
  3689. Redefined from class RWCollection.  Returns the key in the
  3690. collection which compares equal to the object pointed to by target,
  3691. or nil if no key is found.
  3692.  
  3693.    RWCollectable*   findKeyAndValue(const RWCollectable* target,
  3694.                     RWCollectable*& v) const;
  3695. Returns the key in the collection which compares equal to the object
  3696. pointed to by target, or nil if no key was found.  The value is put
  3697. in v.  You are responsible for defining v before calling this
  3698. function.
  3699.  
  3700.    RWCollectable*   findValue(const RWCollectable* target) const;
  3701. Returns the value associated with the key which compares equal to
  3702. the object pointed to by target, or nil if no key was found.
  3703.  
  3704.    RWCollectable*   findValue(const RWCollectable* target,
  3705.                     RWCollectable* newValue);
  3706. Returns the value associated with the key which compares equal to
  3707. the object pointed to by target, or nil if no key was found.
  3708. Replaces the value with newValue (if a key was found).
  3709.  
  3710.    virtual unsigned hash() const;
  3711. Inherited from class RWCollectable.
  3712.  
  3713.    unsigned         height() const;
  3714. Inherited from class RWBTree.
  3715.  
  3716.    RWCollectable*   insertKeyAndValue(RWCollectable* key,
  3717.  
  3718. Rogue Wave      Tools.h++ Class Library                  230
  3719.  
  3720.  
  3721.  
  3722.  
  3723.  
  3724.  
  3725.  
  3726.  
  3727.                       CLASS REFERENCE
  3728.  
  3729.                     RWCollectable* value);
  3730. Adds a key-value pair to the collection and returns the key if
  3731. successful, nil if the key is already in the collection.
  3732.  
  3733.    virtual ClassID  isA() const;
  3734. Redefined from class RWCollectable to return __RWBTREEDICTIONARY.
  3735.  
  3736.    virtual RWBoolean      isEmpty() const;
  3737. Inherited from class RWBTree.
  3738.  
  3739.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  3740. Inherited from class RWCollectable.
  3741.  
  3742.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  3743. Redefined from class RWCollection.  Returns the number of keys that
  3744. compare equal with target.  Because duplicates are not allowed, this
  3745. function can only return 0 or 1.
  3746.  
  3747.    virtual         RWCollectable*   remove(const RWCollectable* target);
  3748. Redefined from class RWCollection.  Removes the key and value pair
  3749. for which the key compares equal to the object pointed to by target.
  3750. Returns the key, or nil if no match was found.
  3751.  
  3752.    virtual void     removeAndDestroy(const RWCollectable* target);
  3753. Redefined from class RWCollection.  Removes and deletes the key and
  3754. value pair for which the key compares equal to the object pointed to
  3755. by target.  Note that both the key and the value are deleted.  Does
  3756. nothing if the key is not found.
  3757.  
  3758.    RWCollectable*   removeKeyAndValue(const RWCollectable* target, 
  3759.                     RWCollectable*& v);
  3760. Removes the key and value pair for which the key compares equal to
  3761. the object pointed to by target.  Returns the key, or nil if no
  3762. match was found.  The value is put in v.  You are responsible for
  3763. defining v before calling this function.
  3764.  
  3765.    virtual void     restoreGuts(RWvistream&);
  3766.    virtual void     restoreGuts(RWFile&);
  3767.    virtual void     saveGuts(RWvostream&) const;
  3768.    virtual void     saveGuts(RWFile&) const;
  3769. Inherited from class RWCollection.
  3770.  
  3771.    static        RWCollectable*    restoreFrom(RWvistream&);
  3772.    static        RWCollectable*    restoreFrom(RWFile&);
  3773.  
  3774. Rogue Wave      Tools.h++ Class Library                  231
  3775.  
  3776.  
  3777.  
  3778.  
  3779.  
  3780.  
  3781.  
  3782.  
  3783.                       CLASS REFERENCE
  3784.  
  3785.    void             saveOn(RWvostream&) const;
  3786.    void             saveOn(RWFile&) const;
  3787. Inherited from class RWCollectable.
  3788.  
  3789.  
  3790.  
  3791.  
  3792.  
  3793.  
  3794.  
  3795.  
  3796.  
  3797.  
  3798.  
  3799.  
  3800.  
  3801.  
  3802.  
  3803.  
  3804.  
  3805.  
  3806.  
  3807.  
  3808.  
  3809.  
  3810.  
  3811.  
  3812.  
  3813.  
  3814.  
  3815.  
  3816.  
  3817.  
  3818.  
  3819.  
  3820.  
  3821.  
  3822.  
  3823.  
  3824.  
  3825.  
  3826.  
  3827.  
  3828.  
  3829.  
  3830. Rogue Wave      Tools.h++ Class Library                  232
  3831.  
  3832.  
  3833.  
  3834.  
  3835.  
  3836.  
  3837.  
  3838.  
  3839.                       CLASS REFERENCE
  3840.  
  3841.  
  3842.  
  3843. class RWBTreeOnDisk
  3844.  
  3845.  
  3846.  
  3847.  
  3848.  
  3849. Synopsis  typedef             long   storedValue;
  3850.  
  3851.           #include <disktree.h>
  3852.           #include <filemgr.h>
  3853.  
  3854.           RWFileManager fm("filename.dat");
  3855.           RWBTreeOnDisk bt(fm);
  3856.  
  3857.  
  3858.  
  3859. Descripti Class RWBTreeOnDisk represents an ordered collection of associations
  3860. on        of keys and values, where the ordering is determined internally by
  3861.           comparing keys lexicographically.  Values are accessible by using
  3862.           external keys (i.e., matches are determined by comparing strings).
  3863.           Duplicate keys are not allowed.
  3864.           This class is specifically designed for managing a B-Tree on a
  3865.           disk file.  Keys, defined to be arrays of chars, and values,
  3866.           defined by the typedef storedValue, are stored and retrieved
  3867.           from a B-Tree.  The values can represent offsets to locations
  3868.           in a file where objects are stored.  Keys are defined to be a
  3869.           maximum of 16 characters long.  This may be varied by changing
  3870.           KEY_SIZE in the header file disktree.h and recompiling.
  3871.           This class is meant to be used with class RWFileManager which
  3872.           manages the allocation and deallocation of space on a disk
  3873.           file.
  3874.  
  3875.  
  3876.  
  3877.  
  3878.  
  3879.  
  3880.  
  3881.  
  3882.  
  3883.  
  3884.  
  3885.  
  3886. Rogue Wave      Tools.h++ Class Library                  233
  3887.  
  3888.  
  3889.  
  3890.  
  3891.  
  3892.  
  3893.  
  3894.  
  3895.                       CLASS REFERENCE
  3896.  
  3897. Public    RWBTreeOnDisk(RWFileManager& f)
  3898. construct Construct a B-Tree on disk.  The RWFileManager f must be
  3899. or        constructed first.  If the RWFileManager is constructed from an
  3900.           old file, the RWBTreeOnDisk is constructed with the old B-Tree;
  3901.           if the RWFileManager is constructed from a new file,  an empty B-
  3902.           Tree is initialized on the file.
  3903.  
  3904.  
  3905. Public    void applyToKeyAndValue((*ap)(const char*,   storedValue),
  3906. member    void* x);
  3907. functions Visits all items in the collection in order, from smallest to
  3908.           largest, calling the user-provided function pointed to by ap with
  3909.           the key and value as arguments.  This function should have
  3910.           prototype:
  3911.              void yourApplyFunction(const char* ky, storedValue val,
  3912.              void* x);
  3913.  
  3914. The  function yourApplyFunction cannot change the key.  The value x
  3915. can be anything and is passed through from the call to
  3916. applyToKeyAndValue(). Possible exceptions that can occur are
  3917. TOOL_READERR and TOOL_SEEKERR.
  3918.  
  3919.    void             clear();
  3920. Removes all items from the collection.  Possible exceptions that can
  3921. occur are TOOL_READERR, TOOL_WRITEERR and TOOL_SEEKERR.
  3922.  
  3923.    unsigned         entries();
  3924. Returns the number of items in the RWBTreeOnDisk.  Possible
  3925. exceptions that can occur are TOOL_READERR and TOOL_SEEKERR.
  3926.  
  3927.    storedValue      find(const char* ky);
  3928. Returns the value for the key that compares equal to the string
  3929. pointed to by ky.  Returns NIL if no key is found.  Possible
  3930. exceptions that can occur are TOOL_READERR and TOOL_SEEKERR.
  3931.  
  3932.    int              height();
  3933. Returns the height of the RWBTreeOnDisk.  Possible exceptions that
  3934. can occur are TOOL_READERR and TOOL_SEEKERR.
  3935.  
  3936.    int              insertKeyAndValue(const char* ky, storedValue v);
  3937. Adds a key-value pair to the B-Tree.  Returns TRUE for successful
  3938. insertion, FALSE otherwise.  Possible exceptions that can occur are
  3939. TOOL_READERR, TOOL_WRITEERR and TOOL_SEEKERR.
  3940.  
  3941.  
  3942. Rogue Wave      Tools.h++ Class Library                  234
  3943.  
  3944.  
  3945.  
  3946.  
  3947.  
  3948.  
  3949.  
  3950.  
  3951.                       CLASS REFERENCE
  3952.  
  3953.    RWBoolean        isEmpty() const;
  3954. Returns TRUE if the RWBTreeOnDisk is empty, otherwise FALSE.
  3955.  
  3956.    void             remove(const char* ky);
  3957. Removes the key and value pair that has a key which matches ky.
  3958. Possible exceptions that can occur are TOOL_READERR, TOOL_WRITEERR
  3959. and TOOL_SEEKERR.
  3960.  
  3961.  
  3962.  
  3963.  
  3964.  
  3965.  
  3966.  
  3967.  
  3968.  
  3969.  
  3970.  
  3971.  
  3972.  
  3973.  
  3974.  
  3975.  
  3976.  
  3977.  
  3978.  
  3979.  
  3980.  
  3981.  
  3982.  
  3983.  
  3984.  
  3985.  
  3986.  
  3987.  
  3988.  
  3989.  
  3990.  
  3991.  
  3992.  
  3993.  
  3994.  
  3995.  
  3996.  
  3997.  
  3998. Rogue Wave      Tools.h++ Class Library                  235
  3999.  
  4000.  
  4001.  
  4002.  
  4003.  
  4004.  
  4005.  
  4006.  
  4007.                       CLASS REFERENCE
  4008.  
  4009.  
  4010.  
  4011. class RWCacheManager
  4012.  
  4013.  
  4014.  
  4015.  
  4016.  
  4017. Synopsis  #include <cacheman.h>
  4018.  
  4019.           RWFile f("file.dat");       // Construct a file
  4020.           RWCacheManager(&f, 100);    // Cache 100 byte blocks to file.dat
  4021.  
  4022.  
  4023.  
  4024. Descripti Class RWCacheManager caches fixed length blocks to and from an
  4025. on        associated RWFile.  The block size can be of any length and is set
  4026.           at construction time.  The number of cached blocks can also be set
  4027.           at construction time.
  4028.           Writes to the cache may be deferred.  Use member function
  4029.           flush() to have any pending writes performed.
  4030.  
  4031.  
  4032.  
  4033.  
  4034.  
  4035.  
  4036.  
  4037.  
  4038.  
  4039.  
  4040.  
  4041.  
  4042.  
  4043.  
  4044.  
  4045.  
  4046.  
  4047.  
  4048.  
  4049.  
  4050.  
  4051.  
  4052.  
  4053.  
  4054. Rogue Wave      Tools.h++ Class Library                  236
  4055.  
  4056.  
  4057.  
  4058.  
  4059.  
  4060.  
  4061.  
  4062.  
  4063.                       CLASS REFERENCE
  4064.  
  4065. Example   #include <cacheman.h>
  4066.  
  4067.           #include <rwfile.h>
  4068.  
  4069.           struct Record {
  4070.  
  4071.             int i;
  4072.  
  4073.             float f;
  4074.  
  4075.             char str[15];
  4076.  
  4077.           };
  4078.  
  4079.           main()
  4080.  
  4081.           {
  4082.             RWoffset loc;
  4083.  
  4084.             RWFile file("file.dat"); // Construct a file
  4085.  
  4086.             // Construct a cache, using 20 slots for struct Record:
  4087.             RWCacheManager cache(&file, sizeof(Record), 20);
  4088.  
  4089.             Record r;
  4090.             // ...
  4091.             cache.write(loc, &r);
  4092.  
  4093.             // ...
  4094.             cache.read(loc, &r);
  4095.           }
  4096.  
  4097.  
  4098.  
  4099. Public    RWCacheManager(RWFile* file, unsigned blocksz, unsigned mxblks = 10);
  4100. construct Construct a cache for the RWFile pointed to by file.  The length
  4101. or        of the fixed-size blocks is given by blocksz.  The number of
  4102.           cached blocks is given by mxblks.
  4103.  
  4104.    ~RWCacheManager();
  4105. Performs any pending I/O operations (i.e., calls flush()) and
  4106. deallocates any allocated memory.
  4107.  
  4108.  
  4109.  
  4110. Rogue Wave      Tools.h++ Class Library                  237
  4111.  
  4112.  
  4113.  
  4114.  
  4115.  
  4116.  
  4117.  
  4118.  
  4119.                       CLASS REFERENCE
  4120.  
  4121.  
  4122. Public    RWBoolean           flush();
  4123. member    Perform any pending I/O operations.  Returns TRUE if the flush
  4124. functions was successful, FALSE otherwise.
  4125.  
  4126.    void             invalidate();
  4127. Invalidate the cache.
  4128.  
  4129.    RWBoolean        read(RWoffset locn, void* dat);
  4130. Return the data located at offset locn of the associated RWFile.
  4131. The data is put in the buffer pointed to by dat.  This buffer must
  4132. be at least as long as the block size specified when the cache was
  4133. constructed.  Returns TRUE if the operation was successful,
  4134. otherwise FALSE.
  4135.  
  4136.    RWBoolean        write(RWoffset locn, void* dat);
  4137. Write the block of data pointed to by dat to the offset locn of the
  4138. associated RWFile.  The number of bytes written is given by the
  4139. block size specified when the cache was constructed.  The actual
  4140. write to disk may be deferred.  Use member function flush() to
  4141. perform any pending output.  Returns TRUE if the operation was
  4142. successful, otherwise FALSE.
  4143.  
  4144.  
  4145.  
  4146.  
  4147.  
  4148.  
  4149.  
  4150.  
  4151.  
  4152.  
  4153.  
  4154.  
  4155.  
  4156.  
  4157.  
  4158.  
  4159.  
  4160.  
  4161.  
  4162.  
  4163.  
  4164.  
  4165.  
  4166. Rogue Wave      Tools.h++ Class Library                  238
  4167.  
  4168.  
  4169.  
  4170.  
  4171.  
  4172.  
  4173.  
  4174.  
  4175.                       CLASS REFERENCE
  4176.  
  4177.  
  4178.  
  4179. class RWCLIPstreambuf                            RWCLIPstreambuf
  4180.                                                         |
  4181.                                                     streambuf
  4182.  
  4183.  
  4184.  
  4185. Synopsis  #include <winstrea.h>
  4186.           #include <iostream.h>
  4187.  
  4188.           iostream str( new RWCLIPstreambuf() );
  4189.  
  4190.  
  4191.  
  4192. Descripti Class RWCLIPstreambuf is a specialized streambuf that gets and puts
  4193. on        sequences of characters to Microsoft Windows_ global memory.  It can
  4194.           be used to exchange data through Windows clipboard facility.
  4195.           The class has two modes of operation: dynamic and static.  In
  4196.           dynamic mode, memory is allocated and reallocated on an as-
  4197.           needed basis.  If too many characters are inserted into the
  4198.           internal buffer for its present size, then it will be resized
  4199.           and old characters copied over into any new memory as
  4200.           necessary.  This is transparent to the user.  It is expected
  4201.           that this mode would be used primarily for "insertions", i.e.,
  4202.           clipboard "cuts" and "copies".  In static mode, the buffer
  4203.           streambuf is constructed from a specific piece of memory.  No
  4204.           reallocations will be done.  It is expected that this mode
  4205.           would be used primarily for "extractions", i.e., clipboard
  4206.           "pastes".
  4207.           In dynamic mode, the RWCLIPstreambuf "owns" any allocated
  4208.           memory until the member function str() is called, which
  4209.           "freezes" the buffer and returns an unlocked Windows handle to
  4210.           it.  The effect of any further insertions is undefined.  Until
  4211.           str() has been called, it is the responsibility of the
  4212.           RWCLIPstreambuf destructor to free any allocated memory.
  4213.           After the call to str(), it becomes the user's responsibility.
  4214.           In static mode, the user has the responsibility for freeing
  4215.           the memory handle.  However, because the constructor locks and
  4216.           dereferences the handle, you should not free the memory until
  4217.           either the destructor or str() has been called, either of
  4218.           which will unlock the handle.
  4219.  
  4220.  
  4221.  
  4222. Rogue Wave      Tools.h++ Class Library                  239
  4223.  
  4224.  
  4225.  
  4226.  
  4227.  
  4228.  
  4229.  
  4230.  
  4231.                       CLASS REFERENCE
  4232.  
  4233. Example   #include <winstrea.h>
  4234.           #include <iostream.h>
  4235.           #include <windows.h>
  4236.  
  4237.           postToClipboard(HWND owner)
  4238.  
  4239.           {
  4240.  
  4241.             RWCLIPstreambuf* buf = new RWCLIPstreambuf();
  4242.  
  4243.             ostream ostr(buf);
  4244.  
  4245.             double d = 12.34;
  4246.  
  4247.             ostr << "Some text to be exchanged through the clipboard.\n";
  4248.             ostr << "Might as well add a double: " << d << endl;
  4249.             ostr.put(\0);            // Include the terminating null
  4250.  
  4251.             // Lock the streambuf, get its handle:
  4252.  
  4253.             HANDLE hMem = buf->str();
  4254.  
  4255.             OpenClipboard(owner);
  4256.             EmptyClipboard();
  4257.  
  4258.             SetClipboardData(CF_TEXT, hMem);
  4259.             CloseClipboard();
  4260.  
  4261.           }
  4262.  
  4263.           The owner of the clipboard is passed in as parameter "owner".
  4264.           A conventional ostream is created, except that it uses an
  4265.           RWCLIPstreambuf as its associated streambuf.  It can be used
  4266.           much like any other ostream, such as cout, except that
  4267.           characters will be inserted into Windows global memory.
  4268.           Some text and a double is inserted into the ostream.  Finally,
  4269.           member function str() is called which returns a Windows
  4270.           HANDLE.  The clipboard is then opened, emptied, and the new
  4271.           data put into it with format CF_TEXT which, in this case, is
  4272.           appropriate because a simple ostream was used to format the
  4273.           output.  If a specializing virtual streams class such as
  4274.           RWbostream or RWpostream had been used instead, the format is
  4275.           not so simple.  In this case, the user might want to register
  4276.           his or her own format, using the Windows function
  4277.  
  4278. Rogue Wave      Tools.h++ Class Library                  240
  4279.  
  4280.  
  4281.  
  4282.  
  4283.  
  4284.  
  4285.  
  4286.  
  4287.                       CLASS REFERENCE
  4288.  
  4289.           RegisterClipboardFormat().
  4290.  
  4291. Public    RWCLIPstreambuf();
  4292. construct Constructs an empty RWCLIPstreambuf in dynamic mode.  The results
  4293. ors       can be used anywhere any other streambuf can be used.  Memory to
  4294.           accomodate new characters will be allocated as needed.
  4295.  
  4296.    RWCLIPstreambuf(HANDLE hMem)
  4297. Constructs a RWCLIPstreambuf in static mode, using the memory block
  4298. with global handle hMem.  The effect of gets and puts beyond the
  4299. size of this memory block is unspecified.
  4300.  
  4301.    ~RWCLIPstreambuf()
  4302. If member function str() has not been called, the destructor unlocks
  4303. the handle and, if in dynamic mode, also frees it.
  4304.  
  4305.  
  4306. Public    Because RWCLIPstreambuf inherits from streambuf, any of the latter's
  4307. member    member functions can be used.  Furthermore, RWCLIPstreambuf has been
  4308. functions designed to be analogous to strstreambuf.  However, note that the
  4309.           return type of str() is a HANDLE, rather than a char*.
  4310.    HANDLE           str();
  4311.  
  4312. Returns an (unlocked) HANDLE to the global memory being used.  The
  4313. RWCLIPstreambuf should now be regarded as "frozen": the effect of
  4314. inserting any more characters is undefined.  If the RWCLIPstreambuf
  4315. was constructed in dynamic mode, and nothing has been inserted, then
  4316. the returned HANDLE may be NULL.  If it was constructed in static
  4317. mode, then the returned handle will be the handle used to construct
  4318. the RWCLIPstreambuf.
  4319.  
  4320.  
  4321.  
  4322.  
  4323.  
  4324.  
  4325.  
  4326.  
  4327.  
  4328.  
  4329.  
  4330.  
  4331.  
  4332.  
  4333.  
  4334. Rogue Wave      Tools.h++ Class Library                  241
  4335.  
  4336.  
  4337.  
  4338.  
  4339.  
  4340.  
  4341.  
  4342.  
  4343.                       CLASS REFERENCE
  4344.  
  4345.  
  4346.  
  4347. class RWCollectable
  4348.  
  4349.  
  4350.  
  4351.  
  4352.  
  4353. Synopsis  typedef RWCollectable Object; // Smalltalk typedef
  4354.  
  4355.           #include <collect.h>
  4356.  
  4357.  
  4358.  
  4359. Descripti Class RWCollectable is an abstract base class for collectable
  4360. on        objects.  This class contains virtual functions for identifying,
  4361.           hashing, comparing, storing and retrieving collectable objects.
  4362.           While these virtual functions have simple default definitions,
  4363.           objects that inherit this base class will typically redefine one or
  4364.           more of them.
  4365.  
  4366. Virtual   virtual             ~RWCollectable()
  4367. functions All functions that inherit class RWCollectable have virtual
  4368.           destructors.  This allows them to be deleted by such member
  4369.           functions as removeAndDestroy() without knowing their type.
  4370.  
  4371.    virtual unsigned binaryStoreSize() const;
  4372. Should return the number of bytes necessary to store the object
  4373. using RWCollectable::saveOn(RWFile&).  The default definition,
  4374. provided by RWCollectable, returns zero.
  4375.  
  4376.    virtual int      compareTo(const RWCollectable*) const;
  4377. The function  compareTo() is necessary to sort the items in a
  4378. collection.  If p1 and p2 are pointers to RWCollectable objects, the
  4379. statement
  4380.  
  4381.                     p1->compareTo(p2);
  4382.  
  4383. should return:
  4384.  
  4385.                    0     if *p1 "is equal to" *p2;
  4386.                   >0     if *p1 is "larger" than *p2;
  4387.                   <0     if *p1 is "smaller" than *p2.
  4388.  
  4389.  
  4390. Rogue Wave      Tools.h++ Class Library                  242
  4391.  
  4392.  
  4393.  
  4394.  
  4395.  
  4396.  
  4397.  
  4398.  
  4399.                       CLASS REFERENCE
  4400.  
  4401. Note that the meaning of "is equal to", "larger" and "smaller" is
  4402. left to the user.  The default condition provided by the base class
  4403. is based on the addresses, i.e.,
  4404.  
  4405.                     return this == p2 ? 0 : (this > p2 ? 1 : -1);
  4406.  
  4407. and is probably not very useful.
  4408.  
  4409.    virtual         unsigned   hash() const;
  4410. Returns a hash value.  This function is necessary for collection
  4411. classes that use hash table look-up.  The default condition provided
  4412. by the base class is based on the addresses, i.e.,
  4413.                     return (unsigned)this;
  4414.  
  4415.    virtual         ClassID    isA() const;
  4416. Returns a class identification number (typedef'd to be an unsigned
  4417. short).  The default definition returns __RWCOLLECTABLE.
  4418. Identification numbers greater than or equal to 0x8000 (hex) are
  4419. reserved for Rogue Wave objects.  User defined classes should define
  4420. isA() to return a number between 0 and 0x7FFF.
  4421.  
  4422.    virtual         RWBoolean  isEqual(const RWCollectable* t) const;
  4423. Returns TRUE if collectable object "matches" object at address t.
  4424. The default matching condition is:
  4425.                     return this == t;
  4426.  
  4427. i.e., both objects have the same address (a test for identity).  The
  4428. definition may be redefined in any consistent way.
  4429.  
  4430.    virtual         RWCollectable*   newSpecies() const;
  4431. Allocates a new object off the heap of the same type as self and
  4432. returns a pointer to it.  You are responsible for deleting the
  4433. object when done with it.
  4434.  
  4435.    virtual         void       restoreGuts(RWFile&);
  4436. Read an object's state from a binary file, using class RWFile.
  4437.  
  4438.    virtual         RWvistream&      restoreGuts(RWvistream&);
  4439. Read an object's state from an input stream.
  4440.  
  4441.    virtual         void       saveGuts(RWFile&) const;
  4442. Write an object's state to a binary file, using class RWFile.
  4443.  
  4444.  
  4445.  
  4446. Rogue Wave      Tools.h++ Class Library                  243
  4447.  
  4448.  
  4449.  
  4450.  
  4451.  
  4452.  
  4453.  
  4454.  
  4455.                       CLASS REFERENCE
  4456.  
  4457.    virtual void     saveGuts(RWvostream&) const;
  4458. Write an object's state to an output stream.
  4459.  
  4460.    static        RWCollectable*    restoreFrom(RWvistream&);
  4461.    static        RWCollectable*    restoreFrom(RWFile&);
  4462. Looks at the next object on the input stream or RWFile and either
  4463. creates a new object of the proper type off the heap and returns a
  4464. pointer to it, or else returns a pointer to a previously read
  4465. instance.  Note that this is a static function -- it should not be
  4466. called for any particular instance of an object.  See Section 15.9
  4467. for a complete description.  If a corrupted stream is encountered
  4468. then an exception will occur with error TOOL_STREAM.  If a corrupted
  4469. RWFile is encountered, then an exception will occur with error
  4470. TOOL_MAGIC (i.e., bad magic number).
  4471.  
  4472.  
  4473.  
  4474.  
  4475.  
  4476.  
  4477.  
  4478.  
  4479.  
  4480.  
  4481.  
  4482.  
  4483.  
  4484.  
  4485.  
  4486.  
  4487.  
  4488.  
  4489.  
  4490.  
  4491.  
  4492.  
  4493.  
  4494.  
  4495.  
  4496.  
  4497.  
  4498.  
  4499.  
  4500.  
  4501.  
  4502. Rogue Wave      Tools.h++ Class Library                  244
  4503.  
  4504.  
  4505.  
  4506.  
  4507.  
  4508.  
  4509.  
  4510.  
  4511.                       CLASS REFERENCE
  4512.  
  4513.    void             saveOn(RWvostream&) const;
  4514.    void             saveOn(RWFile&) const;
  4515. Stores an object while maintaining its morphology.  See Section 15.9
  4516. for a complete description.
  4517.  
  4518.    unsigned         shallowStoreSize() const;
  4519. Returns the number of bytes required to store the object using
  4520. RWCollectable::saveOn(RWFile&).  Recursively calls
  4521. binaryStoreSize(), taking duplicate objects into account.
  4522.  
  4523.  
  4524.  
  4525.  
  4526.  
  4527.  
  4528.  
  4529.  
  4530.  
  4531.  
  4532.  
  4533.  
  4534.  
  4535.  
  4536.  
  4537.  
  4538.  
  4539.  
  4540.  
  4541.  
  4542.  
  4543.  
  4544.  
  4545.  
  4546.  
  4547.  
  4548.  
  4549.  
  4550.  
  4551.  
  4552.  
  4553.  
  4554.  
  4555.  
  4556.  
  4557.  
  4558. Rogue Wave      Tools.h++ Class Library                  245
  4559.  
  4560.  
  4561.  
  4562.  
  4563.  
  4564.  
  4565.  
  4566.  
  4567.                       CLASS REFERENCE
  4568.  
  4569.  
  4570.  
  4571. class RWCollectableDate                          RWCollectableDate
  4572.                                                      |         |
  4573.                                                RWCollectable  RWDate
  4574.  
  4575.  
  4576.  
  4577. Synopsis  typedef RWCollectableDate Date;    // Smalltalk typedef
  4578.  
  4579.           #include <colldate.h>
  4580.  
  4581.           RWCollectableDate  d;
  4582.  
  4583.  
  4584.  
  4585. Descripti Collectable Dates.  Inherits classes RWDate and RWCollectable.
  4586. on        This class is useful when dates are used as keys in the
  4587.           "dictionary" collection classes, or if dates are stored and
  4588.           retrieved as RWCollectables.  The virtual functions of the base
  4589.           class RWCollectable have been redefined.
  4590.  
  4591. Public    RWCollectableDate();
  4592. construct Calls the appropriate base class constructor.  See
  4593. ors       RWDate::RWDate().
  4594.  
  4595.    RWCollectableDate(dayTy d, yearTy y);
  4596. Calls the appropriate base class constructor. See
  4597. RWDate::RWDate(dayTy d, yearTy y).
  4598.  
  4599.    RWCollectableDate(dayTy d, const char* month, yearTy y);
  4600. Calls the appropriate base class constructor.
  4601.  
  4602. See RWDate::RWDate(dayTy d, const char* month, yearTy y).
  4603.  
  4604.    RWCollectableDate(dayTy d, monthTy month, yearTy y);
  4605. Calls the appropriate base class constructor.
  4606.  
  4607. See RWDate::RWDate(dayTy d, monthTy month, yearTy y).
  4608.  
  4609.    RWCollectableDate(istream& s);
  4610. Calls the appropriate base class constructor.  See
  4611. RWDate::RWDate(istream& s).
  4612.  
  4613.  
  4614. Rogue Wave      Tools.h++ Class Library                  246
  4615.  
  4616.  
  4617.  
  4618.  
  4619.  
  4620.  
  4621.  
  4622.  
  4623.                       CLASS REFERENCE
  4624.  
  4625.    RWCollectableDate(const RWTime& t);
  4626. Calls the appropriate base class constructor.  See
  4627. RWDate::RWDate(const RWTime&).
  4628.  
  4629.  
  4630. Public    virtual unsigned    binaryStoreSize() const;
  4631. member    Redefined from class RWCollectable.  Returns the number of
  4632. functions bytes necessary to store the object using
  4633.           RWCollectable::saveOn(RWFile&).
  4634.  
  4635.    virtual int      compareTo(const RWCollectable* c) const;
  4636. Redefined from class RWCollectable.  Returns _1, 0 or 1, depending
  4637. on whether self's date is less than, equal to, or greater than the
  4638. RWCollectableDate pointed to by c.
  4639.  
  4640.    virtual unsigned hash() const;
  4641. Redefined from class RWCollectable.  Returns the
  4642. RWCollectableDates's value as an unsigned, to be used as a hash
  4643. value:
  4644.  
  4645.    virtual ClassID  isA() const;
  4646. Redefined from class RWCollectable to return __RWCOLLECTABLEDATE.
  4647.  
  4648.    virtual RWBoolean      isEqual(const RWCollectable* t) const;
  4649. Redefined from class RWCollectable.  Returns TRUE if self has the
  4650. same date as the RWCollectableDate at address t.
  4651.  
  4652.    virtual void     restoreGuts(RWvistream&);
  4653.    virtual void     restoreGuts(RWFile&);
  4654.    virtual void     saveGuts(RWvostream&) const;
  4655.    virtual void     saveGuts(RWFile&) const;
  4656. Redefined from class RWCollectable.  Generally, these functions call
  4657. the appropriate member function in RWDate.  For example,
  4658. restoreGuts(RWvistream&) calls RWDate::restoreFrom(RWvistream&).
  4659.  
  4660.  
  4661.  
  4662.  
  4663.  
  4664.  
  4665.  
  4666.  
  4667.  
  4668.  
  4669.  
  4670. Rogue Wave      Tools.h++ Class Library                  247
  4671.  
  4672.  
  4673.  
  4674.  
  4675.  
  4676.  
  4677.  
  4678.  
  4679.                       CLASS REFERENCE
  4680.  
  4681.  
  4682.  
  4683. class RWCollectableInt                          RWCollectableInt
  4684.                                              |        |
  4685.                                         RWCollectableRWInteger
  4686.  
  4687.  
  4688.  
  4689. Synopsis  typedef RWCollectableInt Integer;  // Smalltalk typedef
  4690.  
  4691.           #include <collint.h>
  4692.  
  4693.           RWCollectableInt  i;
  4694.  
  4695.  
  4696.  
  4697. Descripti Collectable integers.  Inherits classes RWInteger and RWCollectable.
  4698. on        This class is useful when integers are used as keys in the
  4699.           "dictionary" collection classes, or if integers are stored and
  4700.           retrieved as RWCollectables.  The virtual functions of the base class
  4701.           RWCollectable have been redefined.
  4702.  
  4703. Public    RWCollectableInt();
  4704. construct Calls the appropriate base class constructor.  See
  4705. ors       RWInteger::RWInteger().
  4706.  
  4707.    RWCollectableInt(int i);
  4708. Calls the appropriate base class constructor.  See
  4709. RWInteger::RWInteger(int).
  4710.  
  4711.  
  4712. Public    virtual unsigned    binaryStoreSize() const;
  4713. member    Redefined from class RWCollectable.  Returns the number of bytes
  4714. functions necessary to store the object using
  4715.           RWCollectable::saveOn(RWFile&).
  4716.  
  4717.    virtual int      compareTo(const RWCollectable* c) const;
  4718. Redefined from class RWCollectable.  Returns the difference between
  4719. self and the RWCollectableInt pointed to by c.
  4720.  
  4721.    virtual unsigned hash() const;
  4722. Redefined from class RWCollectable.  Returns the RWCollectableInt's
  4723. value as an unsigned, to be used as a hash value.
  4724.  
  4725.  
  4726. Rogue Wave      Tools.h++ Class Library                  248
  4727.  
  4728.  
  4729.  
  4730.  
  4731.  
  4732.  
  4733.  
  4734.  
  4735.                       CLASS REFERENCE
  4736.  
  4737.    virtual ClassID  isA() const;
  4738. Redefined from class RWCollectable to return __RWCOLLECTABLEINT.
  4739.  
  4740.    virtual RWBoolean      isEqual(const RWCollectable* c) const;
  4741. Redefined from class RWCollectable.  Returns TRUE if self has the
  4742. same value as the RWCollectableInt at address c.
  4743.  
  4744.  
  4745.  
  4746.  
  4747.  
  4748.  
  4749.  
  4750.  
  4751.  
  4752.  
  4753.  
  4754.  
  4755.  
  4756.  
  4757.  
  4758.  
  4759.  
  4760.  
  4761.  
  4762.  
  4763.  
  4764.  
  4765.  
  4766.  
  4767.  
  4768.  
  4769.  
  4770.  
  4771.  
  4772.  
  4773.  
  4774.  
  4775.  
  4776.  
  4777.  
  4778.  
  4779.  
  4780.  
  4781.  
  4782. Rogue Wave      Tools.h++ Class Library                  249
  4783.  
  4784.  
  4785.  
  4786.  
  4787.  
  4788.  
  4789.  
  4790.  
  4791.                       CLASS REFERENCE
  4792.  
  4793.    virtual void     restoreGuts(RWvistream&);
  4794.    virtual void     restoreGuts(RWFile&);
  4795.    virtual void     saveGuts(RWvostream&) const;
  4796.    virtual void     saveGuts(RWFile&) const;
  4797. Redefined from class RWCollectable.  Generally, these functions call
  4798. the appropriate member function in RWInteger.  For example,
  4799. restoreGuts(RWvistream&) calls RWInteger::restoreFrom(RWvistream&).
  4800.  
  4801.  
  4802.  
  4803.  
  4804.  
  4805.  
  4806.  
  4807.  
  4808.  
  4809.  
  4810.  
  4811.  
  4812.  
  4813.  
  4814.  
  4815.  
  4816.  
  4817.  
  4818.  
  4819.  
  4820.  
  4821.  
  4822.  
  4823.  
  4824.  
  4825.  
  4826.  
  4827.  
  4828.  
  4829.  
  4830.  
  4831.  
  4832.  
  4833.  
  4834.  
  4835.  
  4836.  
  4837.  
  4838. Rogue Wave      Tools.h++ Class Library                  250
  4839.  
  4840.  
  4841.  
  4842.  
  4843.  
  4844.  
  4845.  
  4846.  
  4847.                       CLASS REFERENCE
  4848.  
  4849.  
  4850.  
  4851. class RWCollectableString                         RWCollectableString
  4852.                                                         |    |
  4853.                                                 RWCollectable  RWString
  4854.  
  4855.  
  4856.  
  4857. Synopsis  typedef RWCollectableString String;     // Smalltalk typedef
  4858.  
  4859.           #include <collstr.h>
  4860.  
  4861.           RWCollectableString  c;
  4862.  
  4863.  
  4864.  
  4865. Descripti Collectable strings.  This class is useful when strings are stored
  4866. on        and retrieved as RWCollectables, or when they are used as keys in
  4867.           the "dictionary" collection classes.  Class RWCollectableString
  4868.           inherits classes RWString and RWCollectable.  The virtual functions
  4869.           of the base class RWCollectable have been redefined.
  4870.  
  4871. Public    RWCollectableString();
  4872. construct Construct a RWCollectableString with zero characters.
  4873. ors
  4874.  
  4875.    RWCollectableString(const RWString& s);
  4876. Construct a RWCollectableString from the RWString s.  The created
  4877. string will reference s's data.
  4878.  
  4879.    RWCollectableString(const char* c);
  4880. Conversion from character string.  The created string will copy the
  4881. data pointed to by c.
  4882.  
  4883.    RWCollectableString(const RWSubString&);
  4884. Conversion from sub-string.  The created string will copy the
  4885. substring's data.
  4886.  
  4887.    RWCollectableString(unsigned N, char c = ' ');
  4888. Construct a RWCollectableString with N characters (default blanks).
  4889.  
  4890.  
  4891.  
  4892.  
  4893.  
  4894. Rogue Wave      Tools.h++ Class Library                  251
  4895.  
  4896.  
  4897.  
  4898.  
  4899.  
  4900.  
  4901.  
  4902.  
  4903.                       CLASS REFERENCE
  4904.  
  4905.  
  4906. Public    virtual unsigned    binaryStoreSize() const;
  4907. member    Redefined from class RWCollectable.  Returns the number of bytes
  4908. functions necessary to store the object using
  4909.           RWCollectable::saveOn(RWFile&).
  4910.  
  4911.    virtual int      compareTo(const RWCollectable* c) const;
  4912. Redefined from class RWCollectable.  Calls RWString::compareTo()
  4913. with c as the argument and returns the results.  This compares
  4914. strings lexicographically.  Case insensitive comparisons can be made
  4915. by calling RWString::setCaseSensitive() first.
  4916.  
  4917.    virtual unsigned hash() const;
  4918. Redefined from class RWCollectable.  Calls RWString::hash() and
  4919. returns the results.  Case insensitive hashings can be made by
  4920. calling RWString::setCaseSensitive() first.
  4921.  
  4922.    virtual ClassID  isA() const;
  4923. Redefined from class RWCollectable to return __RWCOLLECTABLESTRING.
  4924.  
  4925.    virtual RWBoolean      isEqual(const RWCollectable* c) const;
  4926. Redefined from class RWCollectable.  Calls RWString::operator==()
  4927. (i.e., the equivalence operator) with c as the argument and returns
  4928. the results.  Case insensitive matches can be made by calling
  4929. RWString::setCaseSensitive() first.
  4930.  
  4931.    virtual void     restoreGuts(RWvistream&);
  4932.    virtual void     restoreGuts(RWFile&);
  4933.    virtual void     saveGuts(RWvostream&) const;
  4934.    virtual void     saveGuts(RWFile&) const;
  4935. Redefined from class RWCollectable.  Generally, these functions call
  4936. the appropriate member function in RWString.  For example,
  4937. restoreGuts(RWvistream&) calls RWString::restoreFrom(RWvistream&).
  4938.  
  4939.  
  4940.  
  4941.  
  4942.  
  4943.  
  4944.  
  4945.  
  4946.  
  4947.  
  4948.  
  4949.  
  4950. Rogue Wave      Tools.h++ Class Library                  252
  4951.  
  4952.  
  4953.  
  4954.  
  4955.  
  4956.  
  4957.  
  4958.  
  4959.                       CLASS REFERENCE
  4960.  
  4961.  
  4962.  
  4963. class RWCollectableTime                           RWCollectableTime
  4964.                                              |         |
  4965.                                         RW CollectableRWTime
  4966.  
  4967.  
  4968.  
  4969. Synopsis  typedef RWCollectableTime Time;    // Smalltalk typedef
  4970.  
  4971.           #include <colltime.h>
  4972.  
  4973.           RWCollectableTime  t;
  4974.  
  4975.  
  4976.  
  4977. Descripti Inherits classes RWTime and RWCollectable.  This class is useful when
  4978. on        times are used as keys in the "dictionary" collection classes, or if
  4979.           times are stored and retrieved as RWCollectables.  The virtual
  4980.           functions of the base class RWCollectable have been redefined.
  4981.  
  4982. Public    RWCollectableTime();
  4983. construct Calls the appropriate base class constructor.  See
  4984. ors       RWTime::RWTime().
  4985.  
  4986.    RWCollectableTime(clockTy s);
  4987. Calls the appropriate base class constructor.  See
  4988. RWTime::RWTime(clockTy).
  4989.  
  4990.    RWCollectableTime(hourTy h, minuteTy m, secondTy s = 0);
  4991. Calls the appropriate base class constructor.
  4992. See RWTime::RWTime(hourTy, minuteTy, secondTy).
  4993.  
  4994.    RWCollectableTime (const RWDate&, hourTy h = 0,
  4995.                       minuteTy m = 0, secondTy s = 0);
  4996. Calls the appropriate base class constructor.
  4997. See RWTime::RWTime(const RWDate&, hourTy, minuteTy, secondTy).
  4998.  
  4999.  
  5000.  
  5001.  
  5002.  
  5003.  
  5004.  
  5005.  
  5006. Rogue Wave      Tools.h++ Class Library                  253
  5007.  
  5008.  
  5009.  
  5010.  
  5011.  
  5012.  
  5013.  
  5014.  
  5015.                       CLASS REFERENCE
  5016.  
  5017.  
  5018. Public    virtual unsigned    binaryStoreSize() const;
  5019. member    Redefined from class RWCollectable.  Returns the number of bytes
  5020. functions necessary to store the object using RWCollectable::saveOn(RWFile&).
  5021.  
  5022.    virtual int      compareTo(const RWCollectable* c) const;
  5023. Redefined from class RWCollectable.  Calls RWTime::compareTo() with
  5024. c as the argument and returns the results.
  5025.  
  5026.    virtual unsigned hash() const;
  5027. Redefined from class RWCollectable.  Calls RWTime::hash() and
  5028. returns the results.
  5029.  
  5030.    virtual ClassID  isA() const;
  5031. Redefined from class RWCollectable to return __RWCOLLECTABLETIME.
  5032.  
  5033.    virtual RWBoolean      isEqual(const RWCollectable* c) const;
  5034. Redefined from class RWCollectable.  Calls RWTime::operator==()
  5035. (i.e., the equivalence operator) with c as the argument and returns
  5036. the results.
  5037.  
  5038.    virtual void     restoreGuts(RWvistream&);
  5039.    virtual void     restoreGuts(RWFile&);
  5040.    virtual void     saveGuts(RWvostream&) const;
  5041.    virtual void     saveGuts(RWFile&) const;
  5042. Redefined from class RWCollectable.  Generally, these functions call
  5043. the appropriate member function in RWTime.  For example,
  5044. restoreGuts(RWvistream&) calls RWTime::restoreFrom(RWvistream&).
  5045.  
  5046.  
  5047.  
  5048.  
  5049.  
  5050.  
  5051.  
  5052.  
  5053.  
  5054.  
  5055.  
  5056.  
  5057.  
  5058.  
  5059.  
  5060.  
  5061.  
  5062. Rogue Wave      Tools.h++ Class Library                  254
  5063.  
  5064.  
  5065.  
  5066.  
  5067.  
  5068.  
  5069.  
  5070.  
  5071.                       CLASS REFERENCE
  5072.  
  5073.  
  5074.  
  5075. class RWCollection                                   RWCollection
  5076.                                                            |
  5077.                                                      RWCollectable
  5078.  
  5079.  
  5080.  
  5081. Synopsis  #include <colclass.h>
  5082.  
  5083.           typedef RWCollection Collection;   // Smalltalk typedef
  5084.  
  5085.  
  5086.  
  5087. Descripti Class RWCollection is an abstract base class for the Smalltalk_-like
  5088. on        collection classes.  The class contains virtual functions for
  5089.           inserting and retrieving pointers to RWCollectable objects into the
  5090.           collection classes.  Virtual functions are also provided for storing
  5091.           and reading the collections to files and streams.  Collections that
  5092.           inherit this base class will typically redefine one or more of these
  5093.           functions.
  5094.           In the documentation below, pure virtual functions are
  5095.           indicated by "= 0" in their declaration.  These functions must
  5096.           be defined in derived classes.  For these functions the
  5097.           description is intended to be generic -- all inheriting
  5098.           collection classes generally follow the described pattern.
  5099.           Exceptions are noted in the documentation for the particular
  5100.           class.
  5101.           For many other functions, a suitable definition is provided by
  5102.           RWCollection and a deriving class may not need to redefine the
  5103.           function.  Examples are contains() or restoreGuts().
  5104.  
  5105.  
  5106.  
  5107.  
  5108.  
  5109.  
  5110.  
  5111.  
  5112.  
  5113.  
  5114.  
  5115.  
  5116.  
  5117.  
  5118. Rogue Wave      Tools.h++ Class Library                  255
  5119.  
  5120.  
  5121.  
  5122.  
  5123.  
  5124.  
  5125.  
  5126.  
  5127.                       CLASS REFERENCE
  5128.  
  5129. Public    void                operator+=(const RWCollection&);
  5130. member    void                operator-=(const RWCollection&);
  5131. operators Adds or removes, respectively, each item in the argument from
  5132.           self.
  5133.  
  5134.  
  5135. Public    virtual             ~RWCollection();
  5136. member    Null definition (does nothing).
  5137. functions
  5138.           virtual void        apply(applyCollectable ap, void*) = 0;
  5139.           This function applies the user-supplied function pointed to
  5140.           by ap to each member of the collection.  This function
  5141.           should have prototype
  5142.                     void yourApplyFunction(RWCollectable* c, void*);
  5143.  
  5144. The function yourApplyFunction() can perform any operation on the
  5145. item at address c that does not change the ordering of the
  5146. collection.  Client data may be passed to this function by using the
  5147. second argument.
  5148.  
  5149.  
  5150.  
  5151.  
  5152.  
  5153.  
  5154.  
  5155.  
  5156.  
  5157.  
  5158.  
  5159.  
  5160.  
  5161.  
  5162.  
  5163.  
  5164.  
  5165.  
  5166.  
  5167.  
  5168.  
  5169.  
  5170.  
  5171.  
  5172.  
  5173.  
  5174. Rogue Wave      Tools.h++ Class Library                  256
  5175.  
  5176.  
  5177.  
  5178.  
  5179.  
  5180.  
  5181.  
  5182.  
  5183.                       CLASS REFERENCE
  5184.  
  5185.    RWBag            asBag() const;
  5186.    RWSet            asSet() const;
  5187.    RWOrdered        asOrderedCollection() const;
  5188.    RWBinaryTree     asSortedCollection() const
  5189. Allows any collection to be converted to a RWBag, RWSet, RWOrdered,
  5190. or a RWBinaryTree.
  5191.  
  5192.    virtual unsigned binaryStoreSize() const;
  5193. Redefined from class RWCollectable.  Returns the total number of
  5194. bytes required to store the collection to a binary file using a
  5195. false deep copy (i.e., the instance variables of the collection are
  5196. copies of the original instance variables, but this copying is not
  5197. done recursively).  For each object in the collection, this function
  5198. calls shallowStoreSize(), adding up the results.  Use
  5199. shallowStoreSize() if you want the number of bytes required to store
  5200. the collection using saveOn() -- the more usual case.
  5201.  
  5202.    virtual void     clear() = 0;
  5203. Removes all objects from the collection.  Does not delete the
  5204. objects themselves.
  5205.  
  5206.    virtual void     clearAndDestroy();
  5207. Removes all objects from the collection and deletes them.  Takes
  5208. into account duplicate objects within a collection and only deletes
  5209. them once.  However, it does not take into account objects shared
  5210. between different collections.  Either do not use this function if
  5211. you will be sharing objects between separate collections, or put all
  5212. collections that could be sharing objects into one single "super-
  5213. collection" and call clearAndDestroy() from that.
  5214.  
  5215.    virtual int      compareTo(const RWCollectable* a) const;
  5216. Inherited from class RWCollectable.
  5217.  
  5218.    virtual RWBoolean      contains(const RWCollectable* target) const;
  5219. Returns TRUE if the collection contains an item where the virtual
  5220. function find() returns non-nil.
  5221.  
  5222.    virtual unsigned entries() const = 0;
  5223. Returns the total number of items in the collection.
  5224.  
  5225.    virtual       RWCollectable*   find(const RWCollectable* target) const = 0;
  5226. Returns a pointer to the first item in the collection which
  5227. "matches" the object pointed to by target or nil if no item was
  5228. found.  For most collections, an item "matches" the target if either
  5229.  
  5230. Rogue Wave      Tools.h++ Class Library                  257
  5231.  
  5232.  
  5233.  
  5234.  
  5235.  
  5236.  
  5237.  
  5238.  
  5239.                       CLASS REFERENCE
  5240.  
  5241. isEqual() or compareTo() find equivalence, whichever is appropriate
  5242. for the actual collection type.  However, the "identity collections"
  5243. (i.e., RWIdentitySet and RWIdentityDictionary) look for an item with
  5244. the same address (i.e., "is identical to").
  5245.  
  5246.    virtual unsigned hash() const;
  5247. Inherited from class RWCollectable.
  5248.  
  5249.    virtual         RWCollectable*   insert(RWCollectable* e) = 0;
  5250. Adds an item to the collection and returns a pointer to it.  If the
  5251. item is already in the collection, some items return the old
  5252. instance, others return nil.
  5253.  
  5254.    virtual ClassID  isA() const;
  5255. Redefined from class RWCollectable to return __RWCOLLECTION.
  5256.  
  5257.    virtual RWBoolean      isEmpty() const = 0;
  5258. Returns TRUE if the collection is empty, otherwise returns FALSE.
  5259.  
  5260.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  5261. Inherited from class RWCollectable.
  5262.  
  5263.    virtual unsigned occurrencesOf(const RWCollectable* t) const = 0;
  5264. Returns the number of items in the collection which are "matches" t.
  5265. See function find() for a definition of matches.
  5266.  
  5267.    virtual void     restoreGuts(RWFile&);
  5268. Redefined to call RWCollectable::restoreFrom(RWFile&), followed by
  5269. insert(RWCollectable*) for each item in the collection.
  5270.  
  5271.    virtual void     restoreGuts(RWvistream&);
  5272. Redefined to call RWCollectable::restoreFrom(RWvistream&), followed
  5273. by insert(RWCollectable*) for each item in the collection.
  5274.  
  5275.    RWCollectable*   remove(const RWCollectable* target) = 0;
  5276. Removes and returns a pointer to the first item in the collection
  5277. which "matches" the object pointed to by target.  Returns nil if no
  5278. object was found.  Does not delete the object.
  5279.  
  5280.    virtual void     removeAndDestroy(const RWCollectable* target);
  5281. Removes and deletes the first item in the collection which "matches"
  5282. the object pointed to by target.
  5283.  
  5284.  
  5285.  
  5286. Rogue Wave      Tools.h++ Class Library                  258
  5287.  
  5288.  
  5289.  
  5290.  
  5291.  
  5292.  
  5293.  
  5294.  
  5295.                       CLASS REFERENCE
  5296.  
  5297.    RWCollection*    select(testCollectable tst, void x) const;
  5298. Evaluates the function pointed to by tst for each item in the
  5299. collection.  It inserts those items for which the function returns
  5300. TRUE into a new collection allocated off the heap of the same type
  5301. as self and returns a pointer to this new collection.  Because the
  5302. new collection is allocated off the heap, you are responsible for
  5303. deleting it when done.
  5304.  
  5305.    static        RWCollectable*    restoreFrom(RWvistream&);
  5306.    static        RWCollectable*    restoreFrom(RWFile&);
  5307.    void             saveOn(RWvostream&) const;
  5308.    void             saveOn(RWFile&) const;
  5309. Inherited from class RWCollectable.
  5310.  
  5311.    virtual void     saveGuts(RWFile&);
  5312. Redefined to call RWCollectable::saveOn(RWFile&) for each item in
  5313. the collection.
  5314.  
  5315.    virtual void     saveGuts(RWvostream&);
  5316. Redefined to call RWCollectable::saveOn(RWvostream&) for each item
  5317. in the collection.
  5318.  
  5319.  
  5320.  
  5321.  
  5322.  
  5323.  
  5324.  
  5325.  
  5326.  
  5327.  
  5328.  
  5329.  
  5330.  
  5331.  
  5332.  
  5333.  
  5334.  
  5335.  
  5336.  
  5337.  
  5338.  
  5339.  
  5340.  
  5341.  
  5342. Rogue Wave      Tools.h++ Class Library                  259
  5343.  
  5344.  
  5345.  
  5346.  
  5347.  
  5348.  
  5349.  
  5350.  
  5351.                       CLASS REFERENCE
  5352.  
  5353.  
  5354.  
  5355. class RWDate
  5356.  
  5357.  
  5358.  
  5359.  
  5360.  
  5361. Synopsis  typedef unsigned           dayTy;
  5362.           typedef unsigned           monthTy;
  5363.           typedef unsigned           yearTy;
  5364.           typedef unsigned long      julTy;
  5365.  
  5366.           #include <rwdate.h>
  5367.           RWDate a;           // Construct today's date
  5368.  
  5369.  
  5370.  
  5371. Descripti Class RWDate represents a date, stored as a Julian day number.
  5372. on        The member function isValid() can be used to determine whether
  5373.           an RWDate is a valid date.  For example, isValid() would
  5374.           return FALSE for the date 29  February 1991 because 1991 is
  5375.           not a leap year.
  5376.           RWDate's can be converted to and from RWTime's.
  5377.  
  5378. Example   #include <rwdate.h>
  5379.           #include <rstream.h>
  5380.  
  5381.           main()
  5382.           {
  5383.             // Today's date
  5384.             RWDate d;
  5385.  
  5386.             // Last Sunday's date:
  5387.             RWDate lastSunday = d.previous("Sunday");
  5388.  
  5389.             cout << d << NL << lastSunday << NL;
  5390.           }
  5391.  
  5392.           Program output:
  5393.             March 22, 1991
  5394.             March 17, 1991
  5395.  
  5396.  
  5397.  
  5398. Rogue Wave      Tools.h++ Class Library                  260
  5399.  
  5400.  
  5401.  
  5402.  
  5403.  
  5404.  
  5405.  
  5406.  
  5407.                       CLASS REFERENCE
  5408.  
  5409. Public    RWDate();
  5410. construct Constructs an RWDate with the current date.
  5411. ors
  5412.  
  5413.    RWDate(dayTy d, yearTy y);
  5414. Constructs an RWDate with a given day of the year and a given year.
  5415. The member function isValid() can be used to test whether the
  5416. results are a valid date.
  5417.  
  5418.    RWDate(dayTy h, const char* month, yearTy y);
  5419. Constructs an RWDate with the given day of the month, month and
  5420. year.
  5421.  
  5422. Days should be 1-31, months may be specified as (for example):
  5423. January, JAN, or Jan, and the year may be specified as (for example)
  5424. 1990, or 90.  The member function isValid() can be used to test
  5425. whether the results are a valid date.
  5426.  
  5427.    RWDate(dayTy h, monthTy month, yearTy y);
  5428. Constructs an RWDate with the given day of the month, month and
  5429. year.  Days should be 1-31, months should be 1_12, and the year may
  5430. be specified as (for example) 1990, or 90.  The member function
  5431. isValid() can be used to test whether the results are a valid date.
  5432.  
  5433.    RWDate(istream& s);
  5434. Constructs an RWDate by reading information from an input stream.
  5435. The date may be any of the following forms:
  5436.  
  5437.                    dd-mmm-      mm/dd/yy       mmm dd,
  5438.                       yy                          yy
  5439.  
  5440.             e.     10-MAR-       3/10/86      March 10,
  5441.             g:        86                         1986
  5442.  
  5443. Any non-alphanumeric character may be used as a delimiter.  The
  5444. member function isValid() can be used to test whether the results
  5445. are a valid date.
  5446.  
  5447.    RWDate(const RWTime& t);
  5448. Constructs an RWDate from an RWTime.  The member function isValid()
  5449. can be used to test whether the results are a valid date.
  5450.  
  5451.  
  5452.  
  5453.  
  5454. Rogue Wave      Tools.h++ Class Library                  261
  5455.  
  5456.  
  5457.  
  5458.  
  5459.  
  5460.  
  5461.  
  5462.  
  5463.                       CLASS REFERENCE
  5464.  
  5465.  
  5466. Public    RWBoolean           operator<(const RWDate& t) const;
  5467. member    Returns TRUE if RWDate is less than t.
  5468. operators
  5469.           RWBoolean           operator<=(const RWDate& t) const;
  5470.           Returns TRUE if RWDate is less than or equal to t.
  5471.  
  5472.    RWBoolean        operator>(const RWDate& t) const;
  5473. Returns TRUE if self is greater than t.
  5474.  
  5475.    RWBoolean        operator>=(const RWDate& t) const;
  5476. Returns TRUE if self is greater than or equal to t.
  5477.  
  5478.    RWBoolean        operator==(const RWDate& t) const;
  5479. Returns TRUE if self is equal to t.
  5480.  
  5481.    RWBoolean        operator!=(const RWDate& t) const;
  5482. Returns TRUE if self is not equal to t.
  5483.  
  5484.    void             operator++();
  5485. Add 1 day to self.
  5486.  
  5487.    void             operator--();
  5488. Subtract 1 day from self.
  5489.  
  5490.    void             operator+=(int s);
  5491. Add s days to self.
  5492.  
  5493.    void             operator-=(int s);
  5494. Substract s days from self.
  5495.  
  5496.    julTy            operator-(const RWDate& t) const;
  5497. Returns the number of days between self and t.
  5498.  
  5499.  
  5500. Public    RWBoolean   between(const RWDate& a, const RWDate& b) const;
  5501. member    Returns TRUE if this RWDate is between a and b
  5502. functions
  5503.           unsigned   binaryStoreSize() const;
  5504.           Returns the number of bytes necessary to store the object using
  5505.           RWDate::saveOn(RWFile&).
  5506.  
  5507.    int              compareTo(const RWDate* d) const;
  5508. Compares self to the RWDate pointed to by d and returns:
  5509.  
  5510. Rogue Wave      Tools.h++ Class Library                  262
  5511.  
  5512.  
  5513.  
  5514.  
  5515.  
  5516.  
  5517.  
  5518.  
  5519.                       CLASS REFERENCE
  5520.  
  5521.                 0   if
  5522.                     self
  5523.                     ==
  5524.                     *d;
  5525.                 1   if
  5526.                     self
  5527.                     > *d;
  5528.                _1   if
  5529.                     self
  5530.                     < *d.
  5531.  
  5532.    dayTy            day() const;
  5533. Returns the day of the year (1-365) for this date.
  5534.  
  5535.    dayTy            dayOfMonth() const;
  5536. Returns the day of the month (1-31) for this date.
  5537.  
  5538.    dayTy            firstDayOfMonth() const;
  5539. Returns the day of the year (1-336) corresponding to the first day
  5540. of this RWDate's month and year.
  5541.  
  5542.    dayTy            firstDayOfMonth(monthTy m) const;
  5543. Returns the day of the year (1-336) corresponding to the first day
  5544. of the month m (1_12) in this RWDate's year.
  5545.  
  5546.    unsigned         hash() const;
  5547. Returns a suitable hashing value.
  5548.  
  5549.    RWBoolean        isValid() const;
  5550. Returns TRUE if this is a valid date, FALSE otherwise.
  5551.  
  5552.    RWBoolean        leap() const;
  5553. Returns TRUE if the year of this RWDate is a leap year.
  5554.  
  5555.    RWDate           max(const RWDate& t) const;
  5556. Returns the greater of self or t.  For example, if t1 and t2 are
  5557. RWDates,
  5558.  
  5559.                     cout << t1.max(t2);
  5560.  
  5561. will print the greater date.
  5562.  
  5563.    RWDate           min(const RWDate& t) const;
  5564. Returns the lesser of self or t.
  5565.  
  5566. Rogue Wave      Tools.h++ Class Library                  263
  5567.  
  5568.  
  5569.  
  5570.  
  5571.  
  5572.  
  5573.  
  5574.  
  5575.                       CLASS REFERENCE
  5576.  
  5577.    monthTy          month() const;
  5578. Returns the month (1_12) for this date.
  5579.  
  5580.    const char*      nameOfDay() const;
  5581. Returns the name of the day (e.g., Tuesday) for this date.
  5582.  
  5583.    const char*      nameOfMonth() const;
  5584. Returns the name of the month (e.g., March) for this date.
  5585.  
  5586.    RWDate           previous(const char* dayName) const;
  5587. Returns the date of the previous dayName (for example, the date of
  5588. the previous Monday).
  5589.  
  5590.    void             restoreFrom(RWvistream& s);
  5591. Reads an RWDate that was stored with saveOn(RWvostream&) from the
  5592. input stream s.
  5593.  
  5594.    void             restoreFrom(RWFile& s);
  5595. Reads an RWDate that was stored with storeOn() from the RWFile s.
  5596.  
  5597.    void             saveOn(RWvostream& s) const;
  5598. Stores an RWDate on the output stream s.
  5599.  
  5600.    void             saveOn(RWFile& s) const;
  5601. Stores an RWDate in binary format on RWFile s.
  5602.  
  5603.    dayTy            weekDay() const;
  5604. Returns the number of the day of the week for this date, where
  5605. Monday = 1, ..., Sunday = 7.
  5606.  
  5607.    yearTy           year() const;
  5608. Returns the year of this date.
  5609.  
  5610.  
  5611. Static    static const char*  dayName(dayTy weekDayNumber);
  5612. member    Returns a string name for the weekday number.  Returns nil if
  5613. functions weekDayNumber is outside the range of 1 through 7.
  5614.  
  5615.    static dayTy     dayOfWeek(const char* dayName);
  5616. Returns the number of the day of the week corresponding to the given
  5617. dayName.  "Monday" = 1, "Sunday" = 7.  Returns 0 if no match found.
  5618.  
  5619.    static dayTy     daysInYear(yearTy);
  5620. Returns the number of days in a given year.
  5621.  
  5622. Rogue Wave      Tools.h++ Class Library                  264
  5623.  
  5624.  
  5625.  
  5626.  
  5627.  
  5628.  
  5629.  
  5630.  
  5631.                       CLASS REFERENCE
  5632.  
  5633.    static RWBoolean dayWithinMonth(monthTy, dayTy, yearTy);
  5634. Returns TRUE if a day (1-31) is within a given month in a given
  5635. year.
  5636.  
  5637.    static monthTy   indexOfMonth(const char* monthName);
  5638. Returns the number of the month (1_12) corresponding to the given
  5639. monthName.  Returns 0 for no match.
  5640.  
  5641.    static julTy     jday(monthTy, dayTy, yearTy);
  5642. Returns the Julian day corresponding to the given month (1_12), day
  5643. (1-31) and year.  Returns zero (0) if the date is invalid.
  5644.  
  5645.    static RWBoolean leapYear(yearTy);
  5646. Returns TRUE if a given year is a leap year.
  5647.  
  5648.    static const char*     monthName(monthTy monthNumber);
  5649. Returns a string name for the month number.  Returns nil if
  5650. monthNumber is outside the range 1 through 12.
  5651.  
  5652.    static void      setPrintOption(howToPrint h = normal);
  5653. Sets the formatting style for printing of dates with the <<
  5654. operator.  "RWDate::howToPrint" is an enumeration, where:
  5655.  
  5656.           howToPrint          Example
  5657.           normal              January 12, 1989
  5658.           terse               1-Jan-89
  5659.           numbers             1/12/89
  5660.           europeanNumbers     12/1/89
  5661.           european            12 January 1989
  5662.  
  5663.  
  5664.  
  5665. Related   RWDate              operator+(const RWDate& t, int s);
  5666. global    RWDate              operator+(int s, const RWDate& t);
  5667. operators Returns the date s days in the future.
  5668.  
  5669.    RWDate           operator-(const RWDate& t, int s);
  5670. Returns the date s days in the past.
  5671.  
  5672.    ostream&         operator<<(ostream& s, const RWDate& t);
  5673. Outputs the date t on ostream s, in the form specified by
  5674. setPrintOption().
  5675.  
  5676.  
  5677.  
  5678. Rogue Wave      Tools.h++ Class Library                  265
  5679.  
  5680.  
  5681.  
  5682.  
  5683.  
  5684.  
  5685.  
  5686.  
  5687.                       CLASS REFERENCE
  5688.  
  5689.    istream&         operator>>(istream& s, RWDate& t);
  5690. Reads t from istream s.  The date may be any of the following forms:
  5691.  
  5692.                   dd-mmm-      mm/dd/yy      mmm dd, yy
  5693.                     yy
  5694.  
  5695.           e.g     10-MAR-       3/10/86       March 10,
  5696.            :        86                          1986
  5697.  
  5698. Any non-alphanumeric character may be used as a delimiter.  If an
  5699. invalid date is encountered, the stream state will be set to "bad".
  5700. The function RWDate::isValid() can also be used to test whether the
  5701. results are a valid date.
  5702.  
  5703.  
  5704.  
  5705.  
  5706.  
  5707.  
  5708.  
  5709.  
  5710.  
  5711.  
  5712.  
  5713.  
  5714.  
  5715.  
  5716.  
  5717.  
  5718.  
  5719.  
  5720.  
  5721.  
  5722.  
  5723.  
  5724.  
  5725.  
  5726.  
  5727.  
  5728.  
  5729.  
  5730.  
  5731.  
  5732.  
  5733.  
  5734. Rogue Wave      Tools.h++ Class Library                  266
  5735.  
  5736.  
  5737.  
  5738.  
  5739.  
  5740.  
  5741.  
  5742.  
  5743.                       CLASS REFERENCE
  5744.  
  5745.  
  5746.  
  5747. class RWDDEstreambuf                                RWDDEstreambuf
  5748.                                                            |
  5749.                                                        streambuf
  5750.  
  5751.  
  5752.  
  5753. Synopsis  #include <winstrea.h>
  5754.           #include <iostream.h>
  5755.  
  5756.           iostream str( new RWDDEstreambuf() );
  5757.  
  5758.  
  5759.  
  5760. Descripti Class RWDDEstreambuf is a specialized streambuf that gets and
  5761. on        puts sequences of characters to Microsoft Windows_ global memory
  5762.           that has been allocated with the GMEM_DDESHARE flag.  It can be
  5763.           used to exchange data through the Windows Dynamic Data Exchange
  5764.           (DDE) facility.
  5765.           The class has two modes of operation: dynamic and static.  In
  5766.           dynamic mode, memory is allocated and reallocated on an as-
  5767.           needed basis.  If too many characters are inserted into the
  5768.           internal buffer for its present size, then it will be resized
  5769.           and old characters copied over into any new memory as
  5770.           necessary.  This is transparent to the user.  It is expected
  5771.           that this mode would be used primarily by the DDE server.  In
  5772.           static mode, the buffer streambuf is constructed from a
  5773.           specific piece of memory.  No reallocations will be done.  It
  5774.           is expected that this mode would be used primarily by the DDE
  5775.           client.
  5776.           In dynamic mode, the RWDDEstreambuf "owns" any allocated
  5777.           memory until the member function str() is called, which
  5778.           "freezes" the buffer and returns an unlocked Windows handle to
  5779.           it.  The effect of any further insertions is undefined.  Until
  5780.           str() has been called, it is the responsibility of the
  5781.           RWDDEstreambuf destructor to free any allocated memory.  After
  5782.           the call to str(), it becomes the user's responsibility.
  5783.           In static mode, the user has the responsibility for freeing
  5784.           the memory handle.  However, because the constructor locks and
  5785.           dereferences the handle, you should not free the memory until
  5786.           either the destructor or str() has been called, either of
  5787.           which will unlock the handle.
  5788.           Note that although the user may have the "responsibility" for
  5789.  
  5790. Rogue Wave      Tools.h++ Class Library                  267
  5791.  
  5792.  
  5793.  
  5794.  
  5795.  
  5796.  
  5797.  
  5798.  
  5799.                       CLASS REFERENCE
  5800.  
  5801.           freeing the memory, whether it is the client or the server
  5802.           that actually does the call to GlobalFree() will depend on the
  5803.           DDE "release" flag.
  5804.  
  5805.  
  5806.  
  5807.  
  5808.  
  5809.  
  5810.  
  5811.  
  5812.  
  5813.  
  5814.  
  5815.  
  5816.  
  5817.  
  5818.  
  5819.  
  5820.  
  5821.  
  5822.  
  5823.  
  5824.  
  5825.  
  5826.  
  5827.  
  5828.  
  5829.  
  5830.  
  5831.  
  5832.  
  5833.  
  5834.  
  5835.  
  5836.  
  5837.  
  5838.  
  5839.  
  5840.  
  5841.  
  5842.  
  5843.  
  5844.  
  5845.  
  5846. Rogue Wave      Tools.h++ Class Library                  268
  5847.  
  5848.  
  5849.  
  5850.  
  5851.  
  5852.  
  5853.  
  5854.  
  5855.                       CLASS REFERENCE
  5856.  
  5857. Example   This is an example of how the class might be used by a DDE server.
  5858.           #include <winstrea.h>
  5859.           #include <iostream.h>
  5860.           #include <windows.h>
  5861.           #include <dde.h>
  5862.  
  5863.           BOOL
  5864.           postToDDE(HWND hwndServer, HWND hwndClient)
  5865.  
  5866.           {
  5867.  
  5868.             RWDDEstreambuf* buf = new RWDDEstreambuf();
  5869.  
  5870.             ostream ostr(buf);
  5871.  
  5872.             double d = 12.34;
  5873.  
  5874.             ostr << "Some text to be exchanged through the DDE.\n";
  5875.             ostr << "The double you requested is: " << d << endl;
  5876.  
  5877.             ostr.put(\0);            // Include the terminating null
  5878.  
  5879.             // Lock the streambuf, get its handle:
  5880.  
  5881.             HANDLE hMem = buf->str();
  5882.  
  5883.             // Get an identifying atom:
  5884.             ATOM aItem = GlobalAddAtom("YourData");
  5885.  
  5886.             if(!PostMessage(hwndClient, WM_DDE_DATA, hwndServer,
  5887.                                      MAKELONG(hMem, aItem)){
  5888.               // Whoops!  The message post failed, perhaps because
  5889.               // the client terminated.  Now we are responsible
  5890.  
  5891.               // for deallocating the memory:
  5892.  
  5893.               if( hMem != NULL )
  5894.  
  5895.                 GlobalFree(hMem);
  5896.  
  5897.               GlobalDeleteAtom(aItem);
  5898.  
  5899.               return FALSE;
  5900.  
  5901.             }
  5902. Rogue Wave      Tools.h++ Class Library                  269
  5903.             return TRUE;
  5904.  
  5905.           }
  5906.  
  5907.  
  5908.  
  5909.  
  5910.  
  5911.  
  5912.  
  5913.  
  5914.                       CLASS REFERENCE
  5915.  
  5916.           The handle of the DDE server is passed in as parameter
  5917.           hwndServer, the handle of the client as parameter hwndClient.
  5918.           An ostream is created, using an RWDDEstreambuf as its
  5919.           associated streambuf.  The results can be used much like any
  5920.           other ostream, such as cout, except that characters will be
  5921.           inserted into Windows global memory, from where they can be
  5922.           transferred through the DDE.  Note that we have used all
  5923.           default parameters for the constructor.  These should be
  5924.           studied below as they have important ramifications on how
  5925.           memory allocations are handled through the DDE.  In
  5926.           particular, parameter fRelease, if TRUE, states that the
  5927.           client will be responsible for deallocating the memory when
  5928.           done.  The defaults also specify fAckReq TRUE, meaning that
  5929.           the client will acknowledge the message receipt: you must be
  5930.           prepared to receive it.
  5931.           Some text and a double is inserted into the ostream.  Member
  5932.           function str() is then called which unlocks and returns a
  5933.           Windows HANDLE.  Once we have called str(), we are responsible
  5934.           for this memory and must either free it when done, or pass on
  5935.           that responsibility to someone else.  In this case, it will be
  5936.           passed on to the client.
  5937.           An atom is then constructed to identify the data.  The DDE
  5938.           data, along with its identifying atom, is then posted.  If the
  5939.           post fails, then we have been unable to foister our
  5940.           responsbility for the global memory onto someone else and will
  5941.           have to free it (along with the atom) ourselves.
  5942.  
  5943. Public    RWDDEstreambuf(     WORD cfFormat = CF_TEXT,
  5944. construct                     BOOL fResponse = TRUE
  5945. ors                           BOOL fAckReq = TRUE
  5946.                               BOOL fRelease = TRUE);
  5947.           Constructs an empty RWDDEstreambuf in dynamic mode.  The
  5948.           results can be used anywhere any other streambuf can be
  5949.           used.  Memory to accomodate new characters will be
  5950.           allocated as needed.
  5951.  
  5952. The four parameters are as defined by the Windows Reference, Volume
  5953. 2 (in particular, see the section DDE Message Directory).  Parameter
  5954. cfFormat specifies the format of the data being inserted into the
  5955. streambuf.  These formats are the same as used by
  5956. SetClipboardData().  If a specializing virtual streams class such as
  5957. RWbostream or RWpostream is used to perform the actual character
  5958. insertions instead of a simple ostream, the format may not be so
  5959. simple.  In this case, the user might want to register his or her
  5960.  
  5961. Rogue Wave      Tools.h++ Class Library                  270
  5962.  
  5963.  
  5964.  
  5965.  
  5966.  
  5967.  
  5968.  
  5969.  
  5970.                       CLASS REFERENCE
  5971.  
  5972. own format, using the Windows function RegisterClipboardFormat().
  5973.  
  5974. For the meaning of the other three parameters see below, and/or the
  5975. Windows reference manuals.
  5976.  
  5977.    RWDDEstreambuf(HANDLE hMem)
  5978. Constructs a RWDDEstreambuf in static mode, using the memory block
  5979. with global handle hMem.  The effect of gets and puts beyond the
  5980. size of this block is unspecified.  The format of the DDE transfer,
  5981. and the specifics of DDE acknowledgments, memory allocations, etc.,
  5982. can be obtained by using the member functions defined below.
  5983.  
  5984.    ~RWDDEstreambuf()
  5985. If member function str() has not been called, the destructor unlocks
  5986. the handle and, if in dynamic mode, also frees it.
  5987.  
  5988.  
  5989. Public    Because RWDDEstreambuf inherits from streambuf, any of the latter's
  5990. member    member functions can be used.  Furthermore, RWDDEstreambuf has been
  5991. functions designed to be analogous to strstreambuf.  However, note that the
  5992.           return type of str() is a HANDLE, rather than a char*.
  5993.    BOOL             ackReq() const;
  5994. Returns whether this DDE exchange requests an acknowledgement.  See
  5995. the Windows Reference, Volume 2, for more information.
  5996.  
  5997.    WORD             format() const;
  5998. Returns the format of this DDE exchange (e.g., CF_TEXT for text
  5999. exchange, etc.).  See the Windows Reference, Volume 2, for more
  6000. information.
  6001.  
  6002.    BOOL             release() const;
  6003. Returns TRUE if the client is responsible for the release of of the
  6004. memory returned by str().  See the Windows Reference, Volume 2, for
  6005. more information.
  6006.  
  6007.    BOOL             response() const;
  6008. Returns TRUE if this data is in response to a WM_DDE_REQUEST
  6009. message.  Otherwise, it is in response to a WM_DDE_ADVISE message.
  6010. See the Windows Reference, Volume 2, for more information.
  6011.  
  6012.    HANDLE           str();
  6013. Returns an (unlocked) HANDLE to the global memory being used.  The
  6014. RWDDEstreambuf should now be regarded as "frozen": the effect of
  6015. inserting any more characters is undefined.  If the RWDDEstreambuf
  6016.  
  6017. Rogue Wave      Tools.h++ Class Library                  271
  6018.  
  6019.  
  6020.  
  6021.  
  6022.  
  6023.  
  6024.  
  6025.  
  6026.                       CLASS REFERENCE
  6027.  
  6028. was constructed in dynamic mode, and nothing has been inserted, then
  6029. the returned HANDLE may be NULL.  If it was constructed in static
  6030. mode, then the returned handle will be the handle used to construct
  6031. the RWDDEstreambuf.
  6032.  
  6033.  
  6034.  
  6035.  
  6036.  
  6037.  
  6038.  
  6039.  
  6040.  
  6041.  
  6042.  
  6043.  
  6044.  
  6045.  
  6046.  
  6047.  
  6048.  
  6049.  
  6050.  
  6051.  
  6052.  
  6053.  
  6054.  
  6055.  
  6056.  
  6057.  
  6058.  
  6059.  
  6060.  
  6061.  
  6062.  
  6063.  
  6064.  
  6065.  
  6066.  
  6067.  
  6068.  
  6069.  
  6070.  
  6071.  
  6072.  
  6073. Rogue Wave      Tools.h++ Class Library                  272
  6074.  
  6075.  
  6076.  
  6077.  
  6078.  
  6079.  
  6080.  
  6081.  
  6082.                       CLASS REFERENCE
  6083.  
  6084.  
  6085.  
  6086. class RWDlistCollectables                   RWDlistCollectables
  6087.                                             |          |
  6088.                                         RWSequenceableRWDlist
  6089.                                             |          |
  6090.                                             RWCollection RWSlist
  6091.                                             |
  6092.                                         RWCollectable
  6093.  
  6094. Synopsis  #include <dlistcol.h>
  6095.           RWDlistCollectables a;
  6096.  
  6097.  
  6098.  
  6099. Descripti Class RWDlistCollectables represents a group of ordered items, not
  6100. on        accessible by an external key.  Duplicates are allowed.  The
  6101.           ordering of elements is determined externally, generally by the
  6102.           order of insertion and removal.  An object stored by
  6103.           RWDlistCollectables must inherit abstract base class RWCollectable.
  6104.           Class RWDlistCollectables is implemented as a doubly-linked
  6105.           list, which allows for efficient insertion and removal, as
  6106.           well as for movement in either direction.
  6107.  
  6108. Public    RWDlistCollectables();
  6109. construct Constructs an empty doubly-linked list.
  6110. ors
  6111.  
  6112.    RWDlistCollectables (const RWCollectable* a);
  6113. Constructs a linked-list with a single item a.
  6114.  
  6115.  
  6116.  
  6117.  
  6118.  
  6119.  
  6120.  
  6121.  
  6122.  
  6123.  
  6124.  
  6125.  
  6126.  
  6127.  
  6128.  
  6129. Rogue Wave      Tools.h++ Class Library                  273
  6130.  
  6131.  
  6132.  
  6133.  
  6134.  
  6135.  
  6136.  
  6137.  
  6138.                       CLASS REFERENCE
  6139.  
  6140.  
  6141. Public    RWBoolean    operator==(const RWDlistCollectables& d) const;
  6142. member    Returns TRUE if self and d have the same number of items and if
  6143. operators for every item in self, the corresponding item in the same
  6144.           position in d isEqual to it.
  6145.  
  6146.  
  6147. Public    virtual                Collectable*     append(RWCollectable*);
  6148. member    Redefined from RWSequenceable.  Inserts the item at the end of
  6149. functions the collection and returns it.  Returns nil if the insertion
  6150.           was unsuccesful.
  6151.  
  6152.    virtual void     apply(applyCollectable ap, void*)
  6153. Redefined from class RWCollection to apply the user-supplied
  6154. function pointed to by ap to each member of the collection, in
  6155. order, from first to last.
  6156.  
  6157.    virtual         RWCollectable*&  at(int i);
  6158.    virtual const RWCollectable                       *  at(int i) const;
  6159. Redefined from class RWSequenceable.  Note that for a linked-list,
  6160. these functions must traverse all the links, making them not
  6161. particularly efficient.
  6162.  
  6163.    virtual unsigned binaryStoreSize() const;
  6164. Inherited from class RWCollection.
  6165.  
  6166.    virtual void     clear();
  6167. Redefined from class RWCollection.
  6168.  
  6169.    virtual void     clearAndDestroy();
  6170. Inherited from class RWCollection.
  6171.  
  6172.    virtual int      compareTo(const RWCollectable* a) const;
  6173. Inherited from class RWCollectable.
  6174.  
  6175.    virtual RWBoolean      contains(const RWCollectable* target) const;
  6176. Inherited from class RWCollection.
  6177.  
  6178.    RWBoolean        containsReference(const RWCollectable* e) const;
  6179. Returns true if the list contains an item that is identical to the
  6180. item pointed to by e (that is, that has the address e).
  6181.  
  6182.    virtual         unsigned   entries() const;
  6183. Redefined from class RWCollection.
  6184.  
  6185. Rogue Wave      Tools.h++ Class Library                  274
  6186.  
  6187.  
  6188.  
  6189.  
  6190.  
  6191.  
  6192.  
  6193.  
  6194.                       CLASS REFERENCE
  6195.  
  6196.    virtual         RWCollectable*   find(const RWCollectable* target) const;
  6197. Redefined from class RWCollection.  The first item that isEqual to
  6198. the item pointed to by target is returned, or nil if no item is
  6199. found..
  6200.  
  6201.    RWCollectable*   findReference(const RWCollectable* e) const;
  6202. Returns the first item that is identical to the item pointed to by e
  6203. (that is, that has the address e), or nil if none is found.
  6204.  
  6205.    virtual         RWCollectable*   first() const;
  6206. Redefined from class RWSequenceable.  Returns the item at the
  6207. beginning of the list.
  6208.  
  6209.    RWCollectable*   get();
  6210. Returns and removes the item at the beginning of the list.
  6211.  
  6212.    virtual unsigned hash() const;
  6213. Inherited from class RWCollectable.
  6214.  
  6215.    virtual int      index(const RWCollectable* c) const;
  6216. Redefined from class RWSequenceable.  Returns the index of the first
  6217. item that isEqual to the item pointed to by c.
  6218.  
  6219.    virtual         RWCollectable*   insert(RWCollectable* c);
  6220. Redefined from class RWCollection.  Adds the item to the end of the
  6221. collection and returns it.  Returns nil if the insertion was
  6222. unsuccessful.
  6223.  
  6224.    virtual         RWCollectable*   insertAfter(int i, RWCollectable* c);
  6225. Redefined from class RWSequenceable.  Inserts and returns the object
  6226. pointed to by c after the item at index i.  Returns nil if the
  6227. insertion was unsuccessful.
  6228.  
  6229.    virtual ClassID  isA() const;
  6230. Redefined from class RWCollectable to return __RWDLISTCOLLECTABLES.
  6231.  
  6232.    virtual RWBoolean      isEmpty() const;
  6233. Redefined from class RWCollection.
  6234.  
  6235.    virtual         RWCollectable*   last() const;
  6236. Redefined from class RWSequenceable.  Returns the item at the end of
  6237. the list.
  6238.  
  6239.  
  6240.  
  6241. Rogue Wave      Tools.h++ Class Library                  275
  6242.  
  6243.  
  6244.  
  6245.  
  6246.  
  6247.  
  6248.  
  6249.  
  6250.                       CLASS REFERENCE
  6251.  
  6252.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  6253. Redefined from class RWCollection.  Returns the number of items that
  6254. isEqual to the item pointed to by target.
  6255.  
  6256.    unsigned            occurrencesOfReference  (const RWCollectable* e) const;
  6257. Returns the number of items that are identical to the item pointed
  6258. to by e (that is, that have the address e).
  6259.  
  6260.    virtual         RWCollectable*   prepend(RWCollectable*);
  6261. Redefined from class RWSequenceable.  Adds the item to the beginning
  6262. of the collection and returns it.  Returns nil if the insertion was
  6263. unsuccessful.
  6264.  
  6265.    virtual         RWCollectable*   remove(const RWCollectable* target);
  6266. Redefined from class RWCollection.  Removes and returns the first
  6267. item that isEqual to the item pointed to by target.  Returns nil if
  6268. there is no such item.
  6269.  
  6270.    virtual         void       removeAndDestroy(const RWCollectable* target);
  6271. Inherited from class RWCollection.
  6272.  
  6273.    RWCollectable*   removeReference(const RWCollectable* e);
  6274. Removes and returns the first item that is identical to the item
  6275. pointed to by e (that is, that has the address e).  Returns nil if
  6276. there is no such item.
  6277.  
  6278.    virtual void     restoreGuts(RWvistream&);
  6279.    virtual void     restoreGuts(RWFile&);
  6280.    virtual void     saveGuts(RWvostream&) const;
  6281.    virtual void     saveGuts(RWFile&) const;
  6282. Inherited from class RWCollection.
  6283.  
  6284.  
  6285.  
  6286.  
  6287.  
  6288.  
  6289.  
  6290.  
  6291.  
  6292.  
  6293.  
  6294.  
  6295.  
  6296.  
  6297. Rogue Wave      Tools.h++ Class Library                  276
  6298.  
  6299.  
  6300.  
  6301.  
  6302.  
  6303.  
  6304.  
  6305.  
  6306.                       CLASS REFERENCE
  6307.  
  6308.    static        RWCollectable*    restoreFrom(RWvistream&);
  6309.    static        RWCollectable*    restoreFrom(RWFile&);
  6310.    void             saveOn(RWvostream&) const;
  6311.    void             saveOn(RWFile&) const;
  6312. Inherited from class RWCollectable.
  6313.  
  6314.  
  6315.  
  6316.  
  6317.  
  6318.  
  6319.  
  6320.  
  6321.  
  6322.  
  6323.  
  6324.  
  6325.  
  6326.  
  6327.  
  6328.  
  6329.  
  6330.  
  6331.  
  6332.  
  6333.  
  6334.  
  6335.  
  6336.  
  6337.  
  6338.  
  6339.  
  6340.  
  6341.  
  6342.  
  6343.  
  6344.  
  6345.  
  6346.  
  6347.  
  6348.  
  6349.  
  6350.  
  6351.  
  6352.  
  6353. Rogue Wave      Tools.h++ Class Library                  277
  6354.  
  6355.  
  6356.  
  6357.  
  6358.  
  6359.  
  6360.  
  6361.  
  6362.                       CLASS REFERENCE
  6363.  
  6364.  
  6365.  
  6366. class RWDlistCollectablesIterator        RWDlistCollectablesIterator
  6367.                                               |         |
  6368.                                          RWIteratorRWDlistIterator
  6369.                                                         |
  6370.                                                  RWSlistIterator
  6371.  
  6372. Synopsis  #include <dlistcol.h>
  6373.           RWDlistCollectables d;
  6374.           RWDlistCollectablesIterator it(d);
  6375.  
  6376.  
  6377.  
  6378. Descripti Iterator for class RWDlistCollectables. Traverses the linked-list
  6379. on        from the first (head) to the last (tail) item.  Functions are
  6380.           provided for moving in either direction.
  6381.           #include <dlistcol.h>
  6382.  
  6383.  
  6384.  
  6385.           RWDlistCollectablesIterator (RWDlistCollectables& d);
  6386. Public    Construct a RWDlistCollectablesIterator from a
  6387. construct RWDlistCollectables.  Immediately after construction, the
  6388. or        iterator is positioned at the last link of d.
  6389.  
  6390.  
  6391. Public    virtual                RWCollectable*      operator()();
  6392. member    Redefined from class RWIterator.  Advances the iterator to the
  6393. operators next item and returns it.  Returns nil when the end of the list
  6394.           is reached.
  6395.  
  6396.    void             operator++();
  6397. Advances the iterator one item.  This operator wraps around to the
  6398. start of list.
  6399.  
  6400.    void             operator--();
  6401. Moves the iterator back one item.  This operator wraps around to the
  6402. end of the list.
  6403.  
  6404.    void             operator+=(int n);
  6405. Advances the iterator n items.  This operator wraps around to the
  6406. start of the list.
  6407.  
  6408.  
  6409. Rogue Wave      Tools.h++ Class Library                  278
  6410.  
  6411.  
  6412.  
  6413.  
  6414.  
  6415.  
  6416.  
  6417.  
  6418.                       CLASS REFERENCE
  6419.  
  6420.    void             operator-=(int n);
  6421. Moves the iterator back n items.  This operator wraps around to the
  6422. end of the list.
  6423.  
  6424.  
  6425. Public    RWBoolean           atFirst() const;
  6426. member    Returns TRUE if the iterator is at the beginning of the
  6427. functions list, otherwise FALSE;
  6428.  
  6429.    RWBoolean        atLast() const;
  6430. Returns TRUE if the iterator is at the end of the list, otherwise
  6431. FALSE;
  6432.  
  6433.    virtual         RWCollectable*   findNext(const RWCollectable* target);
  6434. Redefined from class RWIterator.  Moves iterator to the next item
  6435. which isEqual to the item pointed to by target and returns it.  If
  6436. no item is found, returns nil and the position of the iterator will
  6437. be undefined.
  6438.  
  6439.    RWCollectable*   findNextReference(const RWCollectable* e);
  6440. Moves iterator to the next item which is identical to the item
  6441. pointed to by e (that is, that has address e) and returns it.  If no
  6442. item is found, returns nil and the position of the iterator will be
  6443. undefined.
  6444.  
  6445.    RWCollectable*   insertAfterPoint(RWCollectable* a);
  6446. Insert item a after the current cursor position and return the item.
  6447. The cursor's position will be unchanged.
  6448.  
  6449.    virtual         RWCollectable*   key() const;
  6450. Redefined from class RWIterator.  Returns the item at the current
  6451. iterator position.
  6452.  
  6453.    RWCollectable*   remove();
  6454. Removes and returns the item at the current cursor position.
  6455. Afterwards, the iterator will be positioned at the next item in the
  6456. list.
  6457.  
  6458.    RWCollectable*   removeNext(const RWCollectable* target);
  6459. Moves iterator to the next item in the list which isEqual to the
  6460. item pointed to by target, removes it from the list and returns it.
  6461. Afterwards, the iterator will be positioned at the next item in the
  6462. list.  If no item is found, returns nil and the position of the
  6463. iterator will be undefined.
  6464.  
  6465. Rogue Wave      Tools.h++ Class Library                  279
  6466.  
  6467.  
  6468.  
  6469.  
  6470.  
  6471.  
  6472.  
  6473.  
  6474.                       CLASS REFERENCE
  6475.  
  6476.    RWCollectable*   removeNextReference(const RWCollectable* e);
  6477. Moves iterator to the next item in the list which is identical to
  6478. the item pointed to by e (that is, that has address e), removes it
  6479. from the list and returns it.  Afterwards, the iterator will be
  6480. positioned at the next item in the list.  If no item is found,
  6481. returns nil and the position of the iterator will be undefined.
  6482.  
  6483.    virtual void     reset();
  6484. Redefined from class RWIterator.  Resets the iterator.  Afterwards,
  6485. the iterator will be positioned at the last item in the list.
  6486.  
  6487.    void             toFirst();
  6488. Moves the iterator to the beginning of the list.
  6489.  
  6490.    void             toLast();
  6491. Moves the iterator to the end of the list.
  6492.  
  6493.  
  6494.  
  6495.  
  6496.  
  6497.  
  6498.  
  6499.  
  6500.  
  6501.  
  6502.  
  6503.  
  6504.  
  6505.  
  6506.  
  6507.  
  6508.  
  6509.  
  6510.  
  6511.  
  6512.  
  6513.  
  6514.  
  6515.  
  6516.  
  6517.  
  6518.  
  6519.  
  6520.  
  6521. Rogue Wave      Tools.h++ Class Library                  280
  6522.  
  6523.  
  6524.  
  6525.  
  6526.  
  6527.  
  6528.  
  6529.  
  6530.                       CLASS REFERENCE
  6531.  
  6532.  
  6533.  
  6534. class RWErrObject
  6535.  
  6536.  
  6537.  
  6538.  
  6539.  
  6540. Synopsis  #include <rwerr.h>
  6541.  
  6542.           RWErrObject obj(TOOL_INDEX, RWFATAL, __RWORDERED);     // Sample use
  6543.  
  6544.  
  6545.  
  6546. Descripti This class is used by the Rogue Wave exception handling facility.
  6547. on        It is "thrown" by an exception, to be "caught" by the catch phrase.
  6548.           At the time of this writing, no compiler manufacturer has actually
  6549.           implemented exception handling, so the default handler merely
  6550.           prints out the error message and aborts.
  6551.           The default error handler can be changed.  See Section 16.1.4
  6552.           in the Tools.h++ User's Guide for instructions.
  6553.  
  6554.  
  6555.  
  6556.  
  6557.  
  6558.  
  6559.  
  6560.  
  6561.  
  6562.  
  6563.  
  6564.  
  6565.  
  6566.  
  6567.  
  6568.  
  6569.  
  6570.  
  6571.  
  6572.  
  6573.  
  6574.  
  6575.  
  6576.  
  6577. Rogue Wave      Tools.h++ Class Library                  281
  6578.  
  6579.  
  6580.  
  6581.  
  6582.  
  6583.  
  6584.  
  6585.  
  6586.                       CLASS REFERENCE
  6587.  
  6588. Example   This example changes the default error handler:
  6589.           #include <rwerr.h>
  6590.           #include <rstream.h>
  6591.           #include <stdlib.h>
  6592.  
  6593.           void myHandler(RWErrObject eobj, va_list arglist);
  6594.  
  6595.           main()
  6596.           {
  6597.             setRWErrHandler(myHandler);  // Change the default handler
  6598.  
  6599.             // ...
  6600.           }
  6601.  
  6602.           void myHandler(RWErrObject eobj, va_list arglist)
  6603.           {
  6604.             cerr << "Boy, did you screw up!\n";
  6605.             cerr << "You had error number " << eobj.number() << NL;
  6606.             cerr << "Caused by class " << eobj.classID() << NL;
  6607.  
  6608.             exit(eobj.severity());
  6609.           }
  6610.  
  6611.           Of course, this is a pretty simple handler -- it did not check
  6612.           to see whether the routine throwing the exception specified a
  6613.           default disposition.  It just aborts.  Also, it did not make
  6614.           use of any auxilary information in the va_list.
  6615.  
  6616. Public    RWErrObject(RWErrNo n, RWSeverity sever=RWDEFAULT,
  6617. construct              ClassID cl=__GLOBAL);
  6618. or        Construct an error object with error number n and disposition
  6619.           sever.  The class causing the exception is given by cl.
  6620.  
  6621.  
  6622. Public    RWErrNo             number() const;
  6623. member    Returns the error number of this error object.
  6624. functions
  6625.           RWSeverity          severity() const;
  6626.           Returns the disposition of this error.
  6627.  
  6628.    ClassID          classID() const;
  6629. Returns the class that invoked this exception.
  6630.  
  6631.  
  6632.  
  6633. Rogue Wave      Tools.h++ Class Library                  282
  6634.  
  6635.  
  6636.  
  6637.  
  6638.  
  6639.  
  6640.  
  6641.  
  6642.                       CLASS REFERENCE
  6643.  
  6644.  
  6645. Related   RWErrHandler   setRWErrHandler(RWErrHandler routine);
  6646. global    Changes the default error handler to the function pointed to
  6647. functions by routine and returns a pointer to the old error handler.
  6648.           The function pointed to by routine should have prototype:
  6649.  
  6650.                  void yourRoutine(RWErrObject, va_list);
  6651.  
  6652. where "va_list" is a variable argument list, defined in <stdarg.h>.
  6653.  
  6654.  
  6655.  
  6656.  
  6657.  
  6658.  
  6659.  
  6660.  
  6661.  
  6662.  
  6663.  
  6664.  
  6665.  
  6666.  
  6667.  
  6668.  
  6669.  
  6670.  
  6671.  
  6672.  
  6673.  
  6674.  
  6675.  
  6676.  
  6677.  
  6678.  
  6679.  
  6680.  
  6681.  
  6682.  
  6683.  
  6684.  
  6685.  
  6686.  
  6687.  
  6688.  
  6689. Rogue Wave      Tools.h++ Class Library                  283
  6690.  
  6691.  
  6692.  
  6693.  
  6694.  
  6695.  
  6696.  
  6697.  
  6698.                       CLASS REFERENCE
  6699.  
  6700.  
  6701.  
  6702. class RWFactory
  6703.  
  6704.  
  6705.  
  6706.  
  6707.  
  6708. Synopsis  typedef unsigned short  ClassID;
  6709.           typedef RWCollectable*  (*userCreator)();
  6710.           #include <factory.h>
  6711.  
  6712.           RWFactory theFactory;
  6713.  
  6714.  
  6715.  
  6716. Descripti Class RWFactory can create an instance of a RWCollectable object,
  6717. on        given a class ID.  It does this by maintaining a table of class
  6718.           ID's and associated "creator function".  A creator function has
  6719.           prototype:
  6720.                     RWCollectable* aCreatorFunction();
  6721.  
  6722.           This function should create an instance of a particular class.
  6723.           For a given ClassID tag, the appropriate function is selected,
  6724.           invoked and the resultant pointer returned.  Because any
  6725.           object created this way is created off the heap, you are
  6726.           responsible for deleting it when done.
  6727.           There is a one-of-a-kind global RWFactory pointed to by the
  6728.           pointer theFactory.  It is guaranteed to have creator
  6729.           functions in it for all of the classes referenced by your
  6730.           program.  See also Section 15.10.11.
  6731.  
  6732.  
  6733.  
  6734.  
  6735.  
  6736.  
  6737.  
  6738.  
  6739.  
  6740.  
  6741.  
  6742.  
  6743.  
  6744.  
  6745. Rogue Wave      Tools.h++ Class Library                  284
  6746.  
  6747.  
  6748.  
  6749.  
  6750.  
  6751.  
  6752.  
  6753.  
  6754.                       CLASS REFERENCE
  6755.  
  6756. Example   #include <factory.h>
  6757.           #include <rstream.h>
  6758.  
  6759.           main()
  6760.           {
  6761.             // Create a new RWBag off the heap, using the Class ID __RWBAG.
  6762.             // "theFactory" points to the predefined global factory:
  6763.  
  6764.             RWBag* b = (RWBag*)theFactory->create(__RWBAG);
  6765.  
  6766.             b->insert( new CollectableDate );   // Insert today's date
  6767.             // ...
  6768.             b->clearAndDestroy();    // Cleanup: first delete members,
  6769.             delete b;  // then the bag itself
  6770.           }
  6771.  
  6772.  
  6773.  
  6774. Public    RWFactory();
  6775. construct Construct an RWFactory.
  6776. ors
  6777.  
  6778.  
  6779. Public    void   addFunction(userCreator uc, ClassID id);
  6780. member    Adds to the RWFactory the global function pointed to by uc,
  6781. functions which creates an instance of an object with ClassID id.
  6782.  
  6783.    RWCollectable*   create(ClassID id) const;
  6784. Allocates a new instance of the class with ClassID id off the heap
  6785. and returns a pointer to it.  Returns nil if id does not exist.
  6786. Because this instance is allocated off the heap, you are responsible
  6787. for deleting it when done.
  6788.  
  6789.    userCreator      getFunction(ClassID id) const;
  6790. Returns from the RWFactory a pointer to the global function
  6791. associated with ClassID id.  Returns nil if id does not exist.
  6792.  
  6793.    void             removeFunction(ClassID id);
  6794. Removes from the RWFactory the global function associated with
  6795. ClassID id.  If id does not exist in the factory, no action is
  6796. taken.
  6797.  
  6798.  
  6799.  
  6800.  
  6801. Rogue Wave      Tools.h++ Class Library                  285
  6802.  
  6803.  
  6804.  
  6805.  
  6806.  
  6807.  
  6808.  
  6809.  
  6810.                       CLASS REFERENCE
  6811.  
  6812.  
  6813.  
  6814. class RWFile
  6815.  
  6816.  
  6817.  
  6818.  
  6819.  
  6820. Synopsis  #include <rwfile.h>
  6821.  
  6822.           RWFile f("filename");
  6823.  
  6824.  
  6825.  
  6826. Descripti Class RWFile encapsulates standard file operations.  This class
  6827. on        is based on class PFile of the Interviews Class Library (1987,
  6828.           Stanford University).  The member function names begin with
  6829.           upper case letters in order to maintain compatibility with class
  6830.           PFile .
  6831.           Class RWFile has been modified (and modernized) by Rogue Wave
  6832.           to use "const" modifiers, and to port to MS-DOS.
  6833.  
  6834. Public    RWFile(const char* filename);
  6835. construct Construct an RWFile with file filename.  This constructor will
  6836. ors       open a binary file called filename for read/write, creating it
  6837.           if it does not already exist.  If the file cannot be created an
  6838.           exception with error CORE_OPERR will occur.
  6839.  
  6840.    ~RWFile();
  6841. Performs any pending I/O operations and closes the file.
  6842.  
  6843.  
  6844. Public    long                CurrOffset();
  6845. member    Returns the current position, in bytes from the start of the
  6846. functions file, of the file pointer.
  6847.  
  6848.    RWBoolean        Eof();
  6849. Returns TRUE if an end-of-file has been encountered.
  6850.  
  6851.    RWBoolean        Erase();
  6852. Erases the contents but does not close the file.  Returns TRUE if
  6853. the operation was successful.
  6854.  
  6855.  
  6856.  
  6857. Rogue Wave      Tools.h++ Class Library                  286
  6858.  
  6859.  
  6860.  
  6861.  
  6862.  
  6863.  
  6864.  
  6865.  
  6866.                       CLASS REFERENCE
  6867.  
  6868.    RWBoolean        Error();
  6869. Returns TRUE if a file I/O error has occurred.
  6870.  
  6871.    RWBoolean        Exists();
  6872. Returns TRUE if the file exists and has read/write permission.
  6873.  
  6874.    RWBoolean        Exists(const char* filename);
  6875. Returns TRUE if an RWFile with name filename exists, with read/write
  6876. permission.
  6877.  
  6878.    RWBoolean        Flush();
  6879. Perform any pending I/O operations.  Returns TRUE if successful.
  6880.  
  6881.    const char*      GetName();
  6882. Returns the file name.
  6883.  
  6884.    RWBoolean        IsEmpty();
  6885. Returns TRUE if the file contains no data, else returns FALSE.
  6886.  
  6887.    RWBoolean        Read(char& c);
  6888.    RWBoolean        Read(short& i);
  6889.    RWBoolean        Read(int& i);
  6890.    RWBoolean        Read(long& i);
  6891.    RWBoolean        Read(unsigned char& c);
  6892.    RWBoolean        Read(unsigned short& i);
  6893.    RWBoolean        Read(unsigned int& i);
  6894.    RWBoolean        Read(unsigned long& i);
  6895.    RWBoolean        Read(float& f);
  6896.    RWBoolean        Read(double& d);
  6897. Reads the indicated built-in type.  Returns TRUE if the read is
  6898. successful.
  6899.  
  6900.    RWBoolean        Read(char* i, int count);
  6901.    RWBoolean        Read(short* i, int count);
  6902.    RWBoolean        Read(int* i, int count);
  6903.    RWBoolean        Read(long* i, int count);
  6904.    RWBoolean        Read(unsigned char* i, int count);
  6905.    RWBoolean        Read(unsigned int* i, int count);
  6906.    RWBoolean        Read(float* i, int count);
  6907.    RWBoolean        Read(double* i, int count);
  6908. Reads count instances of the indicated built-in type into a block
  6909. pointed to by i.  Returns TRUE if the read is successful.  Note that
  6910. you are responsible for declaring i and for allocating the necessary
  6911. storage before calling this function.
  6912.  
  6913. Rogue Wave      Tools.h++ Class Library                  287
  6914.  
  6915.  
  6916.  
  6917.  
  6918.  
  6919.  
  6920.  
  6921.  
  6922.                       CLASS REFERENCE
  6923.  
  6924.    RWBoolean        Read(char* string);
  6925. Reads a character string, including the terminating null character,
  6926. into a block pointed to by string.  Returns TRUE if the read is
  6927. successful.  Note that you are responsible for declaring string and
  6928. for allocating the necessary storage before calling this function.
  6929. Beware of overflow when using this function.
  6930.  
  6931.    RWBoolean        SeekTo(long offset);
  6932. Repositions the file pointer to offset bytes from the start of the
  6933. file.  Returns TRUE if the operation is successful.
  6934.  
  6935.    RWBoolean        SeekToBegin();
  6936. Repositions the file pointer to the start of the file.  Returns TRUE
  6937. if the operation is successful.
  6938.  
  6939.    RWBoolean        SeekToEnd();
  6940. Repositions the file pointer to the end of the file.  Returns TRUE
  6941. if the operation is successful.
  6942.  
  6943.    RWBoolean        Write(char i);
  6944.    RWBoolean        Write(short i);
  6945.    RWBoolean        Write(int i);
  6946.    RWBoolean        Write(long i);
  6947.    RWBoolean        Write(unsigned char i);
  6948.    RWBoolean        Write(unsigned short i);
  6949.    RWBoolean        Write(unsigned int i);
  6950.    RWBoolean        Write(unsigned long i);
  6951.    RWBoolean        Write(float f);
  6952.    RWBoolean        Write(double d);
  6953. Writes the appropriate built-in type.  Returns TRUE if the write is
  6954. successful.
  6955.  
  6956.    RWBoolean        Write(const char* i, int count);
  6957.    RWBoolean        Write(const short* i, int count);
  6958.    RWBoolean        Write(const int* i, int count);
  6959.    RWBoolean        Write(const long* i, int count);
  6960.    RWBoolean        Write(const unsigned char* i, int count);
  6961.    RWBoolean        Write(const unsigned int* i, int count);
  6962.    RWBoolean        Write(const float* i, int count);
  6963.    RWBoolean        Write(const double* i, int count);
  6964. Writes count instances of the indicated built-in type from a block
  6965. pointed to by i.  Returns TRUE if the write is successful.
  6966.  
  6967.  
  6968.  
  6969. Rogue Wave      Tools.h++ Class Library                  288
  6970.  
  6971.  
  6972.  
  6973.  
  6974.  
  6975.  
  6976.  
  6977.  
  6978.                       CLASS REFERENCE
  6979.  
  6980.    RWBoolean        Write(const char* string);
  6981. Writes a character string, including the terminating null character,
  6982. from a block pointed to by string.  Returns TRUE if the write is
  6983. successful.  Beware of non-terminated strings when using this
  6984. function.
  6985.  
  6986.  
  6987.  
  6988.  
  6989.  
  6990.  
  6991.  
  6992.  
  6993.  
  6994.  
  6995.  
  6996.  
  6997.  
  6998.  
  6999.  
  7000.  
  7001.  
  7002.  
  7003.  
  7004.  
  7005.  
  7006.  
  7007.  
  7008.  
  7009.  
  7010.  
  7011.  
  7012.  
  7013.  
  7014.  
  7015.  
  7016.  
  7017.  
  7018.  
  7019.  
  7020.  
  7021.  
  7022.  
  7023.  
  7024.  
  7025. Rogue Wave      Tools.h++ Class Library                  289
  7026.  
  7027.  
  7028.  
  7029.  
  7030.  
  7031.  
  7032.  
  7033.  
  7034.                       CLASS REFERENCE
  7035.  
  7036.  
  7037.  
  7038. class RWFileManager                                   RWFileManager
  7039.                                                             |
  7040.                                                           RWFile
  7041.  
  7042.  
  7043.  
  7044. Synopsis  typedef   long             RWoffset;
  7045.           typedef   unsigned  RWspace;  // (typically)
  7046.  
  7047.           #include <filemgr.h>
  7048.           RWFileManager f("file.dat");
  7049.  
  7050.  
  7051.  
  7052. Descripti Class RWFileManager allocates and deallocates storage in a disk
  7053. on        file.  It does this by maintaining a linked list of free space
  7054.           within the file.  NOTE:  Class RWFileManager inherits class
  7055.           RWFile as a public base class, hence all the public member
  7056.           functions of RWFile are visible to RWFileManager.  They are not
  7057.           listed here.
  7058.  
  7059. Public    RWFileManager(const char* filename);
  7060. construct Construct a RWFileManager for the file with path name
  7061. or        filename.  The RWFileManager can be constructed with an old
  7062.           file or it can create a new file.  If it is constructed with
  7063.           an old file, then the file must have been originally created
  7064.           by a RWFileManager.  Possible exceptions that can occur are
  7065.           TOOL_WRITEERR, TOOL_READERR, or TOOL_FLIST.
  7066.  
  7067.  
  7068. Public    RWoffset            allocate(RWspace s);
  7069. member    Allocates s bytes of storage in the file.  Returns the offset
  7070. functions to the start of the storage location.  The very first
  7071.           allocation for the file is considered "special" and can be
  7072.           returned at any later time by the function start().  Possible
  7073.           exceptions that can occur are TOOL_WRITEERR, TOOL_READERR and
  7074.           TOOL_SEEKERR.
  7075.  
  7076.    void             deallocate(RWoffset t);
  7077. Deallocates (frees) the storage space starting at offset t.  This
  7078. space must have been previously allocated by a call to allocate().
  7079. The very first allocation ever made in the file is considered
  7080.  
  7081. Rogue Wave      Tools.h++ Class Library                  290
  7082.  
  7083.  
  7084.  
  7085.  
  7086.  
  7087.  
  7088.  
  7089.  
  7090.                       CLASS REFERENCE
  7091.  
  7092. "special" and cannot be deallocated.  Possible exceptions that can
  7093. occur are TOOL_WRITEERR, TOOL_READERR and TOOL_SEEKERR.
  7094.  
  7095.    RWoffset         endData();
  7096. Returns the offset of the last space allocated on this file.  If no
  7097. space has every been allocated, returns NIL.
  7098.  
  7099.    RWoffset         start();
  7100. Returns the offset of the first space ever allocated for this file.
  7101. If no space has every been allocated, returns NIL.  This is
  7102. typically used to "get started" and find the rest of the data in the
  7103. file.
  7104.  
  7105.  
  7106.  
  7107.  
  7108.  
  7109.  
  7110.  
  7111.  
  7112.  
  7113.  
  7114.  
  7115.  
  7116.  
  7117.  
  7118.  
  7119.  
  7120.  
  7121.  
  7122.  
  7123.  
  7124.  
  7125.  
  7126.  
  7127.  
  7128.  
  7129.  
  7130.  
  7131.  
  7132.  
  7133.  
  7134.  
  7135.  
  7136.  
  7137. Rogue Wave      Tools.h++ Class Library                  291
  7138.  
  7139.  
  7140.  
  7141.  
  7142.  
  7143.  
  7144.  
  7145.  
  7146.                       CLASS REFERENCE
  7147.  
  7148.  
  7149.  
  7150. class RWHashDictionary                    RWHashDictionary
  7151.                                                   |
  7152.                                                 RWSet
  7153.                                                   |
  7154.                                             RWCollection
  7155.                                                   |
  7156.                                             RWCollectable
  7157.  
  7158.  
  7159. Synopsis  typedef RWHashDictionary Dictionary;
  7160.  
  7161.            // Smalltalk typedef.
  7162.  
  7163.           #include <hashdict.h>
  7164.           RWHashDictionary  a;
  7165.  
  7166.  
  7167.  
  7168. Descripti A RWHashDictionary represents a group of unordered values,
  7169. on        accessible by external keys.  Duplicate keys are not allowed.
  7170.           Class RWHashDictionary is implemented as a hash table of
  7171.           associations of keys and values.  Both the key and the value must
  7172.           inherit from abstract the base class RWCollectable, with a
  7173.           suitable definition of the virtual function hash() and isEqual()
  7174.           for the key.
  7175.           This class corresponds to the Smalltalk class Dictionary.
  7176.           When the hash table becomes greater than 2/3 full, it will
  7177.           automatically resize to the next prime number greater that
  7178.           twice the present table size.
  7179.  
  7180. Public    RWHashDictionary(unsigned n = 101);
  7181. construct Construct an empty hashed dictionary with a size that is the next
  7182. ors       highest prime number that is greater than or equal to n.
  7183.  
  7184.    RWHashDictionary(const RWHashDictionary& hd);
  7185. Copy constructor.  A shallow copy of the collection hd is made.
  7186.  
  7187.  
  7188.  
  7189.  
  7190.  
  7191.  
  7192.  
  7193. Rogue Wave      Tools.h++ Class Library                  292
  7194.  
  7195.  
  7196.  
  7197.  
  7198.  
  7199.  
  7200.  
  7201.  
  7202.                       CLASS REFERENCE
  7203.  
  7204.  
  7205. Public    void                operator=(const RWHashDictionary& hd);
  7206. member    Assignment operator.  A shallow copy of the collection hd is
  7207. operators made.
  7208.  
  7209.           RWBoolean           operator<=(const RWHashDictionary& hd) const;
  7210.           Returns TRUE if for every key-value pair in self, there is a
  7211.           corresponding key in hd that isEqual.  Their corresponding
  7212.           values must also be equal.
  7213.  
  7214.    RWBoolean        operator==(const RWHashDictionary& hd) const;
  7215. Returns TRUE if self and hd have the same number of entries and if
  7216. for every key-value pair in self, there is a corresponding key in hd
  7217. that isEqual.  Their corresponding values must also be equal.
  7218.  
  7219.  
  7220. Public    void                applyToKeyAndValue(applyKeyAndValue ap, void*)
  7221. member    Applies the user-supplied function pointed to by ap to each key-
  7222. functions value pair of the collection.  Items are not visited in any
  7223.           particular order.
  7224.  
  7225.    virtual unsigned binaryStoreSize() const;
  7226. Inherited from class RWCollection.
  7227.  
  7228.    virtual void     clear();
  7229. Redefined from class RWCollection.  Removes all key-value pairs in
  7230. the collection.
  7231.  
  7232.    virtual void     clearAndDestroy();
  7233. Redefined from class RWCollection.  Removes all key-value pairs in
  7234. the collection, and deletes the key and the value.
  7235.  
  7236.    virtual int      compareTo(const RWCollectable* a) const;
  7237. Inherited from class RWCollectable.
  7238.  
  7239.    virtual RWBoolean      contains(const RWCollectable* target) const;
  7240. Inherited from class RWCollection.
  7241.  
  7242.    virtual unsigned entries() const;
  7243. Inherited from class RWSet.
  7244.  
  7245.    virtual         RWCollectable*   find(const RWCollectable* target) const;
  7246. Redefined from class RWCollection.  Returns the key which isEqual to
  7247. the object pointed to by target, or nil if no key was found.
  7248.  
  7249. Rogue Wave      Tools.h++ Class Library                  293
  7250.  
  7251.  
  7252.  
  7253.  
  7254.  
  7255.  
  7256.  
  7257.  
  7258.                       CLASS REFERENCE
  7259.  
  7260.    RWCollectable*   findKeyAndValue(const RWCollectable* target,
  7261.                     RWCollectable*& v) const;
  7262. Returns the key which isEqual to the item pointed to by target, or
  7263. nil if no key was found.  The value is put in v.  You are
  7264. responsible for defining v before calling this function.
  7265.  
  7266.    RWCollectable*   findValue(const RWCollectable* target) const;
  7267. Returns the value associated with the key which isEqual to the item
  7268. pointed to by target, or nil if no key was found.
  7269.  
  7270.    RWCollectable*   findValue(const RWCollectable* target,
  7271.                     RWCollectable* newValue);
  7272. Returns the value associated with the key which isEqual to the item
  7273. pointed to by target, or nil if no key was found.  Replaces the
  7274. value with newValue (if a key was found).
  7275.  
  7276.    virtual unsigned hash() const;
  7277. Inherited from class RWCollectable.
  7278.  
  7279.    RWCollectable*   insertKeyAndValue(RWCollectable* key,
  7280.                     RWCollectable* value);
  7281. Adds a key-value pair to the collection and returns the key if
  7282. successful, nil if the key is already in the collection.
  7283.  
  7284.    virtual ClassID  isA() const;
  7285. Redefined from class RWCollectable to return __RWHASHDICTIONARY.
  7286.  
  7287.    virtual RWBoolean      isEmpty() const;
  7288. Inherited from class RWSet.
  7289.  
  7290.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  7291. Inherited from class RWCollectable.
  7292.  
  7293.    virtual         unsigned   occurrencesOf(const RWCollectable* target) const;
  7294. Inherited from class RWSet.  Returns the number of keys which
  7295. isEqual to the item pointed to by target.  Because duplicates are
  7296. not allowed, this function can only return 0 or 1.
  7297.  
  7298.    virtual         RWCollectable*   remove(const RWCollectable* target);
  7299. Redefined from class RWCollection.  Removes the key and value pair
  7300. where the key isEqual to the item pointed to by target.  Returns the
  7301. key, or nil if no match was found.
  7302.  
  7303.  
  7304.  
  7305. Rogue Wave      Tools.h++ Class Library                  294
  7306.  
  7307.  
  7308.  
  7309.  
  7310.  
  7311.  
  7312.  
  7313.  
  7314.                       CLASS REFERENCE
  7315.  
  7316.    virtual void     removeAndDestroy(const RWCollectable* target);
  7317. Redefined from class RWCollection.  Removes and deletes the key and
  7318. value pair where the key isEqual to the item pointed to by target.
  7319. Note that both the key and the value are deleted.  Does nothing if
  7320. the key is not found.
  7321.  
  7322.    RWCollectable*   removeKeyAndValue(const RWCollectable* target,
  7323.                     RWCollectable*& v);
  7324. Removes the key and value pair where the key isEqual to the item
  7325. pointed to by target.  Returns the key, or nil if no match was
  7326. found.  The value is put in v.  You are responsible for defining v
  7327. before calling this function.
  7328.  
  7329.    void             resize(unsigned n = 0);
  7330. Inherited from class RWSet.
  7331.  
  7332.    virtual void     restoreGuts(RWvistream&);
  7333.    virtual void     restoreGuts(RWFile&);
  7334.    virtual void     saveGuts(RWvostream&) const;
  7335.    virtual void     saveGuts(RWFile&) const;
  7336. Inherited from class RWCollection.
  7337.  
  7338.    static        RWCollectable*    restoreFrom(RWvistream&);
  7339.    static        RWCollectable*    restoreFrom(RWFile&);
  7340.    void             saveOn(RWvostream&) const;
  7341.    void             saveOn(RWFile&) const;
  7342. Inherited from class RWCollectable.
  7343.  
  7344.  
  7345.  
  7346.  
  7347.  
  7348.  
  7349.  
  7350.  
  7351.  
  7352.  
  7353.  
  7354.  
  7355.  
  7356.  
  7357.  
  7358.  
  7359.  
  7360.  
  7361. Rogue Wave      Tools.h++ Class Library                  295
  7362.  
  7363.  
  7364.  
  7365.  
  7366.  
  7367.  
  7368.  
  7369.  
  7370.                       CLASS REFERENCE
  7371.  
  7372.  
  7373.  
  7374. class RWHashDictionaryIterator             RWHashDictionaryItera
  7375.                                                     tor
  7376.                                                      |
  7377.                                                RWSetIterator
  7378.                                                      |
  7379.                                                 RWIterator
  7380.  
  7381. Synopsis  #include <hashdict.h>
  7382.  
  7383.           RWHashDictionary           hd;
  7384.           RWHashDictionaryIterator   iter(hd);
  7385.  
  7386.  
  7387.  
  7388. Descripti Iterator ;for class RWHashDictionary, allowing sequential
  7389. on        access to all the elements of RWHashDictionary.  Since
  7390.           RWHashDictionary is unordered, elements are not accessed in any
  7391.           particular order.
  7392.  
  7393. Public    RWHashDictionaryIterator(RWHashDictionary&);
  7394. construct Construct an iterator for a RWHashDictionary collection.
  7395. or        Immediately after construction, the position of the iterator
  7396.           is undefined until positioned.
  7397.  
  7398.  
  7399. Public    virtual                RWCollectable*      operator()();
  7400. member    Redefined from class RWIterator.  Advances the iterator to the
  7401. operator  next key-value pair and returns the key.  Returns nil if the
  7402.           cursor is at the end of the collection.  Use member function
  7403.           value() to recover the value.
  7404.  
  7405.  
  7406. Public    virtual    RWCollectable*     findNext(const RWCollectable* target);
  7407. member    Redefined from class RWIterator.  Moves the iterator to the
  7408. functions next key-value pair where the key isEqual to the object pointed
  7409.           to by target.  Returns the key or nil if no key was found.
  7410.  
  7411.    virtual         RWCollectable*   key() const;
  7412. Redefined from class RWIterator.  Returns the key at the current
  7413. iterator position.
  7414.  
  7415.  
  7416.  
  7417. Rogue Wave      Tools.h++ Class Library                  296
  7418.  
  7419.  
  7420.  
  7421.  
  7422.  
  7423.  
  7424.  
  7425.  
  7426.                       CLASS REFERENCE
  7427.  
  7428.    RWCollectable*   remove();
  7429. Removes the key-value pair at the current iterator position.
  7430. Returns the key, or nil if there was no key-value pair.
  7431.  
  7432.    RWCollectable*   removeNext(const RWCollectable* target);
  7433. Moves the iterator to the next key-value pair where the key isEqual
  7434. to the object pointed to by target.  Removes the key-value pair,
  7435. returning the key or nil if there was no match.
  7436.  
  7437.    virtual void     reset();
  7438. Redefined from class RWIterator.  Inherited from class
  7439. RWSetIterator.  Resets the iterator to its initial state.
  7440.  
  7441.    RWCollectable*   value() const;
  7442. Returns the value at the current iterator position.
  7443.  
  7444.    RWCollectable*   value(RWCollectable* newValue) const;
  7445. Replaces the value at the current iterator position and returns the
  7446. old value.
  7447.  
  7448.  
  7449.  
  7450.  
  7451.  
  7452.  
  7453.  
  7454.  
  7455.  
  7456.  
  7457.  
  7458.  
  7459.  
  7460.  
  7461.  
  7462.  
  7463.  
  7464.  
  7465.  
  7466.  
  7467.  
  7468.  
  7469.  
  7470.  
  7471.  
  7472.  
  7473. Rogue Wave      Tools.h++ Class Library                  297
  7474.  
  7475.  
  7476.  
  7477.  
  7478.  
  7479.  
  7480.  
  7481.  
  7482.                       CLASS REFERENCE
  7483.  
  7484.  
  7485.  
  7486. class RWIdentityDictionary              RWIdentityDictionar
  7487.                                                   y
  7488.                                                   |
  7489.                                           RWHashDictionary
  7490.                                                   |
  7491.                                                 RWSet
  7492.                                                   |
  7493.                                             RWCollection
  7494.                                                   |
  7495.                                             RWCollectable
  7496.  
  7497.  
  7498. Synopsis  #include <idendict.h>
  7499.           typedef RWIdentityDictionary IdentityDictionary; // Smalltalk typedef
  7500.  
  7501.           RWIdentityDictionary a;
  7502.  
  7503.  
  7504.  
  7505. Descripti The class RWIdentityDictionary is implemented as a hash table, for
  7506. on        the storage and retrieval of key-value pairs.  Class
  7507.           RWIdentityDictionary is similar to class RWHashDictionary except
  7508.           that items are found by requiring that they be identical (i.e.,
  7509.           have the same address) as the key, rather than being equal (i.e.,
  7510.           test true for isEqual()).
  7511.           Both keys and values must inherit from the abstract base class
  7512.           RWCollectable.
  7513.           The iterator for this class is RWHashDictionaryIterator.
  7514.  
  7515. Public    RWIdentityDictionary(unsigned n = 101);
  7516. construct Construct an empty identity dictionary with a hash table with n
  7517. or        entries.
  7518.  
  7519.  
  7520. Public    The user interface to this class is identical to class
  7521. member    RWHashDictionary and is not reproduced here.  The only difference
  7522. functions between the classes is that keys are found on the basis of
  7523.           identity rather than equality, and that the virtual function isA()
  7524.           returns __RWIDENTITYDICTIONARY, the ClassId for
  7525.           RWIdentityDictionary.
  7526.  
  7527.  
  7528.  
  7529. Rogue Wave      Tools.h++ Class Library                  298
  7530.  
  7531.  
  7532.  
  7533.  
  7534.  
  7535.  
  7536.  
  7537.  
  7538.                       CLASS REFERENCE
  7539.  
  7540.  
  7541.  
  7542. class RWIdentitySet                         RWIdentitySet
  7543.                                                   |
  7544.                                                 RWSet
  7545.                                                   |
  7546.                                             RWCollection
  7547.                                                   |
  7548.                                             RWCollectable
  7549.  
  7550. Synopsis  #include <idenset.h>
  7551.           typedef RWIdentitySet IdentitySet;
  7552.  
  7553.           // Smalltalk typedef
  7554.           RWIdentitySet a;
  7555.  
  7556.  
  7557.  
  7558. Descripti The class RWIdentitySet is similar to class RWSet except that
  7559. on        items are found by requiring that they be identical (i.e., have
  7560.           the same address) as the key, rather than being equal (i.e., test
  7561.           true for isEqual()).
  7562.           The iterator for this class is RWSetIterator.
  7563.  
  7564. Public    RWIdentitySet(unsigned n = 101);
  7565. construct Construct an empty identity set with a hash table having n
  7566. or        entries.
  7567.  
  7568.  
  7569. Public    The user interface to this class is identical to class RWSet and
  7570. member    is not reproduced here.  The only difference between the classes
  7571. functions is that keys are found on the basis of identity rather than
  7572.           equality, and that the virtual function isA() returns
  7573.           __RWIDENTITYSET, the ClassId for RWIdentitySet.
  7574.  
  7575.  
  7576.  
  7577.  
  7578.  
  7579.  
  7580.  
  7581.  
  7582.  
  7583.  
  7584.  
  7585. Rogue Wave      Tools.h++ Class Library                  299
  7586.  
  7587.  
  7588.  
  7589.  
  7590.  
  7591.  
  7592.  
  7593.  
  7594.                       CLASS REFERENCE
  7595.  
  7596.  
  7597.  
  7598. class RWInteger
  7599.  
  7600.  
  7601.  
  7602.  
  7603.  
  7604. Synopsis  #include <rwint.h>
  7605.  
  7606.           RWInteger i;
  7607.  
  7608.  
  7609.  
  7610. Descripti Integer class.  This class is useful as a base class for
  7611. on        classes that use integers as keys in dictionaries, etc.
  7612.  
  7613. Public    RWInteger();
  7614. construct Construct a RWInteger with value zero (0).
  7615. ors
  7616.  
  7617.    RWInteger(int i);
  7618. Construct a RWInteger with value i.  Serves as a type conversion
  7619. from int.
  7620.  
  7621.  
  7622. Type      operator            int();
  7623. conversionType conversion to int.
  7624.  
  7625.  
  7626. Public    unsigned            binaryStoreSize() const;
  7627. member    Returns the number of bytes necessary to store the object
  7628. functions using RWInteger::saveOn(RWFile&).
  7629.  
  7630.    void             restoreFrom(RWvistream& s);
  7631. Reads an RWInteger that was stored with saveOn() from the input
  7632. stream s.
  7633.  
  7634.    void             restoreFrom(RWFile& s);
  7635. Reads an RWInteger that was stored with saveOn() from the RWFile s.
  7636.  
  7637.    void             saveOn(RWvostream& s) const;
  7638. Stores an RWInteger on the output stream s.
  7639.  
  7640.  
  7641. Rogue Wave      Tools.h++ Class Library                  300
  7642.  
  7643.  
  7644.  
  7645.  
  7646.  
  7647.  
  7648.  
  7649.  
  7650.                       CLASS REFERENCE
  7651.  
  7652.    void             saveOn(RWFile& s) const;
  7653. Stores an RWInteger in binary format on RWFile s.
  7654.  
  7655.    int              value() const;
  7656. Returns the value of the RWInteger.
  7657.  
  7658.    int              value(int newval);
  7659. Changes the value of the RWInteger to newval and returns the old
  7660. value.
  7661.  
  7662.  
  7663. Related   ostream&            operator<<(ostream& o, const RWInteger& x);
  7664. Global    Output x to ostream o.
  7665. Operators
  7666.           istream&            operator>>(istream& i, RWInteger& x);
  7667.           Input x from istream i.
  7668.  
  7669.  
  7670.  
  7671.  
  7672.  
  7673.  
  7674.  
  7675.  
  7676.  
  7677.  
  7678.  
  7679.  
  7680.  
  7681.  
  7682.  
  7683.  
  7684.  
  7685.  
  7686.  
  7687.  
  7688.  
  7689.  
  7690.  
  7691.  
  7692.  
  7693.  
  7694.  
  7695.  
  7696.  
  7697. Rogue Wave      Tools.h++ Class Library                  301
  7698.  
  7699.  
  7700.  
  7701.  
  7702.  
  7703.  
  7704.  
  7705.  
  7706.                       CLASS REFERENCE
  7707.  
  7708.  
  7709.  
  7710. class RWIterator
  7711.  
  7712.  
  7713.  
  7714.  
  7715.  
  7716. Synopsis  #include <iterator.h>
  7717.  
  7718.           typedef RWIterator Iterator;  // "Smalltalk" typedef
  7719.  
  7720.  
  7721.  
  7722. Descripti Class RWIterator is an abstract base class for iterators used by
  7723. on        the Smalltalk_-like collection classes.  The class contains virtual
  7724.           functions for positioning and resetting the iterator.  They are all
  7725.           pure virtual functions, meaning that deriving classes must supply a
  7726.           definition.  The descriptions below are intended to be generic --
  7727.           all inheriting iterators generally follow the described pattern.
  7728.  
  7729. Public    virtual RWCollectable*   findNext(const RWCollectable* target) = 0;
  7730. virtual   Moves the iterator forward to the next item which "matches" the
  7731. functions object pointed to by target and returns it or nil if no item
  7732.           was found.  For most collections, an item "matches" the target
  7733.           if either isEqual() or compareTo() find equivalence, whichever
  7734.           is appropriate for the actual collection type.  However, when
  7735.           an iterator is used with an "identity collection" (i.e.,
  7736.           RWIdentitySet and RWIdentityDictionary), it looks for an item
  7737.           with the same address (i.e., "is identical to").
  7738.  
  7739.    virtual         RWCollectable*   key() const = 0;
  7740. Returns the item at the current iterator position.
  7741.  
  7742.    virtual         RWCollectable*   operator()() = 0;
  7743. Advances the iterator and returns the next item, or nil if the end
  7744. of the collection has been reached.
  7745.  
  7746.    virtual         void       reset() = 0;
  7747. Resets the iterator to the state it had immediately after
  7748. construction.
  7749.  
  7750.  
  7751.  
  7752.  
  7753. Rogue Wave      Tools.h++ Class Library                  302
  7754.  
  7755.  
  7756.  
  7757.  
  7758.  
  7759.  
  7760.  
  7761.  
  7762.                       CLASS REFERENCE
  7763.  
  7764.  
  7765.  
  7766. class RWOrdered                               RWOrdered
  7767.                                                   |
  7768.                                            RWSequenceable
  7769.                                                   |
  7770.                                             RWCollection
  7771.                                                   |
  7772.                                             RWCollectable
  7773.  
  7774. Synopsis  #include <ordcltn.h>
  7775.  
  7776.           RWOrdered a;
  7777.  
  7778.  
  7779.  
  7780. Descripti Class RWOrdered represents a group of ordered items, accessible by
  7781. on        an index number, but not accessible by an external key.
  7782.           Duplicates are allowed.  The ordering of elements is determined
  7783.           externally, generally by the order of insertion and removal.  An
  7784.           object stored by RWOrdered must inherit from the abstract base
  7785.           class RWCollectable.
  7786.           Class RWOrdered is implemented as a vector of pointers,
  7787.           allowing for more efficient traversing of the collection than
  7788.           the linked list classes RWSlistCollectables and
  7789.           RWDlistCollectables, but slower insertion in the center of the
  7790.           collection.
  7791.  
  7792. Public    RWOrdered(int size = 101);
  7793. construct Construct an RWOrdered with initially size entries.
  7794. ors
  7795.  
  7796.  
  7797. Public    RWBoolean           operator==(const RWOrdered& od) const;
  7798. member    Returns TRUE if for every item in self, the corresponding item
  7799. operators in od at the same index isEqual.  The two collections must also
  7800.           have the same number of members.
  7801.  
  7802.    RWCollectable*&  operator[](int i);
  7803. Returns the i'th element in the collection.  If i is out of range,
  7804. an exception will occur with error TOOL_INDEX.  The results of this
  7805. function can be used as an lvalue.
  7806.  
  7807.  
  7808.  
  7809. Rogue Wave      Tools.h++ Class Library                  303
  7810.  
  7811.  
  7812.  
  7813.  
  7814.  
  7815.  
  7816.  
  7817.  
  7818.                       CLASS REFERENCE
  7819.  
  7820.    RWCollectable*&  operator()(int i);
  7821. Returns the i'th element in the collection.  Bounds checking is
  7822. enabled by defining the preprocessor directive BOUNDS_CHECK before
  7823. including the header file ordcltn.h.  In this case, if i is out of
  7824. range, an exception will occur with error TOOL_INDEX.  .  The
  7825. results of this function can be used as an lvalue.
  7826.  
  7827.  
  7828. Public    virtual                RWCollectable*      append(RWCollectable*);
  7829. member    Redefined from class RWSequenceable.  Adds the item to the
  7830. functions end of the collection and returns it.  Returns nil if the
  7831.           insertion was unsuccessful.
  7832.  
  7833.    virtual void     apply(applyCollectable ap, void* x);
  7834. Redefined from class RWCollection.    This function has been
  7835. redefined to apply the user-supplied function pointed to by ap to
  7836. each member of the collection, in order, from first to last.
  7837.  
  7838.    virtual RWCollectable*&at(int i);
  7839.    virtual const RWCollectable*  at(int i) const;
  7840. Redefined from class RWSequenceable.
  7841.  
  7842.    virtual unsigned binaryStoreSize() const;
  7843. Inherited from class RWCollection.
  7844.  
  7845.    virtual void     clear();
  7846. Redefined from class RWCollection.
  7847.  
  7848.    virtual void     clearAndDestroy();
  7849. Inherited from class RWCollection.
  7850.  
  7851.    virtual int      compareTo(const RWCollectable* a) const;
  7852. Inherited from class RWCollectable.
  7853.  
  7854.    virtual RWBoolean      contains(const RWCollectable* target) const;
  7855. Inherited from class RWCollection.
  7856.  
  7857.    virtual unsigned entries() const;
  7858. Redefined from class RWCollection.
  7859.  
  7860.    virtual         RWCollectable*   find(const RWCollectable* target) const;
  7861. Redefined from class RWCollection.  Returns the first item that
  7862. isEqual to the item pointed to by target, or nil if no item was
  7863. found..
  7864.  
  7865. Rogue Wave      Tools.h++ Class Library                  304
  7866.  
  7867.  
  7868.  
  7869.  
  7870.  
  7871.  
  7872.  
  7873.  
  7874.                       CLASS REFERENCE
  7875.  
  7876.    virtual         RWCollectable*   first() const;
  7877. Refined from class RWSequenceable.  Returns the first item in the
  7878. collection.
  7879.  
  7880.    virtual unsigned hash() const;
  7881. Inherited from class RWCollectable.
  7882.  
  7883.    virtual int      index(const RWCollectable*) const;
  7884. Refined from class RWSequenceable.
  7885.  
  7886.    virtual         RWCollectable*   insert(RWCollectable* c);
  7887. Redefined from class RWCollection.  Adds the item to the end of the
  7888. collection and returns it.  Returns nil if the insertion was
  7889. unsuccessful.
  7890.  
  7891.    virtual         RWCollectable*   insertAfter(int i, RWCollectable* c);
  7892. Redefined from class RWSequenceable.  Inserts and returns the object
  7893. pointed to by c after the item at index i.  Returns nil if i is out
  7894. of bounds or the insertion was otherwise unsuccessful.
  7895.  
  7896.    virtual ClassID  isA() const;
  7897. Redefined from class RWCollectable to return __RWORDERED.
  7898.  
  7899.    virtual RWBoolean      isEmpty() const;
  7900. Redefined from class RWCollection.
  7901.  
  7902.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  7903. Inherited from class RWCollectable.
  7904.  
  7905.    virtual         RWCollectable*   last() const;
  7906. Refined from class RWSequenceable.  Returns the last item in the
  7907. collection.
  7908.  
  7909.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  7910. Redefined from class RWCollection.  Returns the number of items that
  7911. compare isEqual to the item pointed to by target.
  7912.  
  7913.    RWCollectable*   prepend(RWCollectable*);
  7914. Redefined from class RWSequenceable.  Adds the item to the beginning
  7915. of the collection and returns it.  Returns nil if the insertion was
  7916. unsuccessful.
  7917.  
  7918.    void             push(RWCollectable* c);
  7919. This is an alternative implementation of a stack to class
  7920.  
  7921. Rogue Wave      Tools.h++ Class Library                  305
  7922.  
  7923.  
  7924.  
  7925.  
  7926.  
  7927.  
  7928.  
  7929.  
  7930.                       CLASS REFERENCE
  7931.  
  7932. RWSlistCollectablesStack.  The item pointed to by c is put at the
  7933. end of the collection.
  7934.  
  7935.    RWCollectable*   pop();
  7936. This is an alternative implementation of a stack to class
  7937. RWSlistCollectablesStack.  The last item in the collection is
  7938. removed and returned.  If there are no items in the collection, nil
  7939. is returned.
  7940.  
  7941.    virtual         RWCollectable*   remove(const RWCollectable* target);
  7942. Redefined from class RWCollection.  Removes the first item that
  7943. isEqual to the item pointed to by target and returns it.  Returns
  7944. nil if no item was found.
  7945.  
  7946.    virtual void     removeAndDestroy(const RWCollectable* target);
  7947. Inherited from class RWCollection.
  7948.  
  7949.    RWCollectable*   top() const;
  7950. This is an alternative implementation of a stack to class
  7951. RWSlistCollectablesStack.  The last item in the collection is
  7952. returned.  If there are no items in the collection, nil is returned.
  7953.  
  7954.  
  7955.  
  7956.  
  7957.  
  7958.  
  7959.  
  7960.  
  7961.  
  7962.  
  7963.  
  7964.  
  7965.  
  7966.  
  7967.  
  7968.  
  7969.  
  7970.  
  7971.  
  7972.  
  7973.  
  7974.  
  7975.  
  7976.  
  7977. Rogue Wave      Tools.h++ Class Library                  306
  7978.  
  7979.  
  7980.  
  7981.  
  7982.  
  7983.  
  7984.  
  7985.  
  7986.                       CLASS REFERENCE
  7987.  
  7988.  
  7989.  
  7990. class RWOrderedIterator                        RWOrderedIterator
  7991.                                                        |
  7992.                                                    RWIterator
  7993.  
  7994.  
  7995.  
  7996. Synopsis  #include <ordcltn.h>
  7997.  
  7998.           RWOrdered a;
  7999.           RWOrderedIterator iter(a);
  8000.  
  8001.  
  8002.  
  8003. Descripti Iterator for class RWOrdered.  Traverses the collection from
  8004. on        the first to the last item.
  8005.  
  8006. Public    RWOrderedIterator(const RWOrdered& a);
  8007. construct Construct a RWOrderedIterator from a RWOrdered.
  8008. ors       Immediately after construction the position of the
  8009.           iterator is undefined.
  8010.  
  8011.  
  8012. Public    virtual                RWCollectable*      operator()();
  8013. member    Redefined from class RWIterator.  Advances the iterator to
  8014. operator  the next item and returns it. Returns nil when the end of
  8015.           the collection is reached.
  8016.  
  8017.  
  8018. Public    virtual RWCollectable*      findNext(const RWCollectable*);
  8019. member    Redefined from class RWIterator.  Moves iterator to the
  8020. functions next item which isEqual to the item pointed to by target
  8021.           and returns it.  If no item is found, returns nil and the
  8022.           position of the iterator will be undefined.
  8023.  
  8024.    virtual         RWCollectable*   key() const;
  8025. Redefined from class RWIterator.  Returns the item at the current
  8026. iterator position.
  8027.  
  8028.    virtual void     reset();
  8029. Redefined from class RWIterator.  Resets the iterator to its
  8030. starting state.
  8031.  
  8032.  
  8033. Rogue Wave      Tools.h++ Class Library                  307
  8034.  
  8035.  
  8036.  
  8037.  
  8038.  
  8039.  
  8040.  
  8041.  
  8042.                       CLASS REFERENCE
  8043.  
  8044.  
  8045.  
  8046. class RWpistream                             RWpistream
  8047.                                                   |
  8048.                                              RWvistream
  8049.                                                   |
  8050.                                                  ios
  8051.  
  8052.                                              (V2.X style
  8053.                                           iostreams, only)
  8054.  
  8055. Synopsis  #include <pstream.h>
  8056.  
  8057.           RWpistream pstr(cin);
  8058.  
  8059.           // Construct a RWpistream, using cin's streambuf
  8060.  
  8061.  
  8062.  
  8063. Descripti Class RWpistream specializes the abstract base class RWvistream
  8064. on        to restore variables stored in a portable ASCII format by
  8065.           RWpostream.
  8066.           You can think of RWpistream and RWpostream as an ASCII veneer
  8067.           over an associated streambuf which are responsbile for
  8068.           formatting variables and escaping characters such that the
  8069.           results can be interchanged between any machines.  As such,
  8070.           they are slower than their binary counterparts RWbistream and
  8071.           RWbostream which are more machine dependent.  Because
  8072.           RWpistream and RWpostream retain no information about the
  8073.           state of their associated streambufs, their use can be freely
  8074.           exchanged with other users of the streambuf (such as istream
  8075.           or ifstream).
  8076.           The restore is independent of whether the compiler is using
  8077.           AT&T V1.2 style "streams", or the newer V2.X style "iostreams"
  8078.           -- the user need not be concerned with which style is actually
  8079.           being used.  See class RWvistream for details.
  8080.           RWpistream can be interrogated as to the stream state using
  8081.           member functions good(), bad(), eof(), etc.
  8082.  
  8083.  
  8084.  
  8085.  
  8086.  
  8087.  
  8088.  
  8089. Rogue Wave      Tools.h++ Class Library                  308
  8090.  
  8091.  
  8092.  
  8093.  
  8094.  
  8095.  
  8096.  
  8097.  
  8098.                       CLASS REFERENCE
  8099.  
  8100. Example   This example assumes that V2.X style "iostreams" are being used.
  8101.           See RWpostream for an example of how to create an input stream for
  8102.           this program.
  8103.           #include <pstream.h>
  8104.  
  8105.           main()
  8106.           {
  8107.             // Construct a RWpistream to use standard input
  8108.             RWpistream pstr(cin);
  8109.  
  8110.             int i;
  8111.             float f;
  8112.             double d;
  8113.  
  8114.             char string[80];
  8115.  
  8116.             pstr >> i; // Restore an int that was stored in binary
  8117.             pstr >> f >> d;     // Restore a float & double
  8118.             pstr.getString(string, 80);  // Restore a character string
  8119.           }
  8120.  
  8121.  
  8122.  
  8123. Public    RWpistream(streambuf* s);
  8124. construct Initialize a RWpistream from the streambuf s.
  8125. ors
  8126.  
  8127.    RWpistream(istream& str);
  8128. Initialize a RWpistream using the streambuf associated with the
  8129. istream str.
  8130.  
  8131.  
  8132. Public    virtual int         get();
  8133. member    Redefined from class RWvistream.  Get and return the next
  8134. functions character from the input stream.  Returns EOF if end of file is
  8135.           encountered.
  8136.  
  8137.    virtual RWvistream&    get(char& c);
  8138. Redefined from class RWvistream.  Get the next char and store it in
  8139. c.
  8140.  
  8141.    virtual RWvistream&    get(unsigned char& c);
  8142. Redefined from class RWvistream.  Get the next unsigned char and
  8143. store it in c.
  8144.  
  8145. Rogue Wave      Tools.h++ Class Library                  309
  8146.  
  8147.  
  8148.  
  8149.  
  8150.  
  8151.  
  8152.  
  8153.  
  8154.                       CLASS REFERENCE
  8155.  
  8156.    virtual RWvistream&    get(char* v, unsigned N);
  8157. Redefined from class RWvistream.  Get a vector of char's and store
  8158. then in the array beginning at v.  If the restore is stopped
  8159. prematurely, get stores whatever it can in v, and sets the failbit.
  8160. Note that the vector is treated as a vector of numbers, not
  8161. characters.  If you wish to restore a character string, use function
  8162. getString(char*, int).
  8163.  
  8164.  
  8165.  
  8166.  
  8167.  
  8168.  
  8169.  
  8170.  
  8171.  
  8172.  
  8173.  
  8174.  
  8175.  
  8176.  
  8177.  
  8178.  
  8179.  
  8180.  
  8181.  
  8182.  
  8183.  
  8184.  
  8185.  
  8186.  
  8187.  
  8188.  
  8189.  
  8190.  
  8191.  
  8192.  
  8193.  
  8194.  
  8195.  
  8196.  
  8197.  
  8198.  
  8199.  
  8200.  
  8201. Rogue Wave      Tools.h++ Class Library                  310
  8202.  
  8203.  
  8204.  
  8205.  
  8206.  
  8207.  
  8208.  
  8209.  
  8210.                       CLASS REFERENCE
  8211.  
  8212.    virtual RWvistream&    get(double* v, unsigned N);
  8213. Redefined from class RWvistream.  Get a vector of double's and store
  8214. then in the array beginning at v.  If the restore is stopped
  8215. prematurely, get stores whatever it can in v, and sets the failbit.
  8216.  
  8217.    virtual RWvistream&    get(float* v, unsigned N);
  8218. Redefined from class RWvistream.  Get a vector of float's and store
  8219. then in the array beginning at v.  If the restore is stopped
  8220. prematurely, get stores whatever it can in v, and sets the failbit.
  8221.  
  8222.    virtual RWvistream&    get(int* v, unsigned N);
  8223. Redefined from class RWvistream.  Get a vector of int's and store
  8224. then in the array beginning at v.  If the restore is stopped
  8225. prematurely, get stores whatever it can in v, and sets the failbit.
  8226.  
  8227.    virtual RWvistream&    get(long* v, unsigned N);
  8228. Redefined from class RWvistream.  Get a vector of long's and store
  8229. then in the array beginning at v.  If the restore is stopped
  8230. prematurely, get stores whatever it can in v, and sets the failbit.
  8231.  
  8232.    virtual RWvistream&    get(short* v, unsigned N);
  8233. Redefined from class RWvistream.  Get a vector of short's and store
  8234. then in the array beginning at v.  If the restore is stopped
  8235. prematurely, get stores whatever it can in v, and sets the failbit.
  8236.  
  8237.    virtual RWvistream&    get(unsigned char* v, unsigned N);
  8238. Redefined from class RWvistream.  Get a vector of unsigned char's
  8239. and store then in the array beginning at v.  If the restore is
  8240. stopped prematurely, get stores whatever it can in v, and sets the
  8241. failbit.  Note that the vector is treated as a vector of numbers,
  8242. not characters.  If you wish to restore a character string, use
  8243. function getString(char*, int).
  8244.  
  8245.    virtual RWvistream&    get(unsigned short* v, unsigned N);
  8246. Redefined from class RWvistream.  Get a vector of unsigned short's
  8247. and store then in the array beginning at v.  If the restore is
  8248. stopped prematurely, get stores whatever it can in v, and sets the
  8249. failbit.
  8250.  
  8251.    virtual RWvistream&    get(unsigned int* v, unsigned N);
  8252. Redefined from class RWvistream.  Get a vector of unsigned int's and
  8253. store then in the array beginning at v.  If the restore is stopped
  8254. prematurely, get stores whatever it can in v, and sets the failbit.
  8255.  
  8256.  
  8257. Rogue Wave      Tools.h++ Class Library                  311
  8258.  
  8259.  
  8260.  
  8261.  
  8262.  
  8263.  
  8264.  
  8265.  
  8266.                       CLASS REFERENCE
  8267.  
  8268.    virtual RWvistream&    get(unsigned long* v, unsigned N);
  8269. Redefined from class RWvistream.  Get a vector of unsigned long's
  8270. and store then in the array beginning at v.  If the restore is
  8271. stopped prematurely, get stores whatever it can in v, and sets the
  8272. failbit.
  8273.  
  8274.    virtual RWvistream&    getString(char* s, unsigned N);
  8275. Redefined from class RWvistream.  Restores a character string from
  8276. the input stream and stores it in the array beginning at s.  The
  8277. function stops reading at the end of the string or after N-1
  8278. characters, whichever comes first.  If the latter, then the failbit
  8279. of the stream will be set.  In either case, the string will be
  8280. terminated with a null byte.  If the input stream has been
  8281. corrupted, then an exception with error CORE_SYNSTREAM will occur.
  8282.  
  8283.    virtual RWvistream&    operator>>(char& c);
  8284. Redefined from class RWvistream.  Get the next character from the
  8285. input stream and store it in c.
  8286.  
  8287.    virtual RWvistream&    operator>>(double& d);
  8288. Redefined from class RWvistream.  Get the next double from the input
  8289. stream and store it in d.
  8290.  
  8291.    virtual RWvistream&    operator>>(float& f);
  8292. Redefined from class RWvistream.  Get the next float from the input
  8293. stream and store it in f.
  8294.  
  8295.    virtual RWvistream&    operator>>(int& i);
  8296. Redefined from class RWvistream.  Get the next int from the input
  8297. stream and store it in i.
  8298.  
  8299.    virtual RWvistream&    operator>>(long& l);
  8300. Redefined from class RWvistream.  Get the next long from the input
  8301. stream and store it in l.
  8302.  
  8303.    virtual RWvistream&    operator>>(short& s);
  8304. Redefined from class RWvistream.  Get the next short from the input
  8305. stream and store it in s.
  8306.  
  8307.    virtual RWvistream&    operator>>(unsigned char& c);
  8308. Redefined from class RWvistream.  Get the next unsigned char from
  8309. the input stream and store it in c.
  8310.  
  8311.  
  8312.  
  8313. Rogue Wave      Tools.h++ Class Library                  312
  8314.  
  8315.  
  8316.  
  8317.  
  8318.  
  8319.  
  8320.  
  8321.  
  8322.                       CLASS REFERENCE
  8323.  
  8324.    virtual RWvistream&    operator>>(unsigned short& s);
  8325. Redefined from class RWvistream.  Get the next unsigned short from
  8326. the input stream and store it in s.
  8327.  
  8328.    virtual RWvistream&    operator>>(unsigned int& i);
  8329. Redefined from class RWvistream.  Get the next unsigned int from the
  8330. input stream and store it in i.
  8331.  
  8332.    virtual RWvistream&    operator>>(unsigned long& l);
  8333. Redefined from class RWvistream.  Get the next unsigned long from
  8334. the input stream and store it in l.
  8335.  
  8336.  
  8337.  
  8338.  
  8339.  
  8340.  
  8341.  
  8342.  
  8343.  
  8344.  
  8345.  
  8346.  
  8347.  
  8348.  
  8349.  
  8350.  
  8351.  
  8352.  
  8353.  
  8354.  
  8355.  
  8356.  
  8357.  
  8358.  
  8359.  
  8360.  
  8361.  
  8362.  
  8363.  
  8364.  
  8365.  
  8366.  
  8367.  
  8368.  
  8369. Rogue Wave      Tools.h++ Class Library                  313
  8370.  
  8371.  
  8372.  
  8373.  
  8374.  
  8375.  
  8376.  
  8377.  
  8378.                       CLASS REFERENCE
  8379.  
  8380.  
  8381.  
  8382. class RWpostream                                     RWpostream
  8383.                                                          |
  8384.                                                      RWvostream
  8385.                                                          |
  8386.                                                         ios
  8387.  
  8388.                                             (V2.X style iostreams, only)
  8389.  
  8390. Synopsis  #include <pstream.h>
  8391.  
  8392.           // Construct a RWpostream, using cout's streambuf:
  8393.           RWBostream pstr(cout);
  8394.  
  8395.  
  8396.  
  8397. Descripti Class RWpostream specializes the abstract base class RWvostream
  8398. on        to store variables in a portable ASCII format.  The results can
  8399.           be restored by using its counterpart RWpistream.
  8400.           You can think of RWpistream and RWpostream as an ASCII veneer
  8401.           over an associated streambuf which are responsbile for
  8402.           formatting variables and escaping characters such that the
  8403.           results can be interchanged between any machines.  As such,
  8404.           they are slower than their binary counterparts RWbistream and
  8405.           RWbostream which are more machine dependent.  Because
  8406.           RWpistream and RWpostream retain no information about the
  8407.           state of their associated streambufs, their use can be freely
  8408.           exchanged with other users of the streambuf (such as istream
  8409.           or ifstream).
  8410.           Class RWpostream will escape any special characters such as
  8411.           tabs or newlines such that they will be read in correctly by
  8412.           RWpistream.
  8413.           Note that variables should not be separated with whitespace.
  8414.           Such whitespace would be interpreted literally and would have
  8415.           to be read back in as a character string.
  8416.           Storage is independent of whether the compiler is using AT&T
  8417.           V1.2 style "streams", or the newer V2.X style "iostreams" --
  8418.           the user need not be concerned with which style is actually
  8419.           being used.  See class RWvostream for details.
  8420.           RWpostream can be interrogated as to the stream state using
  8421.           member functions good(), bad(), eof(), etc.
  8422.  
  8423.  
  8424.  
  8425. Rogue Wave      Tools.h++ Class Library                  314
  8426.  
  8427.  
  8428.  
  8429.  
  8430.  
  8431.  
  8432.  
  8433.  
  8434.                       CLASS REFERENCE
  8435.  
  8436. Example   This example assumes that V2.X style "iostreams" are being used.
  8437.           See RWpistream for an example of how to read back in the results of
  8438.           this program.  The symbol "o" is intended to represent a control-G,
  8439.           or bell.
  8440.           #include <pstream.h>
  8441.  
  8442.           main()
  8443.           {
  8444.             // Construct a RWpostream to use standard output:
  8445.             RWpostream pstr(cout);
  8446.  
  8447.             int i = 5;
  8448.             float f = 22.1;
  8449.             double d = -0.05;
  8450.  
  8451.             char string[]
  8452.                     = "A string with\ttabs,\nnewlines and a o bell.";
  8453.  
  8454.             pstr << i; // Store an int in binary
  8455.             pstr << f << d;     // Store a float & double
  8456.             pstr << string;     // Store a string
  8457.           }
  8458.  
  8459.           Program output:
  8460.             5
  8461.             22.1
  8462.             -0.05
  8463.             "A string with\ttabs,\nnewlines and a \x07 bell."
  8464.  
  8465.  
  8466.  
  8467. Public    RWpostream(streambuf* s);
  8468. construct Initialize a RWpostream from the streambuf s.
  8469. ors
  8470.  
  8471.    RWpostream(ostream& str);
  8472. Initialize a RWpostream from the streambuf associated with the
  8473. output stream str.
  8474.  
  8475.  
  8476.  
  8477.  
  8478.  
  8479.  
  8480.  
  8481. Rogue Wave      Tools.h++ Class Library                  315
  8482.  
  8483.  
  8484.  
  8485.  
  8486.  
  8487.  
  8488.  
  8489.  
  8490.                       CLASS REFERENCE
  8491.  
  8492.  
  8493. Public    virtual RWvostream& operator<<(const char* s);
  8494. member    Redefined from class RWvostream.  Store the character string
  8495. functions starting at s to the output stream using a portable format.
  8496.           The character string is expected to be null terminated.
  8497.  
  8498.    virtual RWvostream&    operator<<(char c);
  8499. Redefined from class RWvostream.  Store the char c to the output
  8500. stream using a portable format.  Note that c is treated as a
  8501. character, not a number.
  8502.  
  8503.    virtual RWvostream&    operator<<(unsigned char c);
  8504. Redefined from class RWvostream.  Store the unsigned char c to the
  8505. output stream using a portable format.  Note that c is treated as a
  8506. character, not a number.
  8507.  
  8508.    virtual RWvostream&    operator<<(double d);
  8509. Redefined from class RWvostream.  Store the double d to the output
  8510. stream using a portable format.
  8511.  
  8512.    virtual RWvostream&    operator<<(float f);
  8513. Redefined from class RWvostream.  Store the float f to the output
  8514. stream using a portable format.
  8515.  
  8516.    virtual RWvostream&    operator<<(int i);
  8517. Redefined from class RWvostream.  Store the int i to the output
  8518. stream using a portable format.
  8519.  
  8520.    virtual RWvostream&    operator<<(unsigned int i);
  8521. Redefined from class RWvostream.  Store the unsigned int i to the
  8522. output stream using a portable format.
  8523.  
  8524.    virtual RWvostream&    operator<<(long l);
  8525. Redefined from class RWvostream.  Store the long l to the output
  8526. stream using a portable format.
  8527.  
  8528.    virtual RWvostream&    operator<<(unsigned long l);
  8529. Redefined from class RWvostream.  Store the unsigned long l to the
  8530. output stream using a portable format.
  8531.  
  8532.    virtual RWvostream&    operator<<(short s);
  8533. Redefined from class RWvostream.  Store the short s to the output
  8534. stream using a portable format.
  8535.  
  8536.  
  8537. Rogue Wave      Tools.h++ Class Library                  316
  8538.  
  8539.  
  8540.  
  8541.  
  8542.  
  8543.  
  8544.  
  8545.  
  8546.                       CLASS REFERENCE
  8547.  
  8548.    virtual RWvostream&    operator<<(unsigned short s);
  8549. Redefined from class RWvostream.  Store the unsigned short s to the
  8550. output stream using a portable format.
  8551.  
  8552.    virtual RWvostream&    put(char c);
  8553. Redefined from class RWvostream.  Store the character c to the
  8554. output stream, preserving its value using a portable format.
  8555.  
  8556.    virtual RWvostream&    put(unsigned char c);
  8557. Redefined from class RWvostream.  Store the character c to the
  8558. output stream, preserving its value using a portable format.
  8559.  
  8560.    virtual RWvostream&    put(const char* p, unsigned N);
  8561. Redefined from class RWvostream.  Store the vector of chars starting
  8562. at p to the output stream using a portable format.  The characters
  8563. should be treated as literal numbers (i.e., not as a character
  8564. string).
  8565.  
  8566.    virtual RWvostream&    put(const unsigned char* p, unsigned N);
  8567. Redefined from class RWvostream.  Store the vector of unsigned chars
  8568. starting at p to the output stream using a portable format.  The
  8569. characters should be treated as literal numbers (i.e., not as a
  8570. character string).
  8571.  
  8572.    virtual RWvostream&    put(const short* p, unsigned N);
  8573. Redefined from class RWvostream.  Store the vector of shorts
  8574. starting at p to the output stream using a portable format.
  8575.  
  8576.    virtual RWvostream&    put(const unsigned short* p, unsigned N);
  8577. Redefined from class RWvostream.  Store the vector of unsigned
  8578. shorts starting at p to the output stream using a portable format.
  8579.  
  8580.    virtual RWvostream&    put(const int* p, unsigned N);
  8581. Redefined from class RWvostream.  Store the vector of ints starting
  8582. at p to the output stream using a portable format.
  8583.  
  8584.    virtual RWvostream&    put(const unsigned int* p, unsigned N);
  8585. Redefined from class RWvostream.  Store the vector of unsigned ints
  8586. starting at p to the output stream using a portable format.
  8587.  
  8588.    virtual RWvostream&    put(const long* p, unsigned N);
  8589. Redefined from class RWvostream.  Store the vector of longs starting
  8590. at p to the output stream using a portable format.
  8591.  
  8592.  
  8593. Rogue Wave      Tools.h++ Class Library                  317
  8594.  
  8595.  
  8596.  
  8597.  
  8598.  
  8599.  
  8600.  
  8601.  
  8602.                       CLASS REFERENCE
  8603.  
  8604.    virtual RWvostream&    put(const unsigned long* p, unsigned N);
  8605. Redefined from class RWvostream.  Store the vector of unsigned longs
  8606. starting at p to the output stream using a portable format.
  8607.  
  8608.    virtual RWvostream&    put(const float* p, unsigned N);
  8609. Redefined from class RWvostream.  Store the vector of floats
  8610. starting at p to the output stream using a portable format.
  8611.  
  8612.    virtual RWvostream&    put(const double* p, unsigned N);
  8613. Redefined from class RWvostream.  Store the vector of doubles
  8614. starting at p to the output stream using a portable format.
  8615.  
  8616.  
  8617.  
  8618.  
  8619.  
  8620.  
  8621.  
  8622.  
  8623.  
  8624.  
  8625.  
  8626.  
  8627.  
  8628.  
  8629.  
  8630.  
  8631.  
  8632.  
  8633.  
  8634.  
  8635.  
  8636.  
  8637.  
  8638.  
  8639.  
  8640.  
  8641.  
  8642.  
  8643.  
  8644.  
  8645.  
  8646.  
  8647.  
  8648.  
  8649. Rogue Wave      Tools.h++ Class Library                  318
  8650.  
  8651.  
  8652.  
  8653.  
  8654.  
  8655.  
  8656.  
  8657.  
  8658.                       CLASS REFERENCE
  8659.  
  8660.  
  8661.  
  8662. class RWRegexp
  8663.  
  8664.  
  8665.  
  8666.  
  8667.  
  8668. Synopsis  #include <regexp.h>
  8669.  
  8670.           RWRegexp re(".*\.doc");    // Matches filename with suffix ".doc"
  8671.  
  8672.  
  8673.  
  8674. Descripti Class RWRegexp represents a regular expression.  The constructor
  8675. on        "compiles" the expression into a form that can be used more
  8676.           efficiently.  The results can then be used for string searches
  8677.           using class RWString.
  8678.           The regular expression (RE) is constucted as follows:
  8679.           The following rules determine one-character REs that match a
  8680.           single character:
  8681.           1.1Any character that is not a special character (to be
  8682.              defined) matches itself.
  8683.           1.2A backslash (\) followed by any special character matches
  8684.              the literal character itself.  I.e., this "escapes" the
  8685.              special character.
  8686.           1.3The "special characters" are:
  8687.                +    *    ?    .    [    ]    ^    $
  8688.           1.4The period (.) matches any character except the newline.
  8689.              E.g., ".umpty" matches either "Humpty" or "Dumpty".
  8690.           1.5A set of characters enclosed in brackets ([]) is a one-
  8691.              character RE that matches any of the characters in that
  8692.              set.  E.g., "[akm]" matches either an "a", "k", or "m".  A
  8693.              range of characters can be indicated with a dash.  E.g.,
  8694.              "[a-z]" matches any lower-case letter.  However, if the
  8695.              first character of the set is the caret (^), then the RE
  8696.              matches any character except those in the set.  It does
  8697.              not match the empty string.  Example: [^akm] matches any
  8698.              character except  "a", "k", or "m".  The caret loses its
  8699.              special meaning if it is not the first character of the
  8700.              set.
  8701.           The following rules can be used to build a multicharacter RE.
  8702.           2.1A one-character RE followed by an asterisk (*) matches
  8703.              zero or more occurrences of the RE.  Hence, [a-z]* matches
  8704.  
  8705. Rogue Wave      Tools.h++ Class Library                  319
  8706.  
  8707.  
  8708.  
  8709.  
  8710.  
  8711.  
  8712.  
  8713.  
  8714.                       CLASS REFERENCE
  8715.  
  8716.              zero or more lower-case characters.
  8717.           2.2A one-character RE followed by a plus (+) matches one or
  8718.              more occurrences of the RE.  Hence, [a-z]+ matches one or
  8719.              more lower-case characters.
  8720.           2.3A question mark (?) is an optional element.  The
  8721.              preceeding RE can occur zero or once in the string -- no
  8722.              more.  E.g. xy?z matches either xyz or xz.
  8723.           2.4The concatenation of REs is a RE that matches the
  8724.              corresponding concatenation of strings.  E.g., [A-Z][a-z]*
  8725.              matches any capitalized word.
  8726.           Finally, the entire regular expression can be anchored to
  8727.           match only the beginning or end of a line:
  8728.           3.1If the caret (^) is at the beginning of the RE, then the
  8729.              matched string must be at the beginning of a line.
  8730.           3.2If the dollar sign ($) is at the end of the RE, then the
  8731.              matched string must be at the end of the line.
  8732.           The following escape codes can be used to match control
  8733.           characters:
  8734.                \b   backspace
  8735.                \e   ESC (escape)
  8736.                \f   formfeed
  8737.                \n   newline
  8738.                \r   carriage return
  8739.                \t   tab
  8740.                \xdddthe literal hex number 0xddd
  8741.                \^C  Control code.  E.g. \^D is "control-D"
  8742.  
  8743.  
  8744.  
  8745.  
  8746.  
  8747.  
  8748.  
  8749.  
  8750.  
  8751.  
  8752.  
  8753.  
  8754.  
  8755.  
  8756.  
  8757.  
  8758.  
  8759.  
  8760.  
  8761. Rogue Wave      Tools.h++ Class Library                  320
  8762.  
  8763.  
  8764.  
  8765.  
  8766.  
  8767.  
  8768.  
  8769.  
  8770.                       CLASS REFERENCE
  8771.  
  8772. Example   #include <regexp.h>
  8773.           #include <rwstring.h>
  8774.           #include <rstream.h>
  8775.  
  8776.           main()
  8777.           {
  8778.             RWString aString("Hark! Hark! the lark");
  8779.  
  8780.             // A regular expression matching any lower-case word
  8781.             // starting with "l":
  8782.             RWRegexp reg("l[a-z]*");
  8783.  
  8784.             cout << aString(reg) << NL;               // Prints "lark"
  8785.           }
  8786.  
  8787.  
  8788.  
  8789. Public    RWRegexp(const char* pat);
  8790. construct Construct a regular expression from the pattern given by pat.
  8791. ors       The status of the results can be found by using member
  8792.           function status().
  8793.  
  8794.    RWRegexp(const RWRegexp& r);
  8795. Copy constructor.  Uses value semantics -- self will be a copy of r.
  8796.  
  8797.    ~RWRegexp();
  8798. Destructor.  Releases any allocated memory.
  8799.  
  8800.  
  8801. Assignmen RWRegexp&           operator=(const RWRegexp&);
  8802. t         Uses value semantics -- sets self to a copy of r.
  8803. operators
  8804.  
  8805.    RWRegexp&        operator=(const char* pat);
  8806. Recompiles self to the pattern given by pat.  The status of the
  8807. results can be found by using member function status().
  8808.  
  8809.  
  8810.  
  8811.  
  8812.  
  8813.  
  8814.  
  8815.  
  8816.  
  8817. Rogue Wave      Tools.h++ Class Library                  321
  8818.  
  8819.  
  8820.  
  8821.  
  8822.  
  8823.  
  8824.  
  8825.  
  8826.                       CLASS REFERENCE
  8827.  
  8828.  
  8829. Public    int         index(const RWString& str, int* len, int start=0) const;
  8830. member    Returns the index of the first instance in the string str that
  8831. functions matches the regular expression compiled in self.  The search
  8832.           starts at index start.  The length of the matching pattern is
  8833.           returned in the int pointed to by len.  If the library has
  8834.           been compiled with the DEBUG flag and an invalid regular
  8835.           expression is used for the search, an exception with error
  8836.           code TOOL_BADRE will be thrown.  Otherwise, the results are
  8837.           undefined.  Note that this member function is relatively
  8838.           clumsy to use -- class RWString offers a better interface to
  8839.           regular expression searches.
  8840.  
  8841.    statVal  status();
  8842. Returns the status of the regular expression:
  8843.  
  8844.                statVal             Meaning
  8845.                RWRegexp::OK        No errors
  8846.                RWRegexp::ILLEG     Pattern was illegal
  8847.                AL
  8848.                RWRegexp::TOOLO     Pattern exceeded
  8849.                NG                  maximum length
  8850.  
  8851.  
  8852.  
  8853.  
  8854.  
  8855.  
  8856.  
  8857.  
  8858.  
  8859.  
  8860.  
  8861.  
  8862.  
  8863.  
  8864.  
  8865.  
  8866.  
  8867.  
  8868.  
  8869.  
  8870.  
  8871.  
  8872.  
  8873. Rogue Wave      Tools.h++ Class Library                  322
  8874.  
  8875.  
  8876.  
  8877.  
  8878.  
  8879.  
  8880.  
  8881.  
  8882.                       CLASS REFERENCE
  8883.  
  8884.  
  8885.  
  8886. class RWSequenceable                                          RWSequenceable
  8887.                                                                     |
  8888.                                                                RWCollection
  8889.                                                                     |
  8890.                                                               RWCollectable
  8891.  
  8892.  
  8893. Synopsis  #include <seqcltn.h>
  8894.  
  8895.         typedef RWSequenceable SequenceableCollection;    // Smalltalk typedef
  8896.  
  8897.  
  8898.  
  8899. Descripti Class RWSequenceable is an abstract base class for collections that
  8900. on        can be accessed via an index.  It inherits class RWCollection as a
  8901.           public base class and adds a few extra virtual functions.  This
  8902.           documentation only describes these extra functions.
  8903.  
  8904. Public    RWCollectable*          append(RWCollectable*) = 0;
  8905. member    Adds the item to the end of the collection and returns it.  Returns
  8906. functions nil if the insertion was unsuccessful.
  8907.  
  8908.    virtual RWCollectable*&at(int i);
  8909. Allows access to the i'th element of the collection.  If i is out of
  8910. range then an exception with error TOOL_INDEX will occur.  This
  8911. variant can be used as an lvalue.
  8912.  
  8913.    virtual const RWCollectable                       *  at(int i) const;
  8914. Allows access to the i'th element of the collection.  If i is out of
  8915. range then nil is returned.
  8916.  
  8917.    virtual         RWCollectable*   first() const = 0;
  8918. Returns the first item in the collection.
  8919.  
  8920.    virtual         int        index(const RWCollectable* c) const = 0;
  8921. Returns the index number of the first item that "matches" the item
  8922. pointed to by c.  If there is no such item, returns _1.  For most
  8923. collections, an item "matches" the target if either isEqual() or
  8924. compareTo() find equivalence, whichever is appropriate for the
  8925. actual collection type.
  8926.  
  8927.  
  8928.  
  8929. Rogue Wave      Tools.h++ Class Library                  323
  8930.  
  8931.  
  8932.  
  8933.  
  8934.  
  8935.  
  8936.  
  8937.  
  8938.                       CLASS REFERENCE
  8939.  
  8940.    virtual         RWCollectable*   insertAfter(int i, RWCollectable* c) = 0;
  8941. Inserts and returns the object pointed to by c after the item at
  8942. index i.  Returns nil if the insertion was unsuccessful.
  8943.  
  8944.    virtual         RWCollectable*   last() const = 0;
  8945. Returns the last item in the collection.
  8946.  
  8947.    RWCollectable*   prepend(RWCollectable*) = 0;
  8948. Adds the item to the beginning of the collection and returns it.
  8949. Returns nil if the insertion was unsuccessful.
  8950.  
  8951.  
  8952.  
  8953.  
  8954.  
  8955.  
  8956.  
  8957.  
  8958.  
  8959.  
  8960.  
  8961.  
  8962.  
  8963.  
  8964.  
  8965.  
  8966.  
  8967.  
  8968.  
  8969.  
  8970.  
  8971.  
  8972.  
  8973.  
  8974.  
  8975.  
  8976.  
  8977.  
  8978.  
  8979.  
  8980.  
  8981.  
  8982.  
  8983.  
  8984.  
  8985. Rogue Wave      Tools.h++ Class Library                  324
  8986.  
  8987.  
  8988.  
  8989.  
  8990.  
  8991.  
  8992.  
  8993.  
  8994.                       CLASS REFERENCE
  8995.  
  8996.  
  8997.  
  8998. class RWSet                                           RWSet
  8999.                                                         |
  9000.                                                    RWCollection
  9001.                                                         |
  9002.                                                   RWCollectable
  9003.  
  9004. Synopsis  typedef RWSet Set;         // Smalltalk typedef.
  9005.           #include <rwset.h>
  9006.  
  9007.           RWSet h;
  9008.  
  9009.  
  9010.  
  9011. Descripti Class RWSet represents a group of unordered elements, not
  9012. on        accessible by an external key, where duplicates are not allowed.
  9013.           It corresponds to the Smalltalk class Set.
  9014.           An object stored by RWSet must inherit abstract base class
  9015.           RWCollectable, with suitable definition for virtual functions
  9016.           hash() and isEqual() (see class RWCollectable).  The function
  9017.           hash() is used to find objects with the same hash value, then
  9018.           isEqual() is used to confirm the match.
  9019.           An item c is considered to be "already in the collection" if
  9020.           there is a member of the collection for which isEqual(c)
  9021.           returns TRUE.  In this case, the message insert(c) will not
  9022.           add it, thus insuring that there are no duplicates.
  9023.           The iterator for this class is RWSetIterator.
  9024.  
  9025. Public    RWSet (unsigned n = 101);
  9026. construct An empty hash table is constructed with a size that is the
  9027. ors       next highest prime number that is greater than or equal to
  9028.           n.
  9029.  
  9030.    RWSet (const RWSet & h);
  9031. Copy constructor.  Makes a shallow copy of the collection h.
  9032.  
  9033.    virtual          ~RWSet();
  9034. Calls clear().
  9035.  
  9036.  
  9037.  
  9038.  
  9039.  
  9040.  
  9041. Rogue Wave      Tools.h++ Class Library                  325
  9042.  
  9043.  
  9044.  
  9045.  
  9046.  
  9047.  
  9048.  
  9049.  
  9050.                       CLASS REFERENCE
  9051.  
  9052.  
  9053. Public    void                operator=(const RWSet& h);
  9054. member    Assignment operator.  Makes a shallow copy of the collection h.
  9055. operators
  9056.           RWBoolean           operator==(const RWSet& h);
  9057.           Returns TRUE if self and a have the same number of elements and
  9058.           if for every key in self there is a corresponding key in h which
  9059.           isEqual.
  9060.  
  9061.    RWBoolean        operator!=(const RWSet& h);
  9062. Returns the negation of operator==(), above.
  9063.  
  9064.    RWBoolean        operator<=(const RWSet& h);
  9065. Returns TRUE  if self is a subset of h, that is, every element of
  9066. self has a counterpart in h which isEqual.
  9067.  
  9068.  
  9069. Public    virtual void        apply(applyCollectable ap, void*)
  9070. member    Redefined from class RWCollection to apply the user-supplied
  9071. functions function pointed to by ap to each member of the collection in a
  9072.           (generally) unpredictable order.  This supplied function should
  9073.           not do anything to the items that could change the ordering of
  9074.           the collection.
  9075.  
  9076.    virtual unsigned binaryStoreSize() const;
  9077. Inherited from class RWCollection.
  9078.  
  9079.    virtual void     clear();
  9080. Redefined from class RWCollection.
  9081.  
  9082.    virtual void     clearAndDestroy();
  9083. Inherited from class RWCollection.
  9084.  
  9085.    virtual int      compareTo(const RWCollectable* a) const;
  9086. Inherited from class RWCollectable.
  9087.  
  9088.    virtual RWBoolean      contains(const RWCollectable* target) const;
  9089. Inherited from class RWCollection.
  9090.  
  9091.    virtual unsigned entries() const;
  9092. Redefined from class RWCollection.
  9093.  
  9094.    virtual         RWCollectable*   find(const RWCollectable* target) const;
  9095. Redefined from class RWCollection.  Returns the item in self which
  9096.  
  9097. Rogue Wave      Tools.h++ Class Library                  326
  9098.  
  9099.  
  9100.  
  9101.  
  9102.  
  9103.  
  9104.  
  9105.  
  9106.                       CLASS REFERENCE
  9107.  
  9108. isEqual to the item pointed to by target or nil if no item is found.
  9109. Hashing is used to narrow the search.
  9110.  
  9111.    virtual unsigned hash() const;
  9112. Inherited from class RWCollectable.
  9113.  
  9114.    virtual         RWCollectable*   insert(RWCollectable* c);
  9115. Redefined from class RWCollection.  Adds c to the collection and
  9116. returns it.  If an item is already in the collection which isEqual
  9117. to c, then the old item is returned and the new item is not
  9118. inserted.
  9119.  
  9120.    virtual ClassID  isA() const;
  9121. Redefined from class RWCollectable to return __RWSET.
  9122.  
  9123.    virtual RWBoolean      isEmpty() const;
  9124. Redefined from class RWCollection.
  9125.  
  9126.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  9127. Inherited from class RWCollectable.
  9128.  
  9129.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  9130. Redefined from class RWCollection.  Returns the number of entries
  9131. that isEqual to the item pointed to by target.  Because duplicates
  9132. are not allowed for this collection, only 0 or 1 can be returned.
  9133.  
  9134.    virtual         RWCollectable*   remove(const RWCollectable* target);
  9135. Redefined from class RWCollection.  Returns and removes the item
  9136. that isEqual to the item pointed to by target, or nil if there is no
  9137. item.
  9138.  
  9139.    virtual         void       removeAndDestroy(const RWCollectable* target);
  9140. Inherited from class RWCollection.
  9141.  
  9142.    void             resize(unsigned n = 0);
  9143. Resizes the internal hashing table to the next highest prime number
  9144. that is greater than or equal to n.  If n==0, then the next highest
  9145. prime number greater than or equal to the present size.
  9146.  
  9147.    virtual void     restoreGuts(RWvistream&);
  9148.    virtual void     restoreGuts(RWFile&);
  9149.    virtual void     saveGuts(RWvostream&) const;
  9150.    virtual void     saveGuts(RWFile&) const;
  9151. Inherited from class RWCollection.
  9152.  
  9153. Rogue Wave      Tools.h++ Class Library                  327
  9154.  
  9155.  
  9156.  
  9157.  
  9158.  
  9159.  
  9160.  
  9161.  
  9162.                       CLASS REFERENCE
  9163.  
  9164.    static        RWCollectable*    restoreFrom(RWvistream&);
  9165.    static        RWCollectable*    restoreFrom(RWFile&);
  9166.    void             saveOn(RWvostream&) const;
  9167.    void             saveOn(RWFile&) const;
  9168. Inherited from class RWCollectable.
  9169.  
  9170.  
  9171.  
  9172.  
  9173.  
  9174.  
  9175.  
  9176.  
  9177.  
  9178.  
  9179.  
  9180.  
  9181.  
  9182.  
  9183.  
  9184.  
  9185.  
  9186.  
  9187.  
  9188.  
  9189.  
  9190.  
  9191.  
  9192.  
  9193.  
  9194.  
  9195.  
  9196.  
  9197.  
  9198.  
  9199.  
  9200.  
  9201.  
  9202.  
  9203.  
  9204.  
  9205.  
  9206.  
  9207.  
  9208.  
  9209. Rogue Wave      Tools.h++ Class Library                  328
  9210.  
  9211.  
  9212.  
  9213.  
  9214.  
  9215.  
  9216.  
  9217.  
  9218.                       CLASS REFERENCE
  9219.  
  9220.  
  9221.  
  9222. class RWSetIterator                         RWSetIterator
  9223.                                                   |
  9224.                                              RWIterator
  9225.  
  9226.  
  9227.  
  9228. Synopsis  #include <rwset.h>
  9229.           RWSet h;
  9230.           RWSetIterator it(h);
  9231.  
  9232.  
  9233.  
  9234. Descripti Iterator for class RWSet, which allows sequential access to all
  9235. on        the elements of RWSet.  Note that because a RWSet is unordered,
  9236.           elements are not accessed in any particular order.
  9237.  
  9238. Public    RWSetIterator(RWSet&);
  9239. construct Construct an iterator for an RWSet.  After construction, the
  9240. or        position of the iterator is undefined.
  9241.  
  9242.  
  9243. Public    virtual                RWCollectable*      operator()();
  9244. member    Redefined from class RWIterator.  Advances the iterator to the
  9245. operator  next item and returns it. Returns nil when the end of the
  9246.           collection is reached.
  9247.  
  9248.  
  9249. Public    virtual RWCollectable*      findNext(const RWCollectable* target);
  9250. member    Redefined from class RWIterator.  Moves iterator to the next
  9251. functions item which isEqual to the item pointed to by target and returns
  9252.           it.  Hashing is used to find the target.  If no item is found,
  9253.           returns nil and the position of the iterator will be undefined.
  9254.  
  9255.    virtual         RWCollectable*   key() const;
  9256. Redefined from class RWIterator.  Returns the item at the current
  9257. iterator position.
  9258.  
  9259.    RWCollectable*   remove();
  9260. Remove the item at the current iterator position from the
  9261. collection.
  9262.  
  9263.  
  9264.  
  9265. Rogue Wave      Tools.h++ Class Library                  329
  9266.  
  9267.  
  9268.  
  9269.  
  9270.  
  9271.  
  9272.  
  9273.  
  9274.                       CLASS REFERENCE
  9275.  
  9276.    RWCollectable*   removeNext(const RWCollectable*);
  9277. Moves the iterator to the next item which isEqual to the item
  9278. pointed to by target, removes it from the collection and returns it.
  9279. Hashing is used to find the target.  If no item is found, returns
  9280. nil and the position of the iterator will be undefined.
  9281.  
  9282.    virtual         void       reset();
  9283. Redefined from class RWIterator.  Resets the iterator to its
  9284. starting state.
  9285.  
  9286.  
  9287.  
  9288.  
  9289.  
  9290.  
  9291.  
  9292.  
  9293.  
  9294.  
  9295.  
  9296.  
  9297.  
  9298.  
  9299.  
  9300.  
  9301.  
  9302.  
  9303.  
  9304.  
  9305.  
  9306.  
  9307.  
  9308.  
  9309.  
  9310.  
  9311.  
  9312.  
  9313.  
  9314.  
  9315.  
  9316.  
  9317.  
  9318.  
  9319.  
  9320.  
  9321. Rogue Wave      Tools.h++ Class Library                  330
  9322.  
  9323.  
  9324.  
  9325.  
  9326.  
  9327.  
  9328.  
  9329.  
  9330.                       CLASS REFERENCE
  9331.  
  9332.  
  9333.  
  9334. class RWSlistCollectables                  RWSlistCollectables
  9335.                                              |         |
  9336.                                         RWSequenceableRWSlist
  9337.                                              |
  9338.                                         RWCollection
  9339.                                              |
  9340.                                         RWCollectable
  9341.  
  9342.  
  9343. Synopsis  typedef RWSlistCollectables LinkedList;
  9344.  
  9345.           // Smalltalk typedef
  9346.  
  9347.           #include <slistcol.h>
  9348.           RWSlistCollectables a;
  9349.  
  9350.  
  9351.  
  9352. Descripti Class RWSlistCollectables represents a group of ordered elements,
  9353. on        without keyed access.  Duplicates are allowed.   The ordering of
  9354.           elements is determined externally, by the order of insertion and
  9355.           removal.  An object stored by RWSlistCollectables must inherit
  9356.           abstract base class RWCollectable.
  9357.           The virtual function isEqual() (see class RWCollectable) is
  9358.           required to find a match between a target and an item in the
  9359.           collection
  9360.           Class RWSlistCollectables is implemented as a singly-linked
  9361.           list, which allows for efficient insertion and removal, but
  9362.           efficient movement in only one direction.  This class
  9363.           corresponds to the Smalltalk class LinkedList.
  9364.  
  9365. Public    RWSlistCollectables();
  9366. construct Constructs an empty linked list.
  9367. ors
  9368.  
  9369.    RWSlistCollectables(const RWCollectable* a);
  9370. Constructs an ordered collection with single item a.
  9371.  
  9372.  
  9373.  
  9374.  
  9375.  
  9376.  
  9377. Rogue Wave      Tools.h++ Class Library                  331
  9378.  
  9379.  
  9380.  
  9381.  
  9382.  
  9383.  
  9384.  
  9385.  
  9386.                       CLASS REFERENCE
  9387.  
  9388.  
  9389. Public    RWBoolean           operator==(const RWSlistCollectables& s) const;
  9390. member    Returns TRUE if self and s have the same number of members and
  9391. operators if for every item in self, the corresponding item at the same
  9392.           index in s isEqual to it.
  9393.  
  9394.  
  9395. Public    virtual                RWCollectable*      append(RWCollectable*);
  9396. member    Redefined from RWSequenceable.  Inserts the item at the end of
  9397. functions the collection and returns it.  Returns nil if the insertion was
  9398.           unsuccesful.
  9399.  
  9400.    virtual void     apply(applyCollectable ap, void*)
  9401. Redefined from class RWCollection.    This function has been
  9402. redefined to apply the user-defined function pointed to by ap to
  9403. each member of the collection, in order, from first to last.
  9404.  
  9405.    virtual RWCollectable*&at(int i);
  9406.    virtual const RWCollectable*                          at(int i) const;
  9407. Redefined from class RWSequenceable.  Note that for a linked-list,
  9408. these functions must traverse all the links, making them not
  9409. particularly efficient.
  9410.  
  9411.    virtual unsigned binaryStoreSize() const;
  9412. Inherited from class RWCollection.
  9413.  
  9414.    virtual void     clear();
  9415. Redefined from class RWCollection.
  9416.  
  9417.    virtual void     clearAndDestroy();
  9418. Inherited from class RWCollection.
  9419.  
  9420.    virtual int      compareTo(const RWCollectable* a) const;
  9421. Inherited from class RWCollectable.
  9422.  
  9423.    virtual RWBoolean      contains(const RWCollectable* target) const;
  9424. Inherited from class RWCollection.
  9425.  
  9426.    RWBoolean        containsReference(const RWCollectable* e) const;
  9427. Returns true if the list contains an item that is identical to the
  9428. item pointed to by e (that is, that has the address e).
  9429.  
  9430.    virtual unsigned entries() const;
  9431. Redefined from class RWCollection.
  9432.  
  9433. Rogue Wave      Tools.h++ Class Library                  332
  9434.  
  9435.  
  9436.  
  9437.  
  9438.  
  9439.  
  9440.  
  9441.  
  9442.                       CLASS REFERENCE
  9443.  
  9444.    virtual         RWCollectable*   find(const RWCollectable* target) const;
  9445. Redefined from class RWCollection.  The first item that matches
  9446. target is returned, or nil if no item was found.
  9447.  
  9448.    RWCollectable*   findReference(const RWCollectable* e) const;
  9449. Returns the first item that is identical to the item pointed to by e
  9450. (that is, that has the address e), or nil if none is found.
  9451.  
  9452.    virtual         RWCollectable*   first() const;
  9453. Redefined from class RWSequenceable.  Returns the item at the
  9454. beginning of the list.
  9455.  
  9456.    RWCollectable*   get();
  9457. Returns and removes the item at the beginning of the list.
  9458.  
  9459.    virtual unsigned hash() const;
  9460. Inherited from class RWCollectable.
  9461.  
  9462.    virtual int      index(const RWCollectable* c) const = 0;
  9463. Redefined from class RWSequenceable.  Returns the index of the first
  9464. item that isEqual to the item pointed to by c.
  9465.  
  9466.    virtual         RWCollectable*   insert(RWCollectable* c);
  9467. Redefined from class RWCollection.  Adds the item to the end of the
  9468. collection and returns it.  Returns nil if the insertion was
  9469. unsuccessful.
  9470.  
  9471.    virtual         RWCollectable*   insertAfter(int i, RWCollectable* c);
  9472. Redefined from class RWSequenceable.  Inserts and returns the object
  9473. pointed to by c after the item at index i.  Returns nil if the
  9474. insertion was unsuccessful.
  9475.  
  9476.    virtual         ClassID    isA() const;
  9477. Redefined from class RWCollectable to return __RWSLISTCOLLECTABLES.
  9478.  
  9479.    virtual         RWBoolean  isEmpty() const;
  9480. Redefined from class RWCollection.
  9481.  
  9482.    virtual         RWCollectable*   last() const;
  9483. Redefined from class RWSequenceable.  Returns the value at the end
  9484. of the collection.
  9485.  
  9486.    virtual        unsigned   occurrencesOf(const RWCollectable* target) const;
  9487. Redefined from class RWCollection.  Returns the number of items that
  9488.  
  9489. Rogue Wave      Tools.h++ Class Library                  333
  9490.  
  9491.  
  9492.  
  9493.  
  9494.  
  9495.  
  9496.  
  9497.  
  9498.                       CLASS REFERENCE
  9499.  
  9500. isEqual to the item pointed to by target.
  9501.  
  9502.    unsigned    occurrencesOfReference(const RWCollectable* e) const;
  9503. Returns the number of items that are identical to the item pointed
  9504. to by e (that is, that have the address e).
  9505.  
  9506.    virtual         RWCollectable*   prepend(RWCollectable*);
  9507. Redefined from class RWSequenceable.  Adds the item to the beginning
  9508. of the collection and returns it.  Returns nil if the insertion was
  9509. unsuccessful.
  9510.  
  9511.    virtual         RWCollectable*   remove(const RWCollectable* target);
  9512. Redefined from class RWCollection.  Removes and returns the first
  9513. item that isEqual to the item pointed to by target.  Returns nil if
  9514. there is no such item.
  9515.  
  9516.    virtual void     removeAndDestroy(const RWCollectable* target);
  9517. Inherited from class RWCollection.
  9518.  
  9519.    RWCollectable*   removeReference(const RWCollectable* e);
  9520. Removes and returns the first item that is identical to the item
  9521. pointed to by e (that is, that has the address e).  Returns nil if
  9522. there is no such item.
  9523.  
  9524.  
  9525.  
  9526.  
  9527.  
  9528.  
  9529.  
  9530.  
  9531.  
  9532.  
  9533.  
  9534.  
  9535.  
  9536.  
  9537.  
  9538.  
  9539.  
  9540.  
  9541.  
  9542.  
  9543.  
  9544.  
  9545. Rogue Wave      Tools.h++ Class Library                  334
  9546.  
  9547.  
  9548.  
  9549.  
  9550.  
  9551.  
  9552.  
  9553.  
  9554.                       CLASS REFERENCE
  9555.  
  9556.    virtual void     restoreGuts(RWvistream&);
  9557.    virtual void     restoreGuts(RWFile&);
  9558.    virtual void     saveGuts(RWvostream&) const;
  9559.    virtual void     saveGuts(RWFile&) const;
  9560. Inherited from class RWCollection.
  9561.  
  9562.    static        RWCollectable*    restoreFrom(RWvistream&);
  9563.    static        RWCollectable*    restoreFrom(RWFile&);
  9564.    void             saveOn(RWvostream&) const;
  9565.    void             saveOn(RWFile&) const;
  9566. Inherited from class RWCollectable.
  9567.  
  9568.  
  9569.  
  9570.  
  9571.  
  9572.  
  9573.  
  9574.  
  9575.  
  9576.  
  9577.  
  9578.  
  9579.  
  9580.  
  9581.  
  9582.  
  9583.  
  9584.  
  9585.  
  9586.  
  9587.  
  9588.  
  9589.  
  9590.  
  9591.  
  9592.  
  9593.  
  9594.  
  9595.  
  9596.  
  9597.  
  9598.  
  9599.  
  9600.  
  9601. Rogue Wave      Tools.h++ Class Library                  335
  9602.  
  9603.  
  9604.  
  9605.  
  9606.  
  9607.  
  9608.  
  9609.  
  9610.                       CLASS REFERENCE
  9611.  
  9612.  
  9613.  
  9614. class RWSlistCollectablesIterator     RWSlistCollectablesIterator
  9615.                                           |            |
  9616.                                        RWIteratorRWSlistIterator
  9617.  
  9618.  
  9619.  
  9620. Synopsis  // Smalltalk typedef.
  9621.           typedef RWSlistCollectablesIterator     LinkedListIterator;
  9622.  
  9623.           #include <slistcol.h>
  9624.  
  9625.           RWSlistCollectables sc;
  9626.           RWSlistCollectablesIterator sci(sc);
  9627.  
  9628.  
  9629.  
  9630. Descripti Iterator for class RWSlistCollectables. Traverses the linked-list
  9631. on        from the first to last item.
  9632.  
  9633. Public    RWSlistCollectablesIterator (RWSlistCollectables&);
  9634. construct Constructs an iterator from a singly-linked list.  Immediately
  9635. or        after construction, the iterator is positioned at the last link.
  9636.  
  9637.  
  9638. Public    virtual                RWCollectable*      operator()();
  9639. member    Redefined from class RWIterator.  Advances the iterator to the
  9640. operators next element and returns it. Returns nil when the end of the
  9641.           collection is reached.
  9642.  
  9643.    void             operator++();
  9644. Advances the iterator one item.  This operator wraps around to the
  9645. beginning of the list.
  9646.  
  9647.    void             operator+=(int n);
  9648. Advances the iterator n items.  This operator wraps around to the
  9649. beginning of the list.
  9650.  
  9651.  
  9652.  
  9653.  
  9654.  
  9655.  
  9656.  
  9657. Rogue Wave      Tools.h++ Class Library                  336
  9658.  
  9659.  
  9660.  
  9661.  
  9662.  
  9663.  
  9664.  
  9665.  
  9666.                       CLASS REFERENCE
  9667.  
  9668.  
  9669. Public    RWBoolean           atFirst() const;
  9670. member    Returns TRUE if the iterator is at the beginning of the list,
  9671. functions otherwise FALSE;
  9672.  
  9673.           RWBoolean           atLast() const;
  9674.           Returns TRUE if the iterator is at the end of the list,
  9675.           otherwise FALSE;
  9676.  
  9677.    virtual         RWCollectable*   findNext(const RWCollectable* target);
  9678. Redefined from class RWIterator.  Moves iterator to the next item
  9679. which isEqual to the item pointed to by target and returns it.  If
  9680. no item is found, returns nil and the position of the iterator will
  9681. be undefined.
  9682.  
  9683.    RWCollectable*   findNextReference(const RWCollectable* e);
  9684. Moves iterator to the next item which is identical to the item
  9685. pointed to by e (that is, that has address e) and returns it.  If no
  9686. item is found, returns nil and the position of the iterator will be
  9687. undefined.
  9688.  
  9689.    RWCollectable*   insertAfterPoint(RWCollectable* a);
  9690. Insert item a after the current cursor position and return the item.
  9691. The cursor's position will be unchanged.
  9692.  
  9693.    virtual         RWCollectable*   key() const;
  9694. Redefined from class RWIterator.  Returns the item at the current
  9695. iterator position.
  9696.  
  9697.    RWCollectable*   remove();
  9698. Removes and returns the item at the current cursor position.
  9699. Afterwards, the iterator will be positioned at the next item in the
  9700. list.
  9701.  
  9702.    RWCollectable*   removeNext(const RWCollectable* target);
  9703. Moves iterator to the next item in the list which isEqual to the
  9704. item pointed to by target, removes it from the list and returns it.
  9705. Afterwards, the iterator will be positioned at the next item in the
  9706. list.  If no item is found, returns nil and the position of the
  9707. iterator will be undefined.
  9708.  
  9709.    RWCollectable*   removeNextReference(const RWCollectable* e);
  9710. Moves iterator to the next item in the list which is identical to
  9711. the item pointed to by e (that is, that has address e), removes it
  9712.  
  9713. Rogue Wave      Tools.h++ Class Library                  337
  9714.  
  9715.  
  9716.  
  9717.  
  9718.  
  9719.  
  9720.  
  9721.  
  9722.                       CLASS REFERENCE
  9723.  
  9724. from the list and returns it.  Afterwards, the iterator will be
  9725. positioned at the next item in the list.  If no item is found,
  9726. returns nil and the position of the iterator will be undefined.
  9727.  
  9728.    virtual void     reset();
  9729. Redefined from class RWIterator.  Resets the iterator.  Iterator
  9730. will be positioned at the last item in the list.
  9731.  
  9732.    void             toFirst();
  9733. Moves the iterator to the beginning of the list.
  9734.  
  9735.    void             toLast();
  9736. Moves the iterator to the end of the list.
  9737.  
  9738.  
  9739.  
  9740.  
  9741.  
  9742.  
  9743.  
  9744.  
  9745.  
  9746.  
  9747.  
  9748.  
  9749.  
  9750.  
  9751.  
  9752.  
  9753.  
  9754.  
  9755.  
  9756.  
  9757.  
  9758.  
  9759.  
  9760.  
  9761.  
  9762.  
  9763.  
  9764.  
  9765.  
  9766.  
  9767.  
  9768.  
  9769. Rogue Wave      Tools.h++ Class Library                  338
  9770.  
  9771.  
  9772.  
  9773.  
  9774.  
  9775.  
  9776.  
  9777.  
  9778.                       CLASS REFERENCE
  9779.  
  9780.  
  9781.  
  9782. class RWSlistCollectablesQueue        RWSlistCollectablesQueue
  9783.                                                  |
  9784.                                          RWSlistCollectables
  9785.                                            |           |
  9786.                                       RWSequenceableRWSlist
  9787.                                            |
  9788.                                       RWCollection
  9789.                                            |
  9790.                                       RWCollectable
  9791.  
  9792. Synopsis  // Smalltalk typedef:
  9793.           typedef RWSlistCollectablesQueue   Queue;
  9794.  
  9795.           #include <queuecol.h>
  9796.           RWSlistCollectablesQueue a;
  9797.  
  9798.  
  9799.  
  9800. Descripti Class RWSlistCollectablesQueue represents a restricted interface
  9801. on        to class RWSlistCollectables to implement a first in first out
  9802.           (FIFO) queue.  A Queue is a sequential list for which all
  9803.           insertions are made at one end (the "tail"), but all removals
  9804.           are made at the other end (the "head").  Hence, the ordering is
  9805.           determined externally by the ordering of the insertions.
  9806.           Duplicates are allowed.
  9807.           An object stored by RWSlistCollectablesQueue must inherit
  9808.           abstract base class RWCollectable.  The virtual function
  9809.           isEqual() (see class RWCollectable) is required to find a
  9810.           match between a target and an item in the queue.
  9811.           This class corresponds to the Smalltalk class Queue.
  9812.  
  9813. Public    RWSlistCollectablesQueue();
  9814. construct Construct an empty queue.
  9815. ors
  9816.  
  9817.    RWSlistCollectablesQueue(RWCollectable* a);
  9818. Construct an queue with single item a.
  9819.  
  9820.    RWSlistCollectablesQueue(const RWSlistCollectablesQueue & q);
  9821. Copy constructor.  A shallow copy of the queue q is made.
  9822.  
  9823.  
  9824.  
  9825. Rogue Wave      Tools.h++ Class Library                  339
  9826.  
  9827.  
  9828.  
  9829.  
  9830.  
  9831.  
  9832.  
  9833.  
  9834.                       CLASS REFERENCE
  9835.  
  9836.  
  9837. Public    void                operator=(const RWSlistCollectablesQueue & q);
  9838. member    Assignment operator.  A shallow copy of the queue q is made.
  9839. operators
  9840.  
  9841.  
  9842. Public    virtual void          apply(applyCollectable ap, void*)
  9843. member    Inherited from class RWSlistCollectables.
  9844. functions
  9845.           virtual                RWCollectable*      append(RWCollectable*);
  9846.           Inherited from class RWSlistCollectables.  Adds an element to
  9847.           the end of the queue.
  9848.  
  9849.    virtual         unsigned   binaryStoreSize() const;
  9850. Inherited from class RWCollection.
  9851.  
  9852.    virtual void     clear();
  9853. Inherited from class RWSlistCollectables.
  9854.  
  9855.    virtual void     clearAndDestroy();
  9856.    virtual RWBoolean      contains(const RWCollectable* target) const;
  9857. Inherited from class RWCollection.
  9858.  
  9859.    RWBoolean        containsReference(const RWCollectable* e) const;
  9860.    virtual unsigned entries() const;
  9861. Inherited from class RWSlistCollectables.
  9862.  
  9863.    virtual         RWCollectable*   first() const;
  9864. Inherited from class RWSlistCollectables.  Returns the item at the
  9865. beginning of the queue (i.e., the least recently inserted item).
  9866. Returns nil if the queue is empty.
  9867.  
  9868.    RWCollectable*   get();
  9869. Inherited from class RWSlistCollectables.  Returns and removes the
  9870. item at the beginning of the queue (i.e., the least recently
  9871. inserted item).  Returns nil if the queue is empty.
  9872.  
  9873.    virtual         RWCollectable*   insert(RWCollectable* c);
  9874. Redefined from class RWSlistCollectables to call append().
  9875.  
  9876.    virtual ClassID  isA() const;
  9877. Redefined from class RWCollectable to return
  9878. __RWSLISTCOLLECTABLESQUEUE.
  9879.  
  9880.  
  9881. Rogue Wave      Tools.h++ Class Library                  340
  9882.  
  9883.  
  9884.  
  9885.  
  9886.  
  9887.  
  9888.  
  9889.  
  9890.                       CLASS REFERENCE
  9891.  
  9892.    virtual RWBoolean      isEmpty() const;
  9893. Inherited from class RWSlistCollectables.
  9894.  
  9895.    virtual         RWCollectable*   last() const;
  9896. Inherited from class RWSlistCollectables.  Returns the last item in
  9897. the queue (the most recently inserted item).
  9898.  
  9899.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  9900.    unsigned   occurrencesOfReference(const RWCollectable* e) const;
  9901. Inherited from class RWSlistCollectables.
  9902.  
  9903.    virtual         RWCollectable*   remove(const RWCollectable*);
  9904. Redefined from class RWSlistCollectables.  Calls get().  The
  9905. argument is ignored.
  9906.  
  9907.  
  9908.  
  9909.  
  9910.  
  9911.  
  9912.  
  9913.  
  9914.  
  9915.  
  9916.  
  9917.  
  9918.  
  9919.  
  9920.  
  9921.  
  9922.  
  9923.  
  9924.  
  9925.  
  9926.  
  9927.  
  9928.  
  9929.  
  9930.  
  9931.  
  9932.  
  9933.  
  9934.  
  9935.  
  9936.  
  9937. Rogue Wave      Tools.h++ Class Library                  341
  9938.  
  9939.  
  9940.  
  9941.  
  9942.  
  9943.  
  9944.  
  9945.  
  9946.                       CLASS REFERENCE
  9947.  
  9948.  
  9949.  
  9950. class RWSlistCollectablesStack          RWSlistCollectablesStack
  9951.                                                     |
  9952.                                          RWSlistCollectables
  9953.                                              |          |
  9954.                                         RWSequenceable RWSlist
  9955.                                              |
  9956.                                         RWCollection
  9957.                                              |
  9958.                                         RWCollectable
  9959.  
  9960. Synopsis  // Smalltalk typedef:
  9961.           typedef RWSlistCollectablesStack   Stack;
  9962.  
  9963.           #include <stackcol.h>
  9964.           RWSlistCollectablesStack a;
  9965.  
  9966.  
  9967.  
  9968. Descripti Class RWSlistCollectablesStack represents a restricted
  9969. on        interface to class RWSlistCollectables to implement a last in
  9970.           first out (LIFO) stack.  A Stack is a sequential list for
  9971.           which all insertions and deletions are made at one end (the
  9972.           beginning of the list).  Hence, the ordering is determined
  9973.           externally by the ordering of the insertions.  Duplicates are
  9974.           allowed.
  9975.           An object stored by RWSlistCollectablesStack must inherit
  9976.           abstract base class RWCollectable.  The virtual function
  9977.           isEqual() (see class RWCollectable) is required to find a
  9978.           match between a target and an item in the stack.
  9979.           This class corresponds to the Smalltalk class Stack.
  9980.  
  9981. Public    RWSlistCollectablesStack();
  9982. construct Construct an empty stack.
  9983. ors
  9984.  
  9985.    RWSlistCollectablesStack(RWCollectable* a);
  9986. Construct a stack with one entry a.
  9987.  
  9988.    RWSlistCollectablesStack(const RWSlistCollectablesStack& s);
  9989. Copy constructor.  A shallow copy of the stack s is made.
  9990.  
  9991.  
  9992.  
  9993. Rogue Wave      Tools.h++ Class Library                  342
  9994.  
  9995.  
  9996.  
  9997.  
  9998.  
  9999.  
  10000.  
  10001.  
  10002.                       CLASS REFERENCE
  10003.  
  10004.  
  10005. Assignmen void                operator=(const RWSlistCollectablesStack& s);
  10006. t         Assignment operator.  A shallow copy of the stack s is made.
  10007. operator
  10008.  
  10009.  
  10010. Public    virtual void        applyCollectable ap, void*)
  10011. member    virtual unsigned    binaryStoreSize() const;
  10012. functions virtual void        clear();
  10013.           Inherited from class RWSlistCollectables.
  10014.  
  10015.    virtual void     clearAndDestroy();
  10016.    virtual RWBoolean      contains(const RWCollectable* target) const;
  10017. Inherited from class RWCollection.
  10018.  
  10019.    RWBoolean        containsReference(const RWCollectable* e) const;
  10020.    virtual unsigned entries() const;
  10021. Inherited from class RWSlistCollectables.
  10022.  
  10023.    virtual         RWCollectable*   first() const;
  10024. Inherited from class RWSlistCollectables.  Same as top().
  10025.  
  10026.    virtual         RWCollectable*   insert(RWCollectable* c);
  10027. Inherited from class RWSlistCollectables.  Same as push().
  10028.  
  10029.    virtual ClassID  isA() const;
  10030. Redefined from class RWCollectable to return
  10031. __RWSLISTCOLLECTABLESSTACK.
  10032.  
  10033.    virtual RWBoolean      isEmpty()const;
  10034. Inherited from class RWSlistCollectables.
  10035.  
  10036.    virtual         RWCollectable*   last() const;
  10037. Inherited from class RWSlistCollectables.  Returns the item at the
  10038. bottom of the stack.
  10039.  
  10040.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  10041.    unsigned   occurrencesOfReference(const RWCollectable* e) const;
  10042. Inherited from class RWSlistCollectables.
  10043.  
  10044.    virtual RWCollectable* remove(const RWCollectable*);
  10045. Redefined from class RWSlistCollectables.  Calls pop().  The
  10046. argument is ignored.
  10047.  
  10048.  
  10049. Rogue Wave      Tools.h++ Class Library                  343
  10050.  
  10051.  
  10052.  
  10053.  
  10054.  
  10055.  
  10056.  
  10057.  
  10058.                       CLASS REFERENCE
  10059.  
  10060.    RWCollectable*   pop();
  10061. Removes and returns the item at the top of the stack, or returns nil
  10062. if the stack is empty.
  10063.  
  10064.    void             push(RWCollectable*);
  10065. Adds an item to the top of the stack.
  10066.  
  10067.    RWCollectable*   top() const;
  10068. Returns the item at the top of the stack or nil if the stack is
  10069. empty.
  10070.  
  10071.  
  10072.  
  10073.  
  10074.  
  10075.  
  10076.  
  10077.  
  10078.  
  10079.  
  10080.  
  10081.  
  10082.  
  10083.  
  10084.  
  10085.  
  10086.  
  10087.  
  10088.  
  10089.  
  10090.  
  10091.  
  10092.  
  10093.  
  10094.  
  10095.  
  10096.  
  10097.  
  10098.  
  10099.  
  10100.  
  10101.  
  10102.  
  10103.  
  10104.  
  10105. Rogue Wave      Tools.h++ Class Library                  344
  10106.  
  10107.  
  10108.  
  10109.  
  10110.  
  10111.  
  10112.  
  10113.  
  10114.                       CLASS REFERENCE
  10115.  
  10116.  
  10117.  
  10118. class RWSortedVector                       RWSortedVector
  10119.                                                   |
  10120.                                               RWOrdered
  10121.                                                   |
  10122.                                            RWSequenceable
  10123.                                                   |
  10124.                                             RWCollection
  10125.                                                   |
  10126.                                             RWCollectable
  10127.  
  10128. Synopsis  #include <sortvec.h>
  10129.  
  10130.           RWSortedVector a;
  10131.  
  10132.  
  10133.  
  10134. Descripti Class RWSortedVector represents a group of ordered items,
  10135. on        internally sorted by the compareTo() function and accessible by
  10136.           an index number.  Duplicates are allowed.  An object stored by
  10137.           RWSortedVector must inherit from the abstract base class
  10138.           RWCollectable.  An insertion sort is used to maintain the vector
  10139.           in sorted order.
  10140.           Because class RWSortedVector is implemented as a vector of
  10141.           pointers, traversing the collection is more efficient than
  10142.           with class RWBinaryTree.  However, insertions are slower in
  10143.           the center of the collection.
  10144.  
  10145.  
  10146.  
  10147.  
  10148.  
  10149.  
  10150.  
  10151.  
  10152.  
  10153.  
  10154.  
  10155.  
  10156.  
  10157.  
  10158.  
  10159.  
  10160.  
  10161. Rogue Wave      Tools.h++ Class Library                  345
  10162.  
  10163.  
  10164.  
  10165.  
  10166.  
  10167.  
  10168.  
  10169.  
  10170.                       CLASS REFERENCE
  10171.  
  10172. Example   #include <sortvec.h>
  10173.           #include <collstr.h>
  10174.           #include <rstream.h>
  10175.  
  10176.           main()
  10177.           {
  10178.             RWSortedVector sv;
  10179.  
  10180.             sv.insert(new RWCollectableString("dog"));
  10181.             sv.insert(new RWCollectableString("cat"));
  10182.             sv.insert(new RWCollectableString("fish"));
  10183.  
  10184.             RWSortedVectorIterator next(sv);
  10185.             RWCollectableString* item;
  10186.  
  10187.             while( item = (RWCollectableString*)next() )
  10188.               cout << *item << NL;
  10189.  
  10190.             sv.clearAndDestroy();
  10191.  
  10192.           }
  10193.  
  10194.  
  10195.  
  10196.  
  10197.  
  10198.  
  10199.  
  10200.  
  10201.  
  10202.  
  10203.  
  10204.  
  10205.  
  10206.  
  10207.  
  10208.  
  10209.  
  10210.  
  10211.  
  10212.  
  10213.  
  10214.  
  10215.  
  10216.  
  10217. Rogue Wave      Tools.h++ Class Library                  346
  10218.  
  10219.  
  10220.  
  10221.  
  10222.  
  10223.  
  10224.  
  10225.  
  10226.                       CLASS REFERENCE
  10227.  
  10228.           Program output:
  10229.           cat
  10230.           dog
  10231.           fish
  10232.  
  10233.  
  10234. Public    RWSortedVector(int size = 101);
  10235. constructoConstruct an empty RWSortedVector that has an initial capacity
  10236. rs        of size items.  The capacity will be increased automatically if
  10237.           excess items are inserted into the collection.
  10238.  
  10239.  
  10240. Public    RWBoolean           operator==(const RWSortedVector& sv) const;
  10241. member    Returns TRUE if for every item in self, the corresponding item
  10242. operators in sv at the same index is equal.  The two collections must
  10243.           also have the same number of members.
  10244.  
  10245.    const RWCollectable*   operator[](int i);
  10246. Returns the i'th element in the collection.  If i is out of range,
  10247. an exception will occur with error TOOL_INDEX.  This function cannot
  10248. be used as an lvalue.
  10249.  
  10250.    const RWCollectable*   operator()(int i);
  10251. Returns the i'th element in the collection.  Bounds checking is
  10252. enabled by defining the preprocessor directive BOUNDS_CHECK before
  10253. including the header file sortvec.h.  In this case, if i is out of
  10254. range, an exception will occur with error TOOL_INDEX.  This function
  10255. cannot be used as an lvalue.
  10256.  
  10257.  
  10258. Public    virtual void        apply(applyCollectable ap, void* x);
  10259. member    Inherited from class RWOrdered.
  10260. functions
  10261.           virtual const RWCollectable*    at(int i) const;
  10262.           Inherited from class RWOrdered.
  10263.  
  10264.    virtual unsigned binaryStoreSize() const;
  10265. Inherited from class RWCollection.
  10266.  
  10267.    virtual void     clear();
  10268. Inherited from class RWOrdered.
  10269.  
  10270.    virtual void     clearAndDestroy();
  10271. Inherited from class RWCollection.
  10272.  
  10273. Rogue Wave      Tools.h++ Class Library                  347
  10274.  
  10275.  
  10276.  
  10277.  
  10278.  
  10279.  
  10280.  
  10281.  
  10282.                       CLASS REFERENCE
  10283.  
  10284.    virtual int      compareTo(const RWCollectable* a) const;
  10285. Inherited from class RWCollectable.
  10286.  
  10287.    virtual RWBoolean      contains(const RWCollectable* target) const;
  10288. Inherited from class RWCollection.
  10289.  
  10290.    virtual unsigned entries() const;
  10291. Inherited from class RWOrdered.
  10292.  
  10293.    virtual         RWCollectable*   find(const RWCollectable* target) const;
  10294. Inherited from class RWOrdered.  Note that RWOrdered::find() uses
  10295. the virtual function index() to perform its search.  Hence, a binary
  10296. search will be used.
  10297.  
  10298.    virtual         RWCollectable*   first() const;
  10299. Inherited from class RWOrdered.
  10300.  
  10301.    virtual unsigned hash() const;
  10302. Inherited from class RWCollectable.
  10303.  
  10304.    virtual int      index(const RWCollectable*) const;
  10305. Redefined from class RWOrdered.  Performs a binary search to return
  10306. the index of the first item that compares equal to the target item,
  10307. or _1 if no such item can be found.
  10308.  
  10309.    virtual         RWCollectable*   insert(RWCollectable* c);
  10310. Redefined from class RWOrdered.  Performs a binary search to insert
  10311. the item pointed to by c after all items that compare less than or
  10312. equal to it, but before all items that compare greater than it.
  10313. Returns nil if the insertion was unsuccessful, c otherwise.
  10314.  
  10315.    virtual ClassID  isA() const;
  10316. Redefined from class RWCollectable to return __RWSORTEDVECTOR.
  10317.  
  10318.    virtual RWBoolean      isEmpty() const;
  10319. Inherited from class RWOrdered.
  10320.  
  10321.    virtual RWBoolean      isEqual(const RWCollectable* a) const;
  10322. Inherited from class RWCollectable.
  10323.  
  10324.    virtual         RWCollectable*   last() const;
  10325. Inherited from class RWOrdered.
  10326.  
  10327.  
  10328.  
  10329. Rogue Wave      Tools.h++ Class Library                  348
  10330.  
  10331.  
  10332.  
  10333.  
  10334.  
  10335.  
  10336.  
  10337.  
  10338.                       CLASS REFERENCE
  10339.  
  10340.    virtual unsigned occurrencesOf(const RWCollectable* target) const;
  10341. Redefined from class RWOrdered.  Returns the number of items that
  10342. compare equal to the item pointed to by target.
  10343.  
  10344.    virtual         RWCollectable*   remove(const RWCollectable* target);
  10345. Inherited from class RWOrdered.  Note that RWOrdered::remove() uses
  10346. the virtual function index() to perform its search.  Hence, a binary
  10347. search will be used.
  10348.  
  10349.    virtual void     removeAndDestroy(const RWCollectable* target);
  10350. Inherited from class RWCollection.
  10351.  
  10352.  
  10353.  
  10354.  
  10355.  
  10356.  
  10357.  
  10358.  
  10359.  
  10360.  
  10361.  
  10362.  
  10363.  
  10364.  
  10365.  
  10366.  
  10367.  
  10368.  
  10369.  
  10370.  
  10371.  
  10372.  
  10373.  
  10374.  
  10375.  
  10376.  
  10377.  
  10378.  
  10379.  
  10380.  
  10381.  
  10382.  
  10383.  
  10384.  
  10385. Rogue Wave      Tools.h++ Class Library                  349
  10386.  
  10387.  
  10388.  
  10389.  
  10390.  
  10391.  
  10392.  
  10393.  
  10394.                       CLASS REFERENCE
  10395.  
  10396.  
  10397.  
  10398. class RWString
  10399.  
  10400.  
  10401.  
  10402.  
  10403.  
  10404. Synopsis  #include <rwstring.h>
  10405.           RWString a;
  10406.  
  10407.  
  10408.  
  10409. Descripti The RWString class is designed to support string manipulations
  10410. on        and processing that are more convenient than the standard C
  10411.           <string.h> functions.
  10412.           A separate RWSubString class supports substring extraction and
  10413.           modification operations.
  10414.           Note that if compilers implemented type conversion correctly,
  10415.           some of the operators below would not be necessary.
  10416.           Experience has proven otherwise.
  10417.  
  10418. Example   #include <rwstring.h>
  10419.           #include <regexp.h>
  10420.           #include <rstream.h>
  10421.  
  10422.           main()
  10423.           {
  10424.             RWString a("There is no joy in Beantown.");
  10425.  
  10426.             RWRegexp re("[A-Z][a-z]*town");  // Any capitalized "town"
  10427.  
  10428.             a(re) = "Redmond";
  10429.  
  10430.             cout << a << NL;
  10431.  
  10432.           }
  10433.  
  10434.           Program output:
  10435.                        There is no joy in Redmond.
  10436.  
  10437.  
  10438.  
  10439.  
  10440.  
  10441. Rogue Wave      Tools.h++ Class Library                  350
  10442.  
  10443.  
  10444.  
  10445.  
  10446.  
  10447.  
  10448.  
  10449.  
  10450.                       CLASS REFERENCE
  10451.  
  10452. Public    RWString();
  10453. construct Constructs a RWString with zero characters (the null string).
  10454. ors
  10455.  
  10456.    RWString(const char* c);
  10457. Conversion from character string.  The array pointed to by c should
  10458. be null terminated.  The created string will copy the data pointed
  10459. to by c.
  10460.  
  10461.    RWString(const char* c, int N);
  10462. Construct a string from the (possibly) null terminated character
  10463. string c.  The created string will copy the data pointed to by c.
  10464. At most N characters (not including the terminating null) will be
  10465. copied.
  10466.  
  10467.    RWString(const RWString& s);
  10468. Copy constructor.  The created string will reference s's data.  That
  10469. is, a shallow copy of s will be made.
  10470.  
  10471.    RWString(const RWSubString& ss);
  10472. Conversion from sub-string.  The created string will copy the
  10473. substring represented by ss.
  10474.  
  10475.    RWString(unsigned N, char c = ' ');
  10476. Constructs a RWString with N characters (default blanks).
  10477.  
  10478.  
  10479. Type      operator            const char*() const;
  10480. conversio Returns self as a null-terminated string.
  10481. n
  10482.  
  10483.  
  10484. Assignmen RWString&           operator=(const RWString& str);
  10485. t         Assignment operator.  The string will reference s's data.
  10486. operators That is, a shallow copy is made.
  10487.  
  10488.    RWString&        operator+=(const RWString& str);
  10489. Append the string str to self.
  10490.  
  10491.    RWString&        operator+=(const char* s);
  10492. Append the character string pointed to by s to self.
  10493.  
  10494.  
  10495.  
  10496.  
  10497. Rogue Wave      Tools.h++ Class Library                  351
  10498.  
  10499.  
  10500.  
  10501.  
  10502.  
  10503.  
  10504.  
  10505.  
  10506.                       CLASS REFERENCE
  10507.  
  10508.  
  10509. Indexing  char&               operator[](int i);
  10510. operators Return the i'th character.  The result can be used as an
  10511.           lvalue.  The index i must be between 0 and the length of the
  10512.           string less one.  Bounds checking is performed -- if the index
  10513.           is out of range then an exception with error TOOL_INDEX will
  10514.           occur.
  10515.  
  10516.    char             operator[](int i) const;
  10517. Return the i'th character.  The index i must be between 0 and the
  10518. length of the string less one.  Bounds checking is performed -- if
  10519. the index is out of range then an exception with error TOOL_INDEX
  10520. will occur.
  10521.  
  10522.    char&            operator()(int);
  10523. Return the i'th character.  The result can be used as an lvalue.
  10524. The index i must be between 0 and the length of the string less one.
  10525. Bounds checking is performed if the pre-processor macro BOUNDS_CHECK
  10526. has been defined before including rwstring.h.  In this case, if the
  10527. index is out of range, then an exception with error TOOL_INDEX will
  10528. occur.
  10529.  
  10530.    char             operator()(int) const;
  10531. Return the i'th character.  The index i must be between 0 and the
  10532. length of the string less one.  Bounds checking is performed if the
  10533. pre-processor macro BOUNDS_CHECK has been defined before including
  10534. rwstring.h.  In this case, if the index is out of range, then an
  10535. exception with error TOOL_INDEX will occur.
  10536.  
  10537.    RWSubString      operator()(int start, unsigned len);
  10538. Substring operator.  Returns a RWSubString of self with length len,
  10539. starting at index start.  The results can be used as an lvalue.  If
  10540. the library was built using the DEBUG flag, and start and len are
  10541. out of range, then an exception will occur with error
  10542. TOOL_SUBSTRING.
  10543.  
  10544.    const RWSubString      operator()(int start, unsigned len) const;
  10545. Returns a RWSubString of self with length len, starting at index
  10546. start.  The results cannot be used as an lvalue.  If the library was
  10547. built using the DEBUG flag, and start and len are out of range, then
  10548. an exception will occur with error TOOL_SUBSTRING.
  10549.  
  10550.    RWSubString      operator()(const RWRegexp& re, int start=0);
  10551. Returns the first substring starting after index start that matches
  10552.  
  10553. Rogue Wave      Tools.h++ Class Library                  352
  10554.  
  10555.  
  10556.  
  10557.  
  10558.  
  10559.  
  10560.  
  10561.  
  10562.                       CLASS REFERENCE
  10563.  
  10564. the regular expression re.  If there is no such substring, then the
  10565. null substring is returned.  The results can be used as an lvalue.
  10566.  
  10567.    const RWSubString      operator()(const RWRegexp& re, int start=0) const;
  10568. Returns the first substring starting after index start that matches
  10569. the regular expression re.  If there is no such substring, then the
  10570. null substring is returned.  The results cannot be used as an
  10571. lvalue.
  10572.  
  10573.  
  10574. Logical   RWBoolean           operator==(const char*) const;
  10575. operators RWBoolean           operator!=(const char*) const;
  10576.           RWBoolean           operator==(const RWString&) const;
  10577.           RWBoolean           operator!=(const RWString&) const;
  10578.           Logical equality and inequality.  Case sensitivity is set by
  10579.           the static member function setCaseSensitive().
  10580.  
  10581.    RWBoolean        operator>(const char*) const;
  10582.    RWBoolean        operator<(const char*) const;
  10583.    RWBoolean        operator>=(const char*) const;
  10584.    RWBoolean        operator<=(const char*) const;
  10585.    RWBoolean        operator>(const RWString&) const;
  10586.    RWBoolean        operator<(const RWString&) const;
  10587.    RWBoolean        operator>=(const RWString&) const;
  10588.    RWBoolean        operator<=(const RWString&) const;
  10589. Other logical operators.  Comparisons are done lexicographically.
  10590. Case sensitivity is set by the static member function
  10591. setCaseSensitive().
  10592.  
  10593.  
  10594. Public    unsigned            binaryStoreSize() const;
  10595. member    Returns the number of bytes necessary to store the object using
  10596. functions RWString::saveOn(RWFile&).
  10597.  
  10598.    int              compareTo(const RWString& str) const;
  10599. Returns an int less than, greater than, or equal to zero depending
  10600. on whether self is less than, greater than, or equal to the string
  10601. str.  The comparisons are done lexicographically.  Case sensitivity
  10602. is set by the static member function setCaseSensitive().
  10603.  
  10604.    RWBoolean        contains(const char* c) const;
  10605. Pattern matching.  Returns TRUE if the string pointed to by c occurs
  10606. in self.  Case sensitivity is set by the static member function
  10607. setCaseSensitive().
  10608.  
  10609. Rogue Wave      Tools.h++ Class Library                  353
  10610.  
  10611.  
  10612.  
  10613.  
  10614.  
  10615.  
  10616.  
  10617.  
  10618.                       CLASS REFERENCE
  10619.  
  10620.    RWBoolean        contains(const RWString& str) const;
  10621. Pattern matching.  Returns TRUE if str occurs in RWString.  Case
  10622. sensitivity is set by the static member function setCaseSensitive().
  10623.  
  10624.    RWString         copy() const;
  10625. Returns a distinct deep copy of self.
  10626.  
  10627.    const char*      data() const;
  10628. Access to the RWString's data as a null terminated string.  Must be
  10629. used with care.
  10630.  
  10631.    int              first(char) const;
  10632. Returns the index of the first occurence of the character c in self.
  10633. Returns _1 if there is no such character.
  10634.  
  10635.    unsigned         hash() const;
  10636. Returns a suitable hash value.
  10637.  
  10638.    int              index(const char* c, int i=0) const;
  10639. Pattern matching.  Returns the index greater than or equal to i of
  10640. the start of the first occurrence of the string pointed to by c in
  10641. self.  Returns -1 if there is no such pattern.  Case sensitivity is
  10642. set by the static member function setCaseSensitive().  The pattern
  10643. matching is done by computing a hash value for the string pointed to
  10644. by c using what is effectively a very large hash table and then
  10645. comparing it against hash values computed from self.  The table is
  10646. so large that it is very unlikely that two different patterns would
  10647. hash to the same value.  Nevertheless, a final string comparison can
  10648. be made by calling the static member function setParanoidCheck()
  10649. with argument TRUE.
  10650.  
  10651.    int              index(const RWString& str, int i=0) const;
  10652. Pattern matching.  Returns the index greater than or equal to i of
  10653. the start of the first occurrence of str in self.  Returns -1 if
  10654. there is no such pattern.  Case sensitivity is set by the static
  10655. member function setCaseSensitive().  See additional comments above
  10656. on final string comparisons.
  10657.  
  10658.    int    index(const RWRegexp& re, int i=0) const;
  10659. Regular expression matching.  Returns the index greater than or
  10660. equal to i of the start of the first pattern that matches the
  10661. regular expression re.  Returns _1 if there is no such pattern.
  10662.  
  10663.  
  10664.  
  10665. Rogue Wave      Tools.h++ Class Library                  354
  10666.  
  10667.  
  10668.  
  10669.  
  10670.  
  10671.  
  10672.  
  10673.  
  10674.                       CLASS REFERENCE
  10675.  
  10676.    int    index(const RWRegexp& re, int* ext, int i=0) const;
  10677. Regular expression matching.  Returns the index greater than or
  10678. equal to i of the start of the first pattern that matches the
  10679. regular expression re.  Returns _1 if there is no such pattern.  The
  10680. length of the matching pattern is returned in the integer pointed to
  10681. by ext.
  10682.  
  10683.    RWBoolean        isNull() const;
  10684. Returns TRUE if this is a zero lengthed string (i.e., the null
  10685. string).
  10686.  
  10687.    int              last(char c) const;
  10688. Returns the index of the last occurrence in the string of the
  10689. character c.  Returns _1 if there is no such character.
  10690.  
  10691.    unsigned         length() const;
  10692. Returns the number of characters in self.
  10693.  
  10694.    RWString&        prepend(const char*);
  10695. Prepends the string pointed to by c to self.
  10696.  
  10697.    RWString&        prepend(const RWString& str);
  10698. Prepends the string str to self.
  10699.  
  10700.    istream&         readFile(istream& s);
  10701. Reads an entire file into self from the input stream s, replacing
  10702. the previous contents of self.  Reads to EOF.
  10703.  
  10704.    istream&         readLine(istream& s);
  10705. If skipWhitespace() is TRUE (the default), then whitespace is
  10706. skipped before saving characters. Characters are then read from the
  10707. input stream s until a newline is encountered. The newline is
  10708. removed from the input stream but is not stored.
  10709.  
  10710.    istream&         readToken(istream& s);
  10711. Whitespace is skipped before saving characters. Characters are then
  10712. read from the input stream s until whitespace is encountered. The
  10713. whitespace is left on the input stream.
  10714.  
  10715.    void             resize(unsigned n);
  10716. Changes the length of self, adding blanks or truncating as
  10717. necessary.
  10718.  
  10719.  
  10720.  
  10721. Rogue Wave      Tools.h++ Class Library                  355
  10722.  
  10723.  
  10724.  
  10725.  
  10726.  
  10727.  
  10728.  
  10729.  
  10730.                       CLASS REFERENCE
  10731.  
  10732.    void             restoreFrom(RWvistream& s);
  10733. Reads an RWString from the input stream s that had been stored using
  10734. saveOn(RWvostream&).
  10735.  
  10736.    void             restoreFrom(RWFile& f);
  10737. Reads an RWString from the RWFile f that had been stored using
  10738. storeOn(RWFile&).
  10739.  
  10740.    void             saveOn(RWvostream& s) const;
  10741. Stores an RWString on the output stream s.
  10742.  
  10743.    void             saveOn(RWFile& f) const;
  10744. Stores an RWString in binary format on the RWFile f.
  10745.  
  10746.    RWSubString      strip(stripType s = trailing, char c = ' ');
  10747. Returns a substring of self where the character c has been stripped
  10748. off the beginning, end, or both ends of the string.  The enum
  10749. stripType can take values:
  10750.  
  10751.                stripType      Meaning
  10752.                leading        Remove characters at beginning
  10753.                trailing       Remove characters at end
  10754.                both           Remove characters at both ends
  10755.  
  10756.    void             toLower();
  10757. Changes all upper-case letters in self to lower-case.
  10758.  
  10759.    void             toUpper();
  10760. Changes all lower-case letters in self to upper-case.
  10761.  
  10762.  
  10763.  
  10764.  
  10765.  
  10766.  
  10767.  
  10768.  
  10769.  
  10770.  
  10771.  
  10772.  
  10773.  
  10774.  
  10775.  
  10776.  
  10777. Rogue Wave      Tools.h++ Class Library                  356
  10778.  
  10779.  
  10780.  
  10781.  
  10782.  
  10783.  
  10784.  
  10785.  
  10786.                       CLASS REFERENCE
  10787.  
  10788.  
  10789. Static    static unsigned     initialCapacity(unsigned ic = 63);
  10790. public    Sets the minimum initial capacity of an RWString. The initial
  10791. member    setting is 63 characters. Larger values will use more memory,
  10792. functions but result in fewer resizes when concatenating or reading
  10793.           strings. Smaller values will waste less memory, but result in
  10794.           more resizes.
  10795.  
  10796.    Static unsigned  maxWaste(unsigned mw = 63);
  10797. Sets the maximum amount of unused space allowed in a string should
  10798. it shrink. If more than this amount of characters is wasted, the
  10799. space will be reclaimed.
  10800.  
  10801.    Static unsigned  resizeIncrement(unsigned ri = 64);
  10802. Sets the resize increment when more memory is needed to grow a
  10803. string.
  10804.  
  10805.           static RWBoolean    setCaseSensitive(RWBoolean s = TRUE);
  10806.           Sets whether pattern matching, hashing, and lexical comparisons
  10807.           are case-sensitive.  Returns the old setting.  The initial
  10808.           setting is case-sensitive pattern matching.
  10809.  
  10810.    static RWBoolean setParanoidCheck(RWBoolean s = TRUE);
  10811. Sets whether a pattern match using hash values is followed by a
  10812. string comparison.  Returns the old setting.  The initial setting is
  10813. FALSE.  See function index() for additional details.
  10814.  
  10815.    static RWBoolean skipWhitespace(RWBoolean s = TRUE);
  10816. Sets whether white space is skipped before reading a token or a
  10817. line.  The initial setting is TRUE.  See function readLine() for
  10818. additional details.
  10819.  
  10820.  
  10821. Related   RWString            operator+(const RWString&, const RWString&);
  10822. global    RWString            operator+(const char*, const RWString&);
  10823. operators RWString            operator+(const RWString&, const char*);
  10824.           Concatenation operators.
  10825.  
  10826.    ostream&         operator<<(ostream& s, const RWString&);
  10827. Output a RWString on ostream s.
  10828.  
  10829.    istream&         operator>>(istream& s, RWString& str);
  10830. Calls str.readToken(s).  That is, a token is read from the input
  10831. stream s.
  10832.  
  10833. Rogue Wave      Tools.h++ Class Library                  357
  10834.  
  10835.  
  10836.  
  10837.  
  10838.  
  10839.  
  10840.  
  10841.  
  10842.                       CLASS REFERENCE
  10843.  
  10844.    RWString         toLower(const RWString& str);
  10845. Returns a version of str where all upper-case characters have been
  10846. replaced with lower-case characters.
  10847.  
  10848.    RWString         toUpper(const RWString& str);
  10849. Returns a version of str where all lower-case characters have been
  10850. replaced with upper-case characters.
  10851.  
  10852.  
  10853.  
  10854.  
  10855.  
  10856.  
  10857.  
  10858.  
  10859.  
  10860.  
  10861.  
  10862.  
  10863.  
  10864.  
  10865.  
  10866.  
  10867.  
  10868.  
  10869.  
  10870.  
  10871.  
  10872.  
  10873.  
  10874.  
  10875.  
  10876.  
  10877.  
  10878.  
  10879.  
  10880.  
  10881.  
  10882.  
  10883.  
  10884.  
  10885.  
  10886.  
  10887.  
  10888.  
  10889. Rogue Wave      Tools.h++ Class Library                  358
  10890.  
  10891.  
  10892.  
  10893.  
  10894.  
  10895.  
  10896.  
  10897.  
  10898.                       CLASS REFERENCE
  10899.  
  10900.  
  10901.  
  10902. class RWSubString
  10903.  
  10904.  
  10905.  
  10906.  
  10907.  
  10908. Synopsis  #include <rwstring.h>
  10909.           RWString s("test string");
  10910.           s(6,3);             // "tri"
  10911.  
  10912.  
  10913.  
  10914. Descripti The class RWSubString allows some subsection of a RWString to
  10915. on        be addressed by defining a starting position and an extent.
  10916.           For example the 7'th through the 11'th elements, inclusive,
  10917.           would have a starting position of 7 and an extent of 5.  The
  10918.           specification of a starting position and extent can also be
  10919.           done in your behalf by such functions as RWString::strip() or
  10920.           the overloaded function call operator taking a regular
  10921.           expression as an argument.  There are no public constructors
  10922.           -- RWSubStrings are constructed by various functions of the
  10923.           RWString class and then destroyed immediately.
  10924.           A zero lengthed substring is one with a defined starting
  10925.           position and an extent of zero.  It can be thought of as
  10926.           starting just before the indicated character, but not
  10927.           including it.  It can be used as an lvalue.  A null substring
  10928.           is also legal and is frequently used to indicate that a
  10929.           requested substring, perhaps through a search, does not exist.
  10930.           A null substring can be detected with member function
  10931.           isNull().  However, it cannot be used as an lvalue.
  10932.  
  10933.  
  10934.  
  10935.  
  10936.  
  10937.  
  10938.  
  10939.  
  10940.  
  10941.  
  10942.  
  10943.  
  10944.  
  10945. Rogue Wave      Tools.h++ Class Library                  359
  10946.  
  10947.  
  10948.  
  10949.  
  10950.  
  10951.  
  10952.  
  10953.  
  10954.                       CLASS REFERENCE
  10955.  
  10956. Example   #include <rwstring.h>
  10957.           #include <rstream.h>
  10958.  
  10959.           main() {
  10960.  
  10961.             RWString s("What I tell you is true.");
  10962.  
  10963.             // Create a substring and use it as an lvalue:
  10964.             s(19, 0) = "three times ";
  10965.             cout << s << NL;
  10966.           }
  10967.  
  10968.           Program output:
  10969.             What I tell you is three times true.
  10970.  
  10971.  
  10972.  
  10973.  
  10974.  
  10975.  
  10976.  
  10977.  
  10978.  
  10979.  
  10980.  
  10981.  
  10982.  
  10983.  
  10984.  
  10985.  
  10986.  
  10987.  
  10988.  
  10989.  
  10990.  
  10991.  
  10992.  
  10993.  
  10994.  
  10995.  
  10996.  
  10997.  
  10998.  
  10999.  
  11000.  
  11001. Rogue Wave      Tools.h++ Class Library                  360
  11002.  
  11003.  
  11004.  
  11005.  
  11006.  
  11007.  
  11008.  
  11009.  
  11010.                       CLASS REFERENCE
  11011.  
  11012.  
  11013.  
  11014. Assignment void                operator=(const RWString&);
  11015. operators  Assignment to a RWString.  The statements:
  11016.  
  11017.                     RWString a;
  11018.                     RWString b;
  11019.                     ...
  11020.                     b(2, 3) = a;
  11021.  
  11022. will copy a's data into the substring b(2,3).  The number of
  11023. elements need not match: if they differ, b will be resized
  11024. appropriately.  If the library was compiled with the DEBUG flag and
  11025. if self is the null substring then an exception will occur with
  11026. error TOOL_NULSS.
  11027.  
  11028.    void             operator=(const char*);
  11029. Assignment to a character string.  The statements:
  11030.                     RWString a("Mary had a lamb");
  11031.                     char dat[] = "Perrier";
  11032.                     a(11,4) = dat; // "Mary had a Perrier"
  11033.  
  11034. Note that the number of characters selected need not match: if they
  11035. differ, a will be resized appropriately.  If the library was
  11036. compiled with the DEBUG flag and if self is the null substring then
  11037. an exception will occur with error TOOL_NULSS.
  11038.  
  11039.  
  11040. Logical   RWBoolean           operator==(const char* s) const;
  11041. operators RWBoolean           operator==(const RWString& str) const;
  11042.           Returns TRUE if this substring is lexicographically equal to
  11043.           the character string s or RWString str, respectively.  Case
  11044.           sensitivity is set by the static member function
  11045.           RWString::setCaseSensitive().  If the library was compiled
  11046.           with the DEBUG flag and if self is the null substring then an
  11047.           exception will occur with error TOOL_NULSS.
  11048.  
  11049.    RWBoolean        operator!=(const char* s) const;
  11050.    RWBoolean        operator!=(const RWString& str) const;
  11051. Returns the negation of the respective operator==().
  11052.  
  11053.  
  11054.  
  11055.  
  11056.  
  11057. Rogue Wave      Tools.h++ Class Library                  361
  11058.  
  11059.  
  11060.  
  11061.  
  11062.  
  11063.  
  11064.  
  11065.  
  11066.                       CLASS REFERENCE
  11067.  
  11068.  
  11069. Indexing  char&               operator[](int i) const;
  11070. operators Access to individual elements with bounds checking.  If the
  11071.           index i is out of range then an exception with error TOOL_INDEX
  11072.           will occur.
  11073.  
  11074.    char&            operator()(int i) const;
  11075. Access to individual elements with optional bounds checking.  Bounds
  11076. checking is enabled by defining the pre-processor macro BOUNDS_CHECK
  11077. before including rwstring.  In this case, if the index i is out of
  11078. range, then an exception with error TOOL_INDEX will occur.
  11079.  
  11080.  
  11081. Public    RWBoolean           isNull() const;
  11082. member    Returns TRUE if this is a null substring.
  11083. functions
  11084.           unsigned            length() const;
  11085.           Returns the extent (i.e., length) of the RWSubString.
  11086.  
  11087.    RWBoolean        operator!() const;
  11088. Returns TRUE if this is a null substring.
  11089.  
  11090.                     operator const char*() const;
  11091. Returns zero if this is the null substring, the start of the
  11092. substring otherwise.
  11093.  
  11094.    int              start() const;
  11095. Returns the starting element of the RWSubString.
  11096.  
  11097.    void             toLower();
  11098. Changes all upper-case letters in self to lower-case.
  11099.  
  11100.    void             toUpper();
  11101. Changes all lower-case letters in self to upper-case.
  11102.  
  11103.  
  11104.  
  11105.  
  11106.  
  11107.  
  11108.  
  11109.  
  11110.  
  11111.  
  11112.  
  11113. Rogue Wave      Tools.h++ Class Library                  362
  11114.  
  11115.  
  11116.  
  11117.  
  11118.  
  11119.  
  11120.  
  11121.  
  11122.                       CLASS REFERENCE
  11123.  
  11124.  
  11125.  
  11126. class RWTime
  11127.  
  11128.  
  11129.  
  11130.  
  11131.  
  11132. Synopsis  typedef unsigned           hourTy;
  11133.           typedef unsigned           minuteTy;
  11134.           typedef unsigned           secondTy;
  11135.           typedef unsigned long      clockTy;
  11136.  
  11137.           #include <rwtime.h>
  11138.           RWTime a;           // Construct with current time
  11139.  
  11140.  
  11141.  
  11142. Descripti Class RWTime represents a time, stored as the number of seconds
  11143. on        since 1 January 1901_.  See Section 8 for how to set the time zone
  11144.           for your compiler.  Failure to do this may result in GMT times
  11145.           being wrong.
  11146.  
  11147. Example   #include <time.h>
  11148.           #include <rstream.h>
  11149.  
  11150.           main()
  11151.           {
  11152.             RWTime t;  // Current time
  11153.  
  11154.             cout << "Current time:         " << t << NL;
  11155.  
  11156.             cout << "Start of DST, 1990:   "
  11157.                  << RWTime::beginDST(1990) << NL;
  11158.           }
  11159.  
  11160.           Program output
  11161.  
  11162.  
  11163.                     
  11164.  
  11165. _ While the ANSI X3J11 committee puts the beginning of all time at 1
  11166.   January 1970, we now know through extensive research that time
  11167.   actually started much earlier than this.
  11168.  
  11169. Rogue Wave      Tools.h++ Class Library                  363
  11170.  
  11171.  
  11172.  
  11173.  
  11174.  
  11175.  
  11176.  
  11177.  
  11178.                       CLASS REFERENCE
  11179.  
  11180.           Current time:         March 22, 1991 3:01:40 pm
  11181.           Start of DST, 1990:   April 1, 1990 2:00:00 am
  11182.  
  11183.  
  11184.  
  11185.  
  11186. Public    RWTime();
  11187. constructoConstructs a time with the present local time.
  11188. rs
  11189.  
  11190.    RWTime(clockTy s);
  11191. Constructs a time with s seconds since 1 January 1901.
  11192.  
  11193.    RWTime(hourTy h, minuteTy m, secondTy s = 0);
  11194. Constructs a time with today's date at the specified (local) hour,
  11195. minute, and second.
  11196.  
  11197.    RWTime(const RWDate&, hourTy h = 0, minuteTy m = 0, secondTy s = 0);
  11198. Constructs a time for a given date (defined as a RWDate) at the
  11199. specified (local) hour, minute, and second.
  11200.  
  11201.  
  11202. Public    RWBoolean           operator<(const RWTime& t) const;
  11203. member    Returns TRUE if RWTime is less than t.
  11204. operators
  11205.           RWBoolean           operator<=(const RWTime& t) const;
  11206.           Returns TRUE if RWTime is less than or equal to t.
  11207.  
  11208.    RWBoolean        operator>(const RWTime& t) const;
  11209. Returns TRUE if RWTime is greater than t.
  11210.  
  11211.    RWBoolean        operator>=(const RWTime& t) const;
  11212. Returns TRUE if RWTime is greater than or equal to t.
  11213.  
  11214.    RWBoolean        operator==(const RWTime& t) const;
  11215. Returns TRUE if RWTime is equal to t.
  11216.  
  11217.    RWBoolean        operator!=(const RWTime& t) const;
  11218. Returns TRUE if RWTime is not equal to t.
  11219.  
  11220.    void             operator++();
  11221. Add 1 second to RWTime
  11222.  
  11223.  
  11224.  
  11225. Rogue Wave      Tools.h++ Class Library                  364
  11226.  
  11227.  
  11228.  
  11229.  
  11230.  
  11231.  
  11232.  
  11233.  
  11234.                       CLASS REFERENCE
  11235.  
  11236.    void             operator--();
  11237. Subtract 1 second from RWTime
  11238.  
  11239.    void             operator+=(long s);
  11240. Add s seconds to RWTime
  11241.  
  11242.    void             operator-=(long s);
  11243. Subtract s seconds from RWTime
  11244.  
  11245.  
  11246. Public    RWBoolean           between(const RWTime& a, const RWTime& b) const;
  11247. member    Returns TRUE if RWTime is between a and b
  11248. functions
  11249.           unsigned            binaryStoreSize() const;
  11250.           Returns the number of bytes necessary to store this object using
  11251.           RWTime::saveOn(RWFile&).
  11252.  
  11253.    int              compareTo(const RWTime* t) const;
  11254. Comparison function, useful for sorting times.  Compares self to the
  11255. RWTime pointed to by t and returns:
  11256.  
  11257.                 0   if self == *t;
  11258.                 1   if self > *t;
  11259.                _1   if self < *t.
  11260.  
  11261.    unsigned         hash() const;
  11262. Returns a suitable hashing value.
  11263.  
  11264.    hourTy           hour() const;
  11265. Returns the hour; local time.
  11266.  
  11267.    hourTy           hourGMT() const;
  11268. Returns the hour; GMT.
  11269.  
  11270.    RWTime           max(const RWTime& t) const;
  11271. Returns the greater of self or t.  For example, if t1 and t2 are
  11272. RWTimes:
  11273.                  cout << t1.max(t2);
  11274.  
  11275. will print the greater time.
  11276.  
  11277.    RWTime           min(const RWTime& t) const;
  11278. Returns the lesser of self or t.
  11279.  
  11280.  
  11281. Rogue Wave      Tools.h++ Class Library                  365
  11282.  
  11283.  
  11284.  
  11285.  
  11286.  
  11287.  
  11288.  
  11289.  
  11290.                       CLASS REFERENCE
  11291.  
  11292.    minuteTy         minute() const;
  11293. Returns the minute; local time.
  11294.  
  11295.    minuteTy         minuteGMT() const;
  11296. Returns the minute; GMT.
  11297.  
  11298.    void             restoreFrom(RWvistream& s);
  11299. Reads a RWTime that was stored with saveOn(RWvostream&) from the
  11300. input stream s.
  11301.  
  11302.    void             restoreFrom(RWFile& f);
  11303. Reads an RWTime that was stored with storeOn(RWFile&) from the
  11304. RWFile f.
  11305.  
  11306.    secondTy         second() const;
  11307. Returns the second; local time or GMT.
  11308.  
  11309.    clockTy          seconds() const;
  11310. Returns the number of seconds since 00:00:00 January 1, 1901.
  11311.  
  11312.    void             saveOn(RWvostream& s) const;
  11313. Stores a RWTime on the output stream s.
  11314.  
  11315.    void             saveOn(RWFile& f) const;
  11316. Stores an RWTime in binary format on the RWFile f.
  11317.  
  11318.  
  11319. Static    static RWTime       beginDST(unsigned year);
  11320. public    Return the start of Daylight Savings Time for the given year.
  11321. member
  11322. functions
  11323.  
  11324.    static RWTime    endDST(unsigned year);
  11325. Return the end of Daylight Savings Time for the given year.
  11326.  
  11327.  
  11328. Related   RWTime              operator+(const RWTime& t, long s);
  11329. global    RWTime              operator+(long s, const RWTime& t);
  11330. operators Returns a RWTime s seconds greater than t.
  11331.  
  11332.    RWTime           operator-(const RWTime& t, long s);
  11333. Returns a RWTime s seconds less than t.
  11334.  
  11335.  
  11336.  
  11337. Rogue Wave      Tools.h++ Class Library                  366
  11338.  
  11339.  
  11340.  
  11341.  
  11342.  
  11343.  
  11344.  
  11345.  
  11346.                       CLASS REFERENCE
  11347.  
  11348.    ostream&         operator<<(ostream& s, const RWTime& t);
  11349. Outputs t on ostream s, in the form: hh:mm:ss am/pm
  11350.  
  11351.  
  11352.  
  11353.  
  11354.  
  11355.  
  11356.  
  11357.  
  11358.  
  11359.  
  11360.  
  11361.  
  11362.  
  11363.  
  11364.  
  11365.  
  11366.  
  11367.  
  11368.  
  11369.  
  11370.  
  11371.  
  11372.  
  11373.  
  11374.  
  11375.  
  11376.  
  11377.  
  11378.  
  11379.  
  11380.  
  11381.  
  11382.  
  11383.  
  11384.  
  11385.  
  11386.  
  11387.  
  11388.  
  11389.  
  11390.  
  11391.  
  11392.  
  11393. Rogue Wave      Tools.h++ Class Library                  367
  11394.  
  11395.  
  11396.  
  11397.  
  11398.  
  11399.  
  11400.  
  11401.  
  11402.                       CLASS REFERENCE
  11403.  
  11404.  
  11405.  
  11406. class RWTokenizer
  11407.  
  11408.  
  11409.  
  11410.  
  11411.  
  11412. Synopsis  #include <token.h>
  11413.  
  11414.           RWString str("a string of tokens");
  11415.           RWTokenizer(str);   // Lex the above string
  11416.  
  11417.  
  11418.  
  11419. Descripti Class RWTokenizer is designed to break a string up into separate
  11420. on        tokens, deliminated by an arbitrary "white space".  It can be
  11421.           thought of as an iterator for strings and as an alternative to the
  11422.           ANSI C function strtok() which has the unfortunate side effect of
  11423.           changing the string being tokenized.
  11424.  
  11425. Example   #include <token.h>
  11426.           #include <rstream.h>
  11427.  
  11428.           main()
  11429.  
  11430.           {
  11431.             RWString a("Something is rotten in the state of Denmark");
  11432.  
  11433.             RWTokenizer next(a);     // Tokenize the string "a"
  11434.  
  11435.             RWString token;          // Will receive each token
  11436.  
  11437.             // Advance until the null string is returned:
  11438.             while( !(token=next().isNull() )
  11439.               cout << token << "\n";
  11440.           }
  11441.  
  11442.           Program output:
  11443.  
  11444.  
  11445.  
  11446.  
  11447.  
  11448.  
  11449. Rogue Wave      Tools.h++ Class Library                  368
  11450.  
  11451.  
  11452.  
  11453.  
  11454.  
  11455.  
  11456.  
  11457.  
  11458.                       CLASS REFERENCE
  11459.  
  11460.                        Something
  11461.                        is
  11462.                        rotten
  11463.                        in
  11464.                        the
  11465.                        state
  11466.                        of
  11467.                        Denmark
  11468.  
  11469.  
  11470. Public    RWTokenizer(const RWString& s);
  11471. construct Construct a tokenizer to lex the string s.
  11472. or
  11473.  
  11474.  
  11475. Public    RWSubString         operator()(const char* s =" \t\n");
  11476. member    Advance to the next token and return it as a
  11477. function  substring.  The token are considered to be
  11478.           deliminated by any of the characters in s.
  11479.  
  11480.  
  11481.  
  11482.  
  11483.  
  11484.  
  11485.  
  11486.  
  11487.  
  11488.  
  11489.  
  11490.  
  11491.  
  11492.  
  11493.  
  11494.  
  11495.  
  11496.  
  11497.  
  11498.  
  11499.  
  11500.  
  11501.  
  11502.  
  11503.  
  11504.  
  11505. Rogue Wave      Tools.h++ Class Library                  369
  11506.  
  11507.  
  11508.  
  11509.  
  11510.  
  11511.  
  11512.  
  11513.  
  11514.                       CLASS REFERENCE
  11515.  
  11516.  
  11517.  
  11518. class RWvistream                                   RWvistream
  11519.                                                         |
  11520.                                                        ios
  11521.  
  11522.                                           (V2.X style iostreams, only)
  11523.  
  11524. Synopsis  #include <vstream.h>
  11525.  
  11526.  
  11527.  
  11528. Descripti Class RWvistream is an abstract base class.  The classes derived
  11529. on        from it are expected to restore variables stored by their
  11530.           RWvostream counterpart.  Storage and retrieval done through the
  11531.           abstract classes RWvistream and RWvostream is done in a format-
  11532.           independent manner -- the user need not be concerned with how the
  11533.           variables will actually be stored or restored.  It might be done
  11534.           using an operating-system independent ASCII format (classes
  11535.           RWpistream and RWpostream), a binary format (classes RWbistream
  11536.           and RWbostream), or the user could define his or her own format
  11537.           (e.g., an interface to a network).
  11538.           No assumptions should be made about the format of how the
  11539.           variables might be stored.  That is up to the derived class to
  11540.           decide.  However, the functionality of the derived class is
  11541.           expected to follow the descriptions given for the virtual
  11542.           member functions below.
  11543.           Storage and retrieval is independent of whether the compiler
  11544.           is using AT&T V1.2 style "streams", or the newer V2.X style
  11545.           "iostreams" -- the user need not be concerned with which style
  11546.           is actually being used.  However, the inheritance tree is
  11547.           different for the two types of streams.  If the compiler uses
  11548.           V1.2 style streams, then RWvostream inherits from class
  11549.           istream, otherwise it inherits from virtual base class ios.
  11550.           Either way, the class RWvostream can be interrogated as to the
  11551.           stream state using member functions good(), bad(), eof(), etc.
  11552.           See class RWvostream for additional explanations and examples
  11553.           of format-independent stream storage.
  11554.  
  11555.  
  11556.  
  11557.  
  11558.  
  11559.  
  11560.  
  11561. Rogue Wave      Tools.h++ Class Library                  370
  11562.  
  11563.  
  11564.  
  11565.  
  11566.  
  11567.  
  11568.  
  11569.  
  11570.                       CLASS REFERENCE
  11571.  
  11572. Example   #include <vstream.h>
  11573.  
  11574.           void restoreStuff( RWvistream& str)
  11575.  
  11576.           {
  11577.  
  11578.             int i;
  11579.             double d;
  11580.             char string[80];
  11581.  
  11582.             str >> i;  // Restore an int
  11583.  
  11584.             str >> d;  // Restore a double
  11585.  
  11586.             // Restore a character string, up to 80 characters long:
  11587.             str.getString(string, sizeof(string));
  11588.  
  11589.             if(str.fail()) cerr << "Oh, oh, bad news.\n";
  11590.           }
  11591.  
  11592.  
  11593.  
  11594. Public    RWvistream(streambuf* s);
  11595. construct Initialize a RWvistream from the streambuf s.  This
  11596. or        constructor should be used if you define your own virtual
  11597.           stream class to implement your own format.
  11598.  
  11599. Public    virtual int         get() = 0;
  11600. member    Get and return the next char from the input stream, returning
  11601. functions its value.  Returns EOF if end of file is encountered.
  11602.  
  11603.    virtual RWvistream&    get(char& c) = 0;
  11604. Get the next char from the input stream, returning its value in c.
  11605.  
  11606.    virtual RWvistream&    get(unsigned char& c) = 0;
  11607. Get the next char from the input stream, returning its value in c.
  11608.  
  11609.    virtual RWvistream&    get(char* v, unsigned N) = 0;
  11610. Get a vector of char's and store then in the array beginning at v.
  11611. If the restore is stopped prematurely, get stores whatever it can in
  11612. v, and sets the failbit.  Note that the vector is treated as a
  11613. vector of numbers, not characters.  If you wish to restore a
  11614. character string, use function getString(char*, int).
  11615.  
  11616.  
  11617. Rogue Wave      Tools.h++ Class Library                  371
  11618.  
  11619.  
  11620.  
  11621.  
  11622.  
  11623.  
  11624.  
  11625.  
  11626.                       CLASS REFERENCE
  11627.  
  11628.    virtual RWvistream&    get(double* v, unsigned N) = 0;
  11629. Get a vector of double's and store then in the array beginning at v.
  11630. If the restore is stopped prematurely, get stores whatever it can in
  11631. v, and sets the failbit.
  11632.  
  11633.    virtual RWvistream&    get(float* v, unsigned N) = 0;
  11634. Get a vector of float's and store then in the array beginning at v.
  11635. If the restore is stopped prematurely, get stores whatever it can in
  11636. v, and sets the failbit.
  11637.  
  11638.    virtual RWvistream&    get(int* v, unsigned N) = 0;
  11639. Get a vector of int's and store then in the array beginning at v.
  11640. If the restore is stopped prematurely, get stores whatever it can in
  11641. v, and sets the failbit.
  11642.  
  11643.    virtual RWvistream&    get(long* v, unsigned N) = 0;
  11644. Get a vector of long's and store then in the array beginning at v.
  11645. If the restore is stopped prematurely, get stores whatever it can in
  11646. v, and sets the failbit.
  11647.  
  11648.    virtual RWvistream&    get(short* v, unsigned N) = 0;
  11649. Get a vector of short's and store then in the array beginning at v.
  11650. If the restore is stopped prematurely, get stores whatever it can in
  11651. v, and sets the failbit.
  11652.  
  11653.    virtual RWvistream&    get(unsigned char* v, unsigned N) = 0;
  11654. Get a vector of unsigned char's and store then in the array
  11655. beginning at v.  If the restore is stopped prematurely, get stores
  11656. whatever it can in v, and sets the failbit.  Note that the vector is
  11657. treated as a vector of numbers, not characters.  If you wish to
  11658. restore a character string, use function getString(char*, int).
  11659.  
  11660.    virtual RWvistream&    get(unsigned short* v, unsigned N) = 0;
  11661. Get a vector of unsigned short's and store then in the array
  11662. beginning at v.  If the restore is stopped prematurely, get stores
  11663. whatever it can in v, and sets the failbit.
  11664.  
  11665.    virtual RWvistream&    get(unsigned int* v, unsigned N) = 0;
  11666. Get a vector of unsigned int's and store then in the array beginning
  11667. at v.  If the restore is stopped prematurely, get stores whatever it
  11668. can in v, and sets the failbit.
  11669.  
  11670.    virtual RWvistream&    get(unsigned long* v, unsigned N) = 0;
  11671. Get a vector of unsigned long's and store then in the array
  11672.  
  11673. Rogue Wave      Tools.h++ Class Library                  372
  11674.  
  11675.  
  11676.  
  11677.  
  11678.  
  11679.  
  11680.  
  11681.  
  11682.                       CLASS REFERENCE
  11683.  
  11684. beginning at v.  If the restore is stopped prematurely, get stores
  11685. whatever it can in v, and sets the failbit.
  11686.  
  11687.    virtual RWvistream&    getString(char* s, unsigned N) = 0;
  11688. Restores a character string from the input stream and stores it in
  11689. the array beginning at s.  The function stops reading at the end of
  11690. the string or after N-1 characters, whichever comes first.  If the
  11691. latter, then the failbit of the stream will be set.  In either case,
  11692. the string will be terminated with a null byte.
  11693.  
  11694.    virtual RWvistream&    operator>>(char& c) = 0;
  11695. Get the next character from the input stream and store it in c.
  11696.  
  11697.    virtual RWvistream&    operator>>(double& d) = 0;
  11698. Get the next double from the input stream and store it in d.
  11699.  
  11700.    virtual RWvistream&    operator>>(float& f) = 0;
  11701. Get the next float from the input stream and store it in f.
  11702.  
  11703.    virtual RWvistream&    operator>>(int& i) = 0;
  11704. Get the next int from the input stream and store it in i.
  11705.  
  11706.    virtual RWvistream&    operator>>(long& l) = 0;
  11707. Get the next long from the input stream and store it in l.
  11708.  
  11709.    virtual RWvistream&    operator>>(short& s) = 0;
  11710. Get the next short from the input stream and store it in s.
  11711.  
  11712.    virtual RWvistream&    operator>>(unsigned char& c) = 0;
  11713. Get the next unsigned char from the input stream and store it in c.
  11714.  
  11715.    virtual RWvistream&    operator>>(unsigned short& s) = 0;
  11716. Get the next unsigned short from the input stream and store it in s.
  11717.  
  11718.    virtual RWvistream&    operator>>(unsigned int& i) = 0;
  11719. Get the next unsigned int from the input stream and store it in i.
  11720.  
  11721.    virtual RWvistream&    operator>>(unsigned long& l) = 0;
  11722. Get the next unsigned long from the input stream and store it in l.
  11723.  
  11724.  
  11725.  
  11726.  
  11727.  
  11728.  
  11729. Rogue Wave      Tools.h++ Class Library                  373
  11730.  
  11731.  
  11732.  
  11733.  
  11734.  
  11735.  
  11736.  
  11737.  
  11738.                       CLASS REFERENCE
  11739.  
  11740.  
  11741.  
  11742. class RWvostream                                      RWvostream
  11743.                                                            |
  11744.                                                           ios
  11745.  
  11746.                                              (V2.X style iostreams, only)
  11747.  
  11748. Synopsis  #include <vstream.h>
  11749.  
  11750.  
  11751.  
  11752. Descripti Class RWvostream is an abstract base class.  The classes derived from
  11753. on        it are expected to store variables to be restored by their RWvistream
  11754.           counterpart.  Storage and retrieval done through the abstract classes
  11755.           RWvistream and RWvostream should be done in a format-independent
  11756.           manner -- the user need not be concerned with how the variables will
  11757.           actually be stored or restored.  It might be done using an operating-
  11758.           system independent ASCII format (classes RWpistream and RWpostream),
  11759.           a binary format (classes RWbistream and RWbostream), or the user
  11760.           could define his or her own format (e.g., an interface to a network).
  11761.           Note that because it is an abstract base class, there is no way to
  11762.           actually enforce these goals -- the description here is merely the
  11763.           model of how a class derived from RWvistream and RWvostream should
  11764.           act.
  11765.           No assumptions should be made about the format of how the
  11766.           variables might be stored.  That is up to the derived class to
  11767.           decide.  However, the functionality of the derived class is
  11768.           expected to follow the descriptions given for the virtual
  11769.           member functions below.  Note that there is no need to
  11770.           separate variables with whitespace.  It is the responsibility
  11771.           of the derived class to delineate variables with whitespace,
  11772.           packet breaks, or whatever might be appropriate for the final
  11773.           output sink.  The model is one where variables are inserted
  11774.           into the output stream, either individually or as homogeneous
  11775.           vectors, to be restored in the same order using RWvistream.
  11776.           Storage and retrieval is independent of whether the compiler
  11777.           is using AT&T V1.2 style "streams", or the newer V2.X style
  11778.           "iostreams" -- the user need not be concerned with which style
  11779.           is actually being used.  However, the inheritance tree is
  11780.           different for the two types of streams.  If the compiler uses
  11781.           V1.2 style streams, then RWvostream inherits from class
  11782.           istream, otherwise it inherits from class ios.  Either way,
  11783.           the class RWvostream can be interrogated as to the stream
  11784.  
  11785. Rogue Wave      Tools.h++ Class Library                  374
  11786.  
  11787.  
  11788.  
  11789.  
  11790.  
  11791.  
  11792.  
  11793.  
  11794.                       CLASS REFERENCE
  11795.  
  11796.           state using member functions good(), bad(), eof(), etc.
  11797.           Storage and retrieval of characters requires some explanation.
  11798.           Characters can be thought of as either representing some
  11799.           alphanumeric or control character, or as the literal number.
  11800.           Generally, the overloaded lshift (<<) and rshift (>>)
  11801.           operators seek to store and restore characters preserving
  11802.           their symbolic meaning.  I.e., storage of a newline should be
  11803.           restored as a newline, irregardless of its representation on
  11804.           the target machine.  By contrast, member functions get() and
  11805.           put() should treat the character as a literal number, whose
  11806.           value is to be preserved.
  11807.  
  11808. Example   #include <vstream.h>
  11809.  
  11810.           void storeStuff( RWvostream& str)
  11811.  
  11812.           {
  11813.  
  11814.             int i = 5;
  11815.             double d = 22.5;
  11816.             char string[] = "A string with \t tabs and a newline\n";
  11817.  
  11818.             str << i;  // Store an int
  11819.  
  11820.             str << d;  // Store a double
  11821.  
  11822.             str << string;           // Store a string
  11823.  
  11824.             if(str.fail()) cerr << "Oh, oh, bad news.\n";
  11825.           }
  11826.  
  11827.  
  11828.  
  11829. Public    RWvostream(streambuf* s);
  11830. construct Initialize a RWvostream from the streambuf s.  This constructor
  11831. or        should be used if you define your own virtual stream class to
  11832.           implement your own format.
  11833.  
  11834.    virtual RWvostream&    operator<<(const char* s) = 0;
  11835. Store the character string starting at s to the output stream.  The
  11836. character string is expected to be null terminated.
  11837.  
  11838.    virtual RWvostream&    operator<<(char c) = 0;
  11839. Store the char c to the output stream.  Note that c is treated as a
  11840.  
  11841. Rogue Wave      Tools.h++ Class Library                  375
  11842.  
  11843.  
  11844.  
  11845.  
  11846.  
  11847.  
  11848.  
  11849.  
  11850.                       CLASS REFERENCE
  11851.  
  11852. character, not a number.
  11853.  
  11854.    virtual RWvostream&    operator<<(unsigned char c) = 0;
  11855. Store the unsigned char c to the output stream.  Note that c is
  11856. treated as a character, not a number.
  11857.  
  11858.    virtual RWvostream&    operator<<(double d) = 0;
  11859. Store the double d to the output stream.
  11860.  
  11861.    virtual RWvostream&    operator<<(float f) = 0;
  11862. Store the float f to the output stream.
  11863.  
  11864.    virtual RWvostream&    operator<<(int i) = 0;
  11865. Store the int i to the output stream.
  11866.  
  11867.    virtual RWvostream&    operator<<(unsigned int i) = 0;
  11868. Store the unsigned int i to the output stream.
  11869.  
  11870.    virtual RWvostream&    operator<<(long l) = 0;
  11871. Store the long l to the output stream.
  11872.  
  11873.    virtual RWvostream&    operator<<(unsigned long l) = 0;
  11874. Store the unsigned long l to the output stream.
  11875.  
  11876.    virtual RWvostream&    operator<<(short s) = 0;
  11877. Store the short s to the output stream.
  11878.  
  11879.    virtual RWvostream&    operator<<(unsigned short s) = 0;
  11880. Store the unsigned short s to the output stream.
  11881.  
  11882.    virtual RWvostream&    put(char c) = 0;
  11883. Store the char c to the output stream, preserving its value.
  11884.  
  11885.    virtual RWvostream&    put(unsigned char c) = 0;
  11886. Store the char c to the output stream, preserving its value.
  11887.  
  11888.    virtual RWvostream&    put(const char* p, unsigned N) = 0;
  11889. Store the vector of chars starting at p to the output stream.  The
  11890. chars should be treated as literal numbers (i.e., not as a character
  11891. string).
  11892.  
  11893.    virtual RWvostream&    put(const unsigned char* p, unsigned N) = 0;
  11894. Store the vector of unsigned chars starting at p to the output
  11895. stream.  The chars should be treated as literal numbers (i.e., not
  11896.  
  11897. Rogue Wave      Tools.h++ Class Library                  376
  11898.  
  11899.  
  11900.  
  11901.  
  11902.  
  11903.  
  11904.  
  11905.  
  11906.                       CLASS REFERENCE
  11907.  
  11908. as a character string).
  11909.  
  11910.    virtual RWvostream&    put(const short* p, unsigned N) = 0;
  11911. Store the vector of shorts starting at p to the output stream.
  11912.  
  11913.    virtual RWvostream&    put(const unsigned short* p, unsigned N) = 0;
  11914. Store the vector of unsigned shorts starting at p to the output
  11915. stream.
  11916.  
  11917.    virtual RWvostream&    put(const int* p, unsigned N) = 0;
  11918. Store the vector of ints starting at p to the output stream.
  11919.  
  11920.    virtual RWvostream&    put(const unsigned int* p, unsigned N) = 0;
  11921. Store the vector of unsigned ints starting at p to the output
  11922. stream.
  11923.  
  11924.    virtual RWvostream&    put(const long* p, unsigned N) = 0;
  11925. Store the vector of longs starting at p to the output stream.
  11926.  
  11927.    virtual RWvostream&    put(const unsigned long* p, unsigned N) = 0;
  11928. Store the vector of unsigned longs starting at p to the output
  11929. stream.
  11930.  
  11931.    virtual RWvostream&    put(const float* p, unsigned N) = 0;
  11932. Store the vector of floats starting at p to the output stream.
  11933.  
  11934.    virtual RWvostream&    put(const double* p, unsigned N) = 0;
  11935. Store the vector of doubles starting at p to the output stream.
  11936.  
  11937.  
  11938.  
  11939.  
  11940.  
  11941.  
  11942.  
  11943.  
  11944.  
  11945.  
  11946.  
  11947.  
  11948.  
  11949.  
  11950.  
  11951.  
  11952.  
  11953. Rogue Wave      Tools.h++ Class Library                  377
  11954.  
  11955.  
  11956.  
  11957.  
  11958.  
  11959.  
  11960.  
  11961.  
  11962.  
  11963.  
  11964.  
  11965.                                                             Appendix A:
  11966.                                         Summary of typedefs and macros:
  11967.  
  11968.  
  11969.  
  11970. Macros:
  11971.   #define   FALSE                  0
  11972.   #define   KEY_SIZE               16
  11973.   #define   nil                    0
  11974.   #define   NIL                    _1L
  11975.   #define   TRUE                   1
  11976.  
  11977. Typedefs:
  11978.   typedef   const char*  CharP;
  11979.   typedef   unsigned short         ClassID;  // Unique for each class
  11980.   typedef   unsigned long          clockTy;  // seconds
  11981.   typedef   unsigned     dayTy;    // days
  11982.   typedef   int          fileDescTy; // File descriptor
  11983.   typedef   unsigned     hourTy;   // hours
  11984.   typedef   unsigned long          julTy;    // Julian days
  11985.   typedef   unsigned     minuteTy; // minutes
  11986.   typedef   unsigned     monthTy;  // months
  11987.   typedef   long         nodeOffset; // Used for file offsets
  11988.   typedef   int          RWBoolean;  // TRUE or FALSE
  11989.   typedef   long         RWoffset; // Used for file offsets
  11990.   typedef   void*        RWvoid;   // Useful for arrays of void*
  11991.   typedef   unsigned     secondTy; // seconds
  11992.   typedef   unsigned     RWspace;  // Used for file records
  11993.   typedef   long         storedValue;// Used for file offsets
  11994.   typedef   unsigned     yearTy;   // years
  11995.  
  11996.  
  11997.  
  11998.  
  11999.  
  12000.  
  12001.  
  12002.  
  12003.  
  12004.  
  12005.  
  12006.  
  12007.  
  12008.  
  12009. Tools.h++ Class Library     379
  12010.  
  12011.  
  12012.  
  12013.  
  12014.  
  12015.  
  12016.  
  12017.  
  12018.                           APPENDIX
  12019.  
  12020. Pointers to Functions:
  12021.   typedef   void         (*RWapplyCollectable)(RWCollectable*, void*);
  12022.   typedef   void         (*RWapplyGeneric)(void*, void*);
  12023.   typedef   void         (*RWapplyKeyAndValue)(RWCollectable*,
  12024.                                          RWCollectable*, void*);
  12025.   typedef   RWBoolean    (*RWtestGeneric)(const void*,const void*);
  12026.   typedef   RWBoolean    (*RWtestCollectable)(const RWCollectable*,
  12027.                                          const void*);
  12028.   typedef   RWCollectable*               (*userCreator)();
  12029.  
  12030. Enumerations:
  12031.   enum      RWSeverity   {RWWARNING, RWDEFAULT, RWFATAL}
  12032.  
  12033.           Standard Smalltalk Interface:
  12034.   typedef RWBag                    Bag;
  12035.   typedef RWBagIterator            BagIterator;
  12036.   typedef RWBinaryTree             SortedCollection;
  12037.   typedef RWBinaryTreeIterator     SortedCollectionIterator;
  12038.   typedef RWBitVec                 BitVec
  12039.   typedef RWCollectable            Object; // All-to-common type!
  12040.   typedef RWCollectableDate        Date;
  12041.   typedef RWCollectableInt         Integer;
  12042.   typedef RWCollectableString      String;
  12043.   typedef RWCollectableTime        Time;
  12044.   typedef RWCollection             Collection;
  12045.   typedef RWHashDictionary         Dictionary;
  12046.   typedef RWHashDictionaryIterator DictionaryIterator;
  12047.   typedef RWIdentityDictionary     IdentityDictionary;
  12048.   typedef RWIdentityHash           IdentitySet;
  12049.   typedef RWOrdered                OrderedCollection;
  12050.   typedef RWOrderedIterator        OrderedCollectionIterator;
  12051.   typedef RWSequenceable           SequenceableCollection;
  12052.   typedef RWSet                    Set;
  12053.   typedef RWSetIterator            SetIterator;
  12054.   typedef RWSlistCollectables      LinkedList;
  12055.   typedef RWSlistCollectablesIterator   LinkedListIterator;
  12056.   typedef RWSlistCollectablesQueue Queue;
  12057.   typedef RWSlistCollectablesStack Stack;
  12058.  
  12059.  
  12060.  
  12061.  
  12062.  
  12063.  
  12064.  
  12065. Rogue Wave      Tools.h++ Class Library                  380
  12066.  
  12067.  
  12068.  
  12069.  
  12070.  
  12071.  
  12072.  
  12073.  
  12074.  
  12075.  
  12076.  
  12077.                                                             Appendix B:
  12078.                                                            Bibliography
  12079.  
  12080.  
  12081.  
  12082.           Ammeraal, L.  Programs and Data Structures in C, John Wiley
  12083.              and Sons, 1989, ISBN 0-471-91751-6.
  12084.           Booch, Grady, Object-Oriented Design with Applications, The
  12085.              Benjamin Cummings Publishing Company, Inc., 1991, ISBN 0-
  12086.              8053-0091-0.
  12087.           Eckel, Bruce, Using C++, Osborne McGraw-Hill, 1989, ISBN 0-07-
  12088.              881522-3.
  12089.           Ellis, Margaret A. and Bjarne Stroustrup, The Annotated C++
  12090.              Reference Manual, Addison-Wesley, 1990, ISBN 0-201-51459-
  12091.              1.
  12092.           Goldberg, Adele and David Robson, Smalltalk-80, The Language,
  12093.              Addison-Wesley, 1989, ISBN 0-201-13688-0.
  12094.           Gorlen, Keith, The NIH Class Library, Computer Systems
  12095.              Laboratory, DCRT, National Institutes of Health, Bethesda,
  12096.              MD 20892.
  12097.           Gorlen, Keith, Sanford M. Orlow and Perry S. Plexico, Data
  12098.              Abstraction and Object-Oriented Programming in C++, John
  12099.              Wiley and Sons, 1990, ISBN 0-471-92346 X.
  12100.           Khoshafian, Setrag and Razmik Abnous, Object orientation:
  12101.              Concepts, Languages, Databases, User Interfaces, John
  12102.              Wiley and Sons, 1990, ISBN 0-471-51802-6.
  12103.           Lippman, Stanley B. C++ Primer, Addison-Wesley, 1989, ISBN 0-
  12104.              201-16487-6.
  12105.           Meyer, Bertrand, Object-oriented Software Construction,
  12106.              Prentice-Hall, 1988, ISBN 0-13-629049-3.
  12107.           Petzold, Charles, Programming Windows, Microsoft Press, 1990,
  12108.              ISBN 1-55615-264-7.
  12109.           Sedgewick, Robert. Algorithms, Addison-Wesley, 1988, ISBN 0-
  12110.              201-06673-4.
  12111.           Stroustrup,  Bjarne. The C++ Programming Language, Addison-
  12112.              Wesley, 1986, ISBN 0-201-12078-X.
  12113.  
  12114.  
  12115.  
  12116.  
  12117.  
  12118.  
  12119.  
  12120.  
  12121. Tools.h++ Class Library     381
  12122.  
  12123.  
  12124.  
  12125.  
  12126.  
  12127.  
  12128.  
  12129.  
  12130.  
  12131.  
  12132.  
  12133.                                                                   Index
  12134.  
  12135.  
  12136. Apply functions 73, 83
  12137. apply() 73, 83
  12138. Architectural notes 104
  12139. AT&T 13, 20
  12140. Bag 157
  12141. Bibliography 303
  12142. Bit vector 133, 169
  12143. Borland 18
  12144. Borland C++ 19
  12145. Caches
  12146.   RWCacheManager 186
  12147. ClassID 192, 224, 301
  12148. clear() 84
  12149. clearAndDestroy() 84
  12150. Clipboard 45
  12151. clockTy 301
  12152. Collection 202
  12153. Collection Classes
  12154.   abstract base class 202
  12155.   Dictionary 87
  12156.   generic 16, 67
  12157.      declaration 69
  12158.      GBitVec(size) 133
  12159.      GDlist(type) 136
  12160.      GQueue(type) 143
  12161.      GSlist(type) 145
  12162.      GSortedVector(val) 150
  12163.      GStack(type) 153
  12164.      user-defined functions 70
  12165.   Hash 88
  12166.   introduction 61
  12167.   RWBag 157
  12168.   RWBinaryTree 161
  12169.      example 124
  12170.   RWBTree 178
  12171.   RWBTreeOnDisk 184
  12172.      example 126
  12173.   RWDlistCollectables 216
  12174.  
  12175.  
  12176.  
  12177. Tools.h++ Class Library     383
  12178.  
  12179.  
  12180.  
  12181.  
  12182.  
  12183.  
  12184.  
  12185.  
  12186.                            INDEX
  12187.  
  12188.   RWHashDictionary
  12189.      example 126
  12190.   RWIdentitySet 238
  12191.   RWOrdered 242, 274
  12192.   RWSet 259
  12193.   RWSlistCollectables 263
  12194.   RWSlistCollectablesQueue 269
  12195.   RWSlistCollectablesStack 272
  12196.   selection 84
  12197.   Smalltalk-like 16, 75
  12198.   storing and retrieving 104
  12199.   virtual functions 79
  12200. Compares equal 62
  12201.   definition 132
  12202. compareTo() 94, 191
  12203. Compilers
  12204.   supported 3
  12205. Compiling a program 15
  12206.   AT&T 20
  12207.   Borland 18
  12208.   DOS 18
  12209.   Glockenspiel 20
  12210.   Unix 20
  12211.   Zortech 19
  12212. contains() 80
  12213. Conventions 4
  12214. Copies
  12215.   shallow vs. deep 63
  12216. Copy constructor 30, 64
  12217. Create functions 98, 224
  12218. Date 194
  12219. dayTy 301
  12220. DDE 45, 212
  12221.   example 45
  12222. Debugging 14, 107
  12223. Deep copy 64
  12224. DEFINE_COLLECTABLE 98
  12225. Dictionary 87, 231
  12226.   RWBTreeDictionary 181
  12227.   RWHashDictionary 231
  12228.   RWIdentityDictionary 237
  12229. Diskette contents 7
  12230. DLL 111
  12231.   compiling with 19
  12232.  
  12233. Rogue Wave      Tools.h++ Class Library                  384
  12234.  
  12235.  
  12236.  
  12237.  
  12238.  
  12239.  
  12240.  
  12241.  
  12242.                            INDEX
  12243.  
  12244.   example 111
  12245. Dynamic Data Exchange (See DDE)
  12246. Dynamic Link Library (See DLL)
  12247. Efficiency 30
  12248. entries() 80
  12249. Equal to
  12250.   definition 131
  12251. Errors 107
  12252.   asynchronous 109
  12253.   error handler 110, 223
  12254.   invalid input 108
  12255.   numbers 110
  12256.   violated preconditions 107
  12257. Examples 123-127
  12258. Exception handling 109
  12259. FALSE 301
  12260. File suffixes 7
  12261. fileDescTy 301
  12262. find() 80
  12263. GBitVec(size) 133, 169
  12264. GDlist(type) 136
  12265.   example 124
  12266. GDlistIterator(type) 140
  12267. Glockenspiel
  12268.   Unix 13
  12269. GQueue(type) 143
  12270. Gregorian calendar 37
  12271. GSlist(type) 145
  12272. GSlistIterator(type) 148
  12273. GSortedVector(val) 150
  12274. GStack(type) 153
  12275. GVector(val) 155
  12276. hash() 88, 97, 192
  12277. Hashing collections 88
  12278. HCR 13, 20
  12279. Header files 15
  12280. hourTy 301
  12281. Identical to
  12282.   definition 131
  12283. IdentityDictionary 237
  12284. IdentitySet 238
  12285. Implementation notes 107
  12286. insert() 80
  12287. Installation 7
  12288.  
  12289. Rogue Wave      Tools.h++ Class Library                  385
  12290.  
  12291.  
  12292.  
  12293.  
  12294.  
  12295.  
  12296.  
  12297.  
  12298.                            INDEX
  12299.  
  12300.   Glockenspiel 9
  12301.   MS-DOS 8
  12302.   Zortech 9
  12303. Integer 196
  12304. Interviews Class Library 226
  12305. iostream 41
  12306. isA() 94, 192
  12307. isEmpty() 80
  12308. isEqual 62
  12309. isEqual() 96, 192
  12310. isSame 62
  12311. Iterator 86
  12312.   abstract base class 241
  12313.   GDlist(type) 140
  12314.   GSlist(type) 148
  12315.   RWBag 160
  12316.   RWBinaryTree 164
  12317.   RWDlistCollectables 220
  12318.   RWHashDictionary 235
  12319.   RWIterator 241
  12320.   RWOrdered 245
  12321.   RWSet 262
  12322.   RWSlistCollectables 267
  12323.   vs. function apply() 86
  12324. julTy 301
  12325. KEY_SIZE 184, 301
  12326. Libraries
  12327.   naming convention 10
  12328.   precompiled 8
  12329.   recompiling
  12330.      Borland 10
  12331.      Glockenspiel 12
  12332.      MS-DOS 10
  12333.      Unix 12
  12334.      Zortech 11
  12335. Linked List
  12336.   generic
  12337.      doubly-linked 136
  12338.      singly-linked 145
  12339.   of Collectables
  12340.      doubly-linked 216
  12341.      singly-linked 263
  12342. LinkedList 263
  12343. LinkedListIterator 267
  12344.  
  12345. Rogue Wave      Tools.h++ Class Library                  386
  12346.  
  12347.  
  12348.  
  12349.  
  12350.  
  12351.  
  12352.  
  12353.  
  12354.                            INDEX
  12355.  
  12356. Makefiles 7
  12357. Math.h++ 14
  12358. megalomania 4
  12359. minuteTy 301
  12360. monthTy 301
  12361. Multiple inheritance 63
  12362. newSpecies() 97
  12363. nil 301
  12364. NL 23
  12365. nodeOffset 301
  12366. Oasys 13
  12367. Object 191
  12368.   identity 62
  12369. occurrencesOf() 80
  12370. Oregon Software 13
  12371. PFile 226
  12372. Philosophy 3
  12373. Preconditions 107
  12374. Queue 269
  12375.   generic 143
  12376.   of Collectables 269
  12377. Recursion (See Recursion)
  12378. Reference counting 30
  12379. Reference semantics 64
  12380. Regular expressions 34, 254, 279
  12381. remove() 82
  12382. removeAndDestroy() 82
  12383. restoreFrom() 90, 101, 192
  12384. restoreGuts() 98, 192
  12385. rstream.h 23
  12386. RWBag 157
  12387. RWBagIterator 160
  12388. RWBinaryTree 78, 161
  12389. RWBinaryTreeIterator 164
  12390. RWbistream 165
  12391.   example 43
  12392. RWBitVec 133, 169
  12393. RWBoolean 301
  12394. RWbostream 174
  12395.   example 43
  12396. RWBTree 178
  12397. RWBTreeDictionary 181
  12398. RWBTreeOnDisk 57, 126, 184
  12399. RWCacheManager 186
  12400.  
  12401. Rogue Wave      Tools.h++ Class Library                  387
  12402.  
  12403.  
  12404.  
  12405.  
  12406.  
  12407.  
  12408.  
  12409.  
  12410.                            INDEX
  12411.  
  12412. RWCLIPstreambuf 188
  12413. RWCollectable 191
  12414.   comparison 94
  12415.   designing 92
  12416.   storing and retrieving 89, 101
  12417.   virtual destructor 94
  12418.   virtual functions 92
  12419. RWCollectableDate 194
  12420. RWCollectableInt 196
  12421. RWCollectableString 78, 198
  12422. RWCollectableTime 200
  12423. RWCollection 202
  12424. RWDate 37, 58, 194, 206
  12425.   example 123
  12426. RWDDEstreambuf 212
  12427.   example 45
  12428. RWDlistCollectables 216
  12429. RWDlistCollectablesIterator 220
  12430. RWErrObject 110, 222
  12431. RWFactory 98, 224
  12432. RWFile 47, 49, 226, 229
  12433. RWFileManager 51, 57, 184, 229
  12434. RWHashDictionary 231
  12435. RWHashDictionaryIterator 235
  12436. RWIdentityDictionary 237
  12437. RWIdentitySet 238
  12438. RWInteger 196, 239
  12439. RWIterator 241
  12440. RWoffset 51, 229, 301
  12441. RWOrdered 242
  12442. RWOrderedIterator 245
  12443. RWpistream 246
  12444. RWpostream 250
  12445. RWRegexp 254
  12446. RWSequenceable 257
  12447.   virtual functions 85
  12448. RWSet 259
  12449. RWSetIterator 262
  12450. RWSlistCollectables 263
  12451. RWSlistCollectablesIterator 267
  12452. RWSlistCollectablesQueue 269
  12453. RWSlistCollectablesStack 272
  12454. RWSortedVector 274
  12455. RWspace 51, 229, 301
  12456.  
  12457. Rogue Wave      Tools.h++ Class Library                  388
  12458.  
  12459.  
  12460.  
  12461.  
  12462.  
  12463.  
  12464.  
  12465.  
  12466.                            INDEX
  12467.  
  12468. RWString 29, 198, 277
  12469.   example 123
  12470.   pattern matching 33
  12471.   substrings 33, 284
  12472. RWSubString 33, 284
  12473. RWTime 39, 200, 287
  12474.   example 123
  12475. RWTokenizer 35, 291
  12476. RWvistream 41, 293
  12477. RWvostream 41, 297
  12478. saveGuts() 97, 192
  12479. saveOn() 90, 101, 193
  12480. SCO 13
  12481. secondTy 301
  12482. select() 84
  12483. SequenceableCollection 257
  12484. Set 259
  12485. setw() 59
  12486. Shallow copy 64
  12487. shallowStoreSize() 193
  12488. Smalltalk
  12489.   typedefs 302
  12490. SortedCollection 78, 161
  12491. SortedCollectionIterator 164
  12492. Stack 272
  12493.   generic 153
  12494.   of Collectables 272
  12495. storedValue 57, 184, 301
  12496. Storing and retrieving
  12497.   RWCollectables 101
  12498.   to RWFiles 47
  12499.   to virtual streams 41
  12500. Stream I/O 23
  12501.   memory based 45
  12502.   RWbistream 165
  12503.   RWbostream 174
  12504.   RWpistream 246
  12505.   RWpostream 250
  12506.   RWvistream 293
  12507.   RWvostream 297
  12508.   virtual streams 41
  12509. streambufs
  12510.   Windows specializing 45
  12511. String 198, 277
  12512.  
  12513. Rogue Wave      Tools.h++ Class Library                  389
  12514.