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

  1. #ifndef _PCTYPES_
  2. #define _PCTYPES_
  3. #include "Istring.hpp"
  4. // PCTypes.hpp    precompiler types
  5.  
  6. // I'm more than unsure about this BUT...
  7. // I think each type that will be put into the collection classes
  8. // (that will use key access) must have a separate header file
  9. // One of these days I will understand the syntax of C++;
  10. //
  11. // I'm not sure when to just make a header file an when to
  12. // make a cpp file also.  Seems most of the books I read says this
  13. // (putting code into a h file) should not be done
  14. // yet when I look at the example programs from IBM, they
  15. // all seem to to it for "small" h files.  
  16. // Took this style from an IBM example
  17. // but seems strange to me.
  18.  
  19.  
  20.  
  21. class Vtype            // types of variables that are acceptable   
  22.                       
  23. {                                                                           
  24.  public:                                                                    
  25.         // constructors                                                     
  26.     Vtype( IString & name, short type, short dlength=1, Boolean Obj=false);
  27.     Vtype();
  28.    ~Vtype();
  29.  
  30.   void setParams(char * name, short type, short len, Boolean Obj=false);
  31.   Vtype & operator=(Vtype const & v);
  32.   Boolean operator==( Vtype const& v) const;
  33.   Boolean operator<(Vtype const& v);
  34.   Boolean operator>(Vtype const& v);
  35.   Boolean operator!=(Vtype const& v);
  36.   Boolean operator <=(Vtype const & v);
  37.   Boolean operator >=(Vtype const & v);
  38.  
  39.  
  40.   void setName(IString & name);
  41.   void setType(short type);
  42.   void setObj(Boolean O=true);
  43.  
  44.   IString const& getName() const;
  45.   short   getType() const;
  46.   short   getLen() const;
  47.   Boolean isObj()const;
  48.                                                                             
  49.  private:                                                                   
  50.     IString typeName;        //  type name such as int, short, date         
  51.     short   sqlType;         //  the corresponding SQL type                 
  52.     Boolean anObj;           //  if type is an object (only IDate, IString) 
  53.     short   defaultLength;
  54.                                                                             
  55. };
  56.  
  57. inline IString const & key (Vtype const & V) {
  58.     return V.getName();
  59. }
  60. #endif
  61.