home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ocl150a.zip / OCL / Source / slOString.cpp < prev   
C/C++ Source or Header  |  1996-08-12  |  3KB  |  98 lines

  1. // OCL - OS/2 Class Library
  2. // (c) Cubus 1995
  3. // All Rights Reserved
  4. // slOString.cpp
  5.  
  6. // String Functions sorted String list
  7.  
  8.  
  9. /*
  10.  * Redistribution and use in source and binary forms, with or without
  11.  * modification, are permitted provided that the following conditions
  12.  * are met:
  13.  * 1. Redistributions of source code must retain the above copyright
  14.  *    notice, this list of conditions and the following disclaimer.
  15.  * 2. Neither the name Cubus nor the name Team OCL may be used to
  16.  *    endorse or promote products derived from this software
  17.  *    without specific prior written permission.
  18.  * 3. See OCL.INF for a detailed copyright notice.
  19.  *
  20.  *              THIS SOFTWARE IS PROVIDED ``AS IS'' AND
  21.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  24.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  25.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  26.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  27.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  28.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  29.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  30.  * SUCH DAMAGE.
  31.  */
  32.  
  33. // $Header: W:/Projects/OCL/Source/rcs/slOString.cpp 1.50 1996/08/11 23:49:38 B.STEIN Release $
  34.  
  35. #define __OCL_SOURCE__
  36.  
  37. #define OINCL_OSTRING
  38. #define OINCL_BASE
  39.  
  40. #include <ocl.hpp>
  41. #include <slOString.hpp>
  42.  
  43. #if defined(__EMX__)
  44.   template class OSortedList<OString>;
  45. #endif
  46.  
  47.  
  48. slOString::slOString() 
  49.   : OSortedList<OString>(TRUE)
  50.   {}
  51.  
  52. slOString::~slOString() 
  53.   {}
  54.  
  55. PSZ slOString::isOfType() const
  56.  return("slOString"); 
  57.  
  58.  
  59. slOString& slOString::operator << (PCSZ string)
  60. {
  61.  OString str(string);
  62.  add(str);
  63.  return(*this);
  64. }
  65.  
  66. slOString& slOString::operator << (OString& string)
  67. {
  68.  return(*this << string.getText());
  69. }
  70.  
  71.  
  72. slOString& slOString::operator << (pOString string)
  73. {
  74.  pOString str;
  75.  
  76.  if (string) {
  77.    str = new OString(string->getText());
  78.    add(str);
  79.    delete str; }
  80.  return(*this);
  81. }
  82.  
  83.  
  84. BOOL slOString::isLess(const OString *first, const OString *second)
  85. {
  86.  if (!first)
  87.    return(TRUE);
  88.  else if (!second)
  89.    return(FALSE);
  90.  else
  91.    return(strcmpi(first->getText(), second->getText()) <= 0);
  92. }
  93.  
  94.  
  95. // end of source
  96.