home *** CD-ROM | disk | FTP | other *** search
/ ftptest.leeds.ac.uk / 2015.02.ftptest.leeds.ac.uk.tar / ftptest.leeds.ac.uk / bionet / CAE-GROUP / SCL-WIN3x / SCL.EXE / SCL_STRI.H < prev    next >
C/C++ Source or Header  |  1994-08-06  |  2KB  |  77 lines

  1. #ifndef _SCL_STRING_H
  2. #define _SCL_STRING_H
  3.  
  4. /*
  5. * NIST Utils Class Library
  6. * clutils/scl_string.h
  7. * February, 1994
  8. * K. C. Morris
  9. * David Sauder
  10.  
  11. * Development of this software was funded by the United States Government,
  12. * and is not subject to copyright.
  13. */
  14.  
  15. /* $Id: scl_string.h,v 2.0.1.2 1994/04/05 16:44:13 sauderd Exp $ */
  16.  
  17.  
  18. /*  point of contact for bug reports  */
  19. #define _POC_  " report problem to dp1-bugs@cme.nist.gov "
  20.  
  21. //#include <std.h> // not found in CenterLine C++
  22. #ifdef __OBJECTCENTER__
  23. // this file is not in gnu C++ but it doesn't seem to be needed.
  24. #include <stdarg.h>
  25. #endif
  26. #include <iostream.h>
  27. #include <string.h>
  28.  
  29. /******************************************************************
  30. ** Class:  SCLstring
  31. ** Description: implements a few basic string handling functions - 
  32. **              hopefully will be replaced by a standard clas
  33.  ** Status:  26-Jan-1994 kc
  34.  ******************************************************************/
  35.  
  36. class SCLstring   {
  37. protected:
  38.   char * _strBuf;   //  initially empty
  39.   int _strBufSize;  // size of buffer
  40.   int _max_len;  // should be const, but some db\'s don\'t handle that
  41.  
  42.   int newBufSize (int len) const;
  43.  
  44. public:
  45.     int is_null() const;
  46.     int set_null() ;
  47.     int StrBufSize() const;
  48.     int Length() const;
  49.     int MaxLength() const    { return _max_len; }
  50.  
  51.     const char * chars () const
  52.     { return _strBuf ? _strBuf : ""; }
  53.  
  54.     const char * rep() const
  55.     { return _strBuf; }
  56.  
  57. //  operators
  58.     SCLstring& operator= (const char*); // must be NULL terminated string
  59.     SCLstring& operator= (char* s) // must be NULL terminated string
  60.     { operator= ((const char *)s); return *this; }
  61.     operator const char * () const;
  62.     int operator== (const char*) const;
  63.     SCLstring& Append (const char *);
  64.     SCLstring& Append (const char);
  65.     SCLstring& Append (const long int);
  66.     SCLstring& Append (const double, const int precision =15);
  67.     SCLstring& Prepend (const char *);
  68.  
  69. //constructor(s) & destructor    
  70.     SCLstring (const char * str = 0, int max =0);
  71.     SCLstring (const SCLstring& s);
  72.     ~SCLstring ();
  73.  
  74. };
  75.  
  76. #endif  //_SCL_STRING_H
  77.