|
#include "stdafx.h"
#include "common.h"
#include "smpputil.h"
//CSmppDate
CSmppDate::CSmppDate()
{
::GetSystemTime(&m_time);
m_null = true;
}
CSmppDate::~CSmppDate()
{
}
void CSmppDate::setDate(CString sd)
{
//YYMMDDhhmmsstnn+
if (sd.IsEmpty())
{
m_null = true;
}
else
{
int milsec;
int tz;
int yr;
sscanf(sd, "%02d%02d%02d%02d%02d%02d%1d%2d+",
&yr,
&m_time.wMonth,
&m_time.wDay,
&m_time.wHour,
&m_time.wMinute,
&m_time.wSecond,
&milsec,
&tz);
m_time.wYear = yr + 2000;
m_time.wMilliseconds = milsec * 100;
m_null = false;
}
}
void CSmppDate::setDate(SYSTEMTIME sdt)
{
m_time = sdt;
m_null = false;
}
CString CSmppDate::toString()
{
CString s;
TCHAR buf1[10];
TCHAR buf2[10];
TCHAR buf3[10];
if (m_null)
return "";
else
{
sprintf(buf1, "%04d%02d%02d", m_time.wYear, m_time.wMonth, m_time.wDay);
sprintf(buf2, "%02d%02d%02d", m_time.wHour, m_time.wMinute, m_time.wSecond);
sprintf(buf3, "%3d", m_time.wMilliseconds);
s = (buf1+2);
s += buf2;
s += buf3[0];
s += "00+";
TRACE(s);
}
return s;
}
CSmppDate& CSmppDate::operator=(CSmppDate &dt)
{
m_time = dt.m_time;
m_null = dt.m_null;
return *this;
}
int CSmppDate::getLength()
{
if (m_null)
return 0;
else
return 16;
}
void CSmppDate::setNull()
{
m_null = true;
}
bool CSmppDate::isNull()
{
return m_null;
}
//CSmppDate end
//CSmppAddress
CSmppAddress::CSmppAddress()
{
m_addr_ton = 0;
m_addr_npi = 0;
m_addr = "";
}
CSmppAddress::CSmppAddress(uint32 adrton, uint32 adrnpi, CString addr)
{
setAddrTon(adrton);
setAddrNpi(adrnpi);
setAddr(addr);
}
CSmppAddress::~CSmppAddress()
{
}
CSmppAddress& CSmppAddress::operator=(CSmppAddress& addr)
{
m_addr_npi = addr.m_addr_npi;
m_addr_ton = addr.m_addr_ton;
m_addr = addr.m_addr;
return *this;
}
int CSmppAddress::getLength()
{
return 3 + m_addr.GetLength();
}
void CSmppAddress::setAddrTon(uint32 adrton)
{
m_addr_ton = adrton;
}
void CSmppAddress::setAddrNpi(uint32 adrnpi)
{
m_addr_npi = adrnpi;
}
void CSmppAddress::setAddr(CString addr)
{
m_addr = addr;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
I'm a guy situated in Hong Kong with some knowledges in Java, VC++, C#, database, client-server, distributed, and mutithreaded computing and so on. I've been working in various companies as engineer, consultant, programmer.
Lately I was mainly working in banking & financial industries. Personally, I'm working on a trading application on my own now.