home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
dbutil.zip
/
BUFOP.ZIP
/
PCTYPES.CPP
< prev
next >
Wrap
Text File
|
1993-08-30
|
2KB
|
92 lines
#include "pctypes.hpp"
#include <Istring.hpp>
// I'm more than unsure about this BUT...
// I think each type that will be put into the collection classes
// (that will use key access) must have a separate header file
// One of these days I will understand the syntax of C++;
//
// I'm not sure when to just make a header file an when to
// make a cpp file also. Seems most of the books I read says this
// (putting code into a h file) should not be done
// yet when I look at the example programs from IBM, they
// all seem to to it for "small" h files.
// Took this style from an IBM example
// but seems strange to me.
// constructors
Vtype ::Vtype( IString & name,
short type,
short dlength,
Boolean Obj)
{
typeName = name;
sqlType = type;
anObj = Obj;
defaultLength = dlength;
}
Vtype ::Vtype() {
typeName = "";
sqlType = 0;
anObj = false;
defaultLength = 1;
}
// destructors
Vtype::~Vtype() {}
// public methods
void Vtype::setParams(char * name, short type,short len, Boolean Obj)
{
typeName = name;
sqlType = type;
defaultLength = len;
anObj = Obj;
}
// assigment operator
Vtype & Vtype::operator=( Vtype const& v)
{if (this == & v )
return *this;
typeName = v.typeName;
sqlType = v.sqlType;
anObj = v.anObj;
defaultLength = v.defaultLength;
}
Boolean Vtype::operator==( Vtype const & v)const {
return (typeName == v.typeName);
}
Boolean Vtype::operator<(Vtype const& v) {
return (typeName < v.typeName);
}
Boolean Vtype::operator>(Vtype const& v)
{
return (typeName > v.typeName);
}
Boolean Vtype::operator!=(Vtype const& v)
{
return (typeName != v.typeName);
}
Boolean Vtype::operator <=(Vtype const & v)
{return *this > v;}
Boolean Vtype::operator >=(Vtype const & v)
{return *this < v;}
void Vtype::setName(IString & name)
{typeName = name;}
void Vtype::setType(short type)
{sqlType = type;}
void Vtype::setObj(Boolean O)
{anObj = O;}
IString const& Vtype::getName() const
{return typeName;}
short Vtype:: getType()const {return sqlType;}
short Vtype:: getLen() const {return defaultLength;}
Boolean Vtype::isObj() const {return anObj;}