home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dbutil.zip / BUFOP.ZIP / PCTYPES.CPP < prev    next >
Text File  |  1993-08-30  |  2KB  |  92 lines

  1. #include "pctypes.hpp"
  2. #include <Istring.hpp>
  3.  
  4. // I'm more than unsure about this BUT...
  5. // I think each type that will be put into the collection classes
  6. // (that will use key access) must have a separate header file
  7. // One of these days I will understand the syntax of C++;
  8. //
  9. // I'm not sure when to just make a header file an when to
  10. // make a cpp file also.  Seems most of the books I read says this
  11. // (putting code into a h file) should not be done
  12. // yet when I look at the example programs from IBM, they
  13. // all seem to to it for "small" h files.
  14. // Took this style from an IBM example
  15. // but seems strange to me.
  16.  
  17.  
  18. // constructors
  19.  Vtype ::Vtype( IString & name,
  20.                    short type,
  21.                    short dlength, 
  22.                    Boolean Obj)
  23.     {
  24.         typeName = name;
  25.         sqlType = type;
  26.         anObj   = Obj;
  27.         defaultLength = dlength;
  28.     }
  29.     Vtype ::Vtype() {
  30.         typeName = "";
  31.         sqlType  = 0;
  32.         anObj    = false;
  33.         defaultLength = 1;
  34.     }
  35. // destructors
  36.   Vtype::~Vtype() {}
  37.  
  38. // public methods
  39. void Vtype::setParams(char * name, short type,short len, Boolean Obj)
  40.   {
  41.    typeName = name;
  42.    sqlType = type;
  43.    defaultLength = len;
  44.    anObj   = Obj;
  45.    }
  46. // assigment operator
  47. Vtype & Vtype::operator=( Vtype const& v)
  48.  {if (this == & v )
  49.         return *this;
  50.   typeName = v.typeName;
  51.   sqlType  = v.sqlType;
  52.   anObj    = v.anObj;
  53.   defaultLength = v.defaultLength;
  54. }
  55.  
  56. Boolean Vtype::operator==( Vtype const & v)const   {
  57.      return  (typeName == v.typeName);
  58.   }
  59.  
  60. Boolean Vtype::operator<(Vtype const& v)   {
  61.      return  (typeName < v.typeName);
  62.   }
  63.  
  64. Boolean Vtype::operator>(Vtype const& v)
  65.     {
  66.      return  (typeName > v.typeName);
  67.      }
  68. Boolean Vtype::operator!=(Vtype const& v)
  69.     {
  70.      return  (typeName != v.typeName);
  71.       }
  72.  
  73. Boolean Vtype::operator <=(Vtype const & v)
  74.      {return *this > v;}
  75.  
  76. Boolean Vtype::operator >=(Vtype const & v)
  77.      {return *this < v;}
  78.  
  79.  
  80. void Vtype::setName(IString & name) 
  81.         {typeName = name;}
  82. void Vtype::setType(short type)     
  83.         {sqlType = type;}
  84. void Vtype::setObj(Boolean O)
  85.         {anObj = O;}
  86. IString const& Vtype::getName() const 
  87.         {return typeName;}
  88. short  Vtype:: getType()const        {return sqlType;}
  89. short  Vtype:: getLen() const         {return defaultLength;}
  90. Boolean Vtype::isObj() const         {return anObj;}
  91.  
  92.