home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / oclsrc15.zip / OCL / Include / OString.hpp < prev    next >
C/C++ Source or Header  |  1996-08-12  |  4KB  |  129 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // OString.hpp
  5.  
  6. /*
  7.  * Redistribution and use in source and binary forms, with or without
  8.  * modification, are permitted provided that the following conditions
  9.  * are met:
  10.  * 1. Redistributions of source code must retain the above copyright
  11.  *    notice, this list of conditions and the following disclaimer.
  12.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  13.  *    endorse or promote products derived from this software
  14.  *    without specific prior written permission.
  15.  * 3. See OCL.INF for a detailed copyright notice.
  16.  *
  17.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  18.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  19.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  20.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  21.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  22.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  23.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  24.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  25.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  26.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  27.  * SUCH DAMAGE.
  28.  */
  29.  
  30. // $Header: W:/Projects/OCL/Include/rcs/OString.hpp 1.50 1996/08/11 23:47:31 B.STEIN Release $
  31.  
  32. #ifndef OSTRING_INCLUDED
  33.   #define OSTRING_INCLUDED
  34.  
  35.  
  36. #ifndef OCLOBJECT_INCLUDED
  37.   #include <OCLObject.hpp>
  38. #endif
  39.  
  40.  
  41. // single text-line with unknown length
  42. typedef class OString *pOString;
  43.  
  44. class __CPP_EXPORT__ OString
  45.   : public OCLObject
  46. {
  47.  protected:
  48.     PSZ               text;
  49.  
  50.  public:
  51.  
  52.     OString           ();
  53.     OString           (PCSZ iText);
  54.     OString           (const OString& String);
  55.     OString           (const pOString String);
  56.     OString           (INT iLength);
  57.  
  58.     virtual
  59.        ~OString       ();
  60.  
  61.     virtual 
  62.        PSZ isOfType   () const;
  63.  
  64.     virtual
  65.        PSZ getText    () const;
  66.  
  67.     ULONG length      () const;
  68.  
  69.     int compare       (const OString& s1,
  70.                        const OString& s2) const;
  71.  
  72.     OString
  73.        &leftCut       (INT Letter),
  74.        &rightCut      (INT Letter),
  75.        &stripLeading  (INT Letter),
  76.        &stripTrailing (INT Letter),
  77.        &replace       (PCSZ string, PCSZ anOther),        
  78.        &operator <<   (PCSZ  string),
  79.        &operator <<   (const pOString string),
  80.        &operator <<   (INT     i),
  81.        &operator <<   (UINT   ui),
  82.        &operator <<   (LONG    l),
  83.        &operator <<   (ULONG  ul),
  84.        &operator <<   (double db),
  85.        &operator +    (PCSZ  string),
  86.        &operator +    (const pOString string),
  87.        &operator +    (INT     i),
  88.        &operator +    (UINT   ui),
  89.        &operator +    (LONG    l),
  90.        &operator +    (ULONG  ul),
  91.        &operator +    (double db),
  92.        &operator =    (PCSZ  anOther);
  93.  
  94.     BOOL
  95.        operator ==    (PCSZ anOther) const,
  96.        operator !=    (PCSZ anOther) const,
  97.        operator <     (PCSZ anOther) const,
  98.        operator >     (PCSZ anOther) const,
  99.        operator <=    (PCSZ anOther) const,
  100.        operator >=    (PCSZ anOther) const;
  101.  
  102.     friend istream
  103.        &operator >>   (istream& in, OString& s),
  104.        &operator >>   (istream& in, pOString s);
  105.  
  106.     friend ostream
  107.        &operator <<   (ostream& out, pOString s);
  108.  
  109.     inline
  110.        operator char* () const { return((char*)text); }
  111. };
  112.  
  113.  
  114.  
  115. #if ((defined OINCL_LOSTRING) || (defined OINCL_BASE))
  116.   #include <lOString.hpp>
  117. #endif
  118.  
  119.  
  120. #ifdef OINCL_SLOSTRING
  121.   #include <slOString.hpp>
  122. #endif
  123.  
  124.  
  125. #endif // OSTRING_INCLUDED
  126.  
  127.  
  128. // end of source
  129.