Skip to content

Commit 2b1afae

Browse files
author
전상현
committed
[100_System] IP주소 파서 추가
1 parent 3eca23a commit 2b1afae

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

Src/100_System/Information.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55

66
namespace core
77
{
8+
//////////////////////////////////////////////////////////////////////////
9+
ST_IP_ADDRESS::ST_IP_ADDRESS(std::tstring strIP)
10+
{
11+
dwIP = core::IPAddressFrom(strIP.c_str());
12+
}
13+
14+
//////////////////////////////////////////////////////////////////////////
15+
std::tstring ST_IP_ADDRESS::MakeIPString(void)
16+
{
17+
return core::IPAddressFrom(dwIP);
18+
}
19+
820
//////////////////////////////////////////////////////////////////////////
921
std::tstring GetWeekString(WORD wDayOfWeek)
1022
{

Src/100_System/Information.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
#include "../__Common/Type.h"
55

66
#ifdef UNICODE
7+
#define MakeIPString MakeIPStringW
78
#define IPAddressFrom IPAddressFromW
89
#define GetWeekString GetWeekStringW
910
#define GetMonthString GetMonthStringW
1011
#define GetOSTypeString GetOSTypeStringW
1112
#else
13+
#define MakeIPString MakeIPStringA
1214
#define IPAddressFrom IPAddressFromA
1315
#define GetWeekString GetWeekStringA
1416
#define GetMonthString GetMonthStringA
@@ -17,6 +19,22 @@
1719

1820
namespace core
1921
{
22+
struct ST_IP_ADDRESS
23+
{
24+
union
25+
{
26+
DWORD dwIP;
27+
struct {
28+
BYTE addr[4];
29+
} ip;
30+
};
31+
32+
ST_IP_ADDRESS(std::string strIP);
33+
ST_IP_ADDRESS(std::wstring strIP);
34+
std::string MakeIPStringA(void);
35+
std::wstring MakeIPStringW(void);
36+
};
37+
2038
DWORD IPAddressFromA(const char* pszIP);
2139
DWORD IPAddressFromW(const wchar_t* pszIP);
2240
std::string IPAddressFromA(DWORD dwIP);

0 commit comments

Comments
 (0)