void CUtil::CStringToString( std::string* p_Dest, CString p_Obj )
{
*p_Dest = p_Obj;
}
void CUtil::StringToCharArray( char* p_Dest, std::string p_Obj )
{
strcpy( p_Dest, p_Obj.c_str() );
}
void CUtil::CStringToCharArray( char* p_Dest, CString p_Obj )
{
std::string temp = p_Obj;
strcpy( p_Dest, temp.c_str() );
}
void CUtil::CStringToUINT( __time64_t* p_Dest, CString p_Obj )
{
*p_Dest = _tcstoui64( p_Obj, NULL, 10 );
}
void CUtil::CStringToUINT( QWORD* p_Dest, CString p_Obj )
{
*p_Dest = _tcstoui64( p_Obj, NULL, 10 );
}
void CUtil::CStringToUINT( UINT* p_Dest, CString p_Obj )
{
*p_Dest = _tcstoul( p_Obj, NULL, 10 );
}
void CUtil::CharArrayToWChar( wchar_t* p_Dest, char* p_Obj )
{
int nLen = ( int )strlen( p_Obj ) + 1;
mbstowcs( p_Dest, p_Obj, nLen );
}
void CUtil::SystemTimeToTime( __time64_t* p_Dest, SYSTEMTIME p_Obj )
{
FILETIME fileTime, localFileTime;
SystemTimeToFileTime( &p_Obj, &fileTime );
FileTimeToLocalFileTime( &fileTime, &localFileTime );
*p_Dest = ( ( *( (__time64_t*)(&localFileTime) ) - 0x19DB1DED53E8000 ) / 10000000 ) - TIME_LOCALE;
}
void CUtil::TimeToSystemTime( SYSTEMTIME* p_Dest, __time64_t p_Obj )
{
FILETIME localFileTime, fileTime;
p_Obj += TIME_LOCALE;
LONGLONG ll = Int32x32To64(p_Obj, 10000000) + 116444736000000000;
localFileTime.dwLowDateTime = (DWORD) ll;
localFileTime.dwHighDateTime = ll >>32;
LocalFileTimeToFileTime( &localFileTime, &fileTime );
FileTimeToSystemTime( &fileTime, p_Dest );
}
void CUtil::SystemTimeToFormatString( char* p_Dest, SYSTEMTIME p_Obj )
{
sprintf( p_Dest, "%d년 %d월 %d일 / %d시 %d분 %d초", p_Obj.wYear, p_Obj.wMonth, p_Obj.wDay, p_Obj.wHour, p_Obj.wMinute, p_Obj.wSecond );
}
void CUtil::ANSITOUTF8( const char *in, char *out, int nOut )
{
WCHAR tempStr[ TEMP_STRING_BUFFER_SIZE ];
MultiByteToWideChar( CP_ACP, 0, in, -1, tempStr, nOut );
WideCharToMultiByte( CP_UTF8, 0, tempStr, -1, out, nOut, 0, 0 );
}
void CUtil::UTF8TOANSI( const char *in, char *out, int nOut )
{
WCHAR tempStr[ TEMP_STRING_BUFFER_SIZE ];
MultiByteToWideChar( CP_UTF8, 0, in, -1, tempStr, nOut );
WideCharToMultiByte( CP_ACP, 0, tempStr, -1, out, nOut, 0, 0 );
}
void CUtil::TimeToFormatString( char* p_Dest, __time64_t p_Obj )
{
SYSTEMTIME systemTime;
ZEROMEMORY( &systemTime, sizeof( SYSTEMTIME ) );
TimeToSystemTime( &systemTime, p_Obj );
SystemTimeToFormatString( p_Dest, systemTime );
}
void CUtil::FormatStringToTime( __time64_t* p_Dest, CString p_Obj )
{
SYSTEMTIME systemTime;
ZEROMEMORY( &systemTime, sizeof( SYSTEMTIME ) );
sscanf( p_Obj, "%d년 %d월 %d일 / %d시 %d분 %d초", &systemTime.wYear, &systemTime.wMonth, &systemTime.wDay, &systemTime.wHour, &systemTime.wMinute, &systemTime.wSecond );
SystemTimeToTime( p_Dest, systemTime );
}