1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
// ParseValue.cpp: implementation of the ParseValue class.
//
//////////////////////////////////////////////////////////////////////
#include "StdAfx.h"
#include "ParseValue.h"
#include "stdlib.h"
#include "string.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
ParseValue::ParseValue()
{
memset(dta,0,255);
Next = NULL;
}
ParseValue::~ParseValue()
{
}
unsigned char ParseValue::GetUChar()
{
int t = atoi(dta);
unsigned char tuc = (unsigned char)t;
return(tuc);
}
char ParseValue::GetChar()
{
int t = atoi(dta);
char tc = (char)t;
return(tc);
}
unsigned short ParseValue::GetUShort()
{
int t = atoi(dta);
unsigned short tus = (unsigned short)t;
return(tus);
}
short ParseValue::GetShort()
{
int t = atoi(dta);
short ts = (short)t;
return(ts);
}
unsigned long ParseValue::GetULong()
{
union cnvt {
long l;
unsigned long ul;
} td;
td.l = atol(dta);
return(td.ul);
}
long ParseValue::GetLong()
{
return(atol(dta));
}
float ParseValue::Getfloat()
{
double td = atof(dta);
float tf = (float)td;
return(tf);
}
double ParseValue::Getdouble()
{
return(atof(dta));
}
bool ParseValue::GetBool()
{
bool rslt = false;
if((dta[0] == 'T')||(dta[0] == 't'))
rslt = true;
return(rslt);
}
void ParseValue::SetDta(char *buf)
{
strcpy(dta,buf);
}
|