UbiAnyCard Ver2 2.0
KICC ED785 단말기 연동 TCP 서버
로딩중...
검색중...
일치하는것 없음
ProtocolAdapter.cpp 파일 참조
#include "pch.h"
#include "ProtocolAdapter.h"
ProtocolAdapter.cpp에 대한 include 의존 그래프

함수

static std::string BytesToHexUpper (const std::vector< byte > &buf, size_t len)
static std::string ConvertEucKrToUtf8 (const std::string &euckr)
static std::string GetKv (const std::vector< std::pair< std::string, std::string > > &kvs, const std::string &key)
static bool HasKv (const std::vector< std::pair< std::string, std::string > > &kvs, const std::string &key)
static std::string JoinKvOrdered (const std::vector< std::pair< std::string, std::string > > &kvs)
static std::vector< std::pair< std::string, std::string > > ParseKvOrdered (const std::string &s)
static std::wstring Utf8ToWide (const std::string &text)

함수 문서화

◆ BytesToHexUpper()

std::string BytesToHexUpper ( const std::vector< byte > & buf,
size_t len )
static
87{
88 static const char *hex = "0123456789ABCDEF";
89 if (len > buf.size())
90 len = buf.size();
91 std::string out;
92 out.resize(len * 2);
93 for (size_t i = 0; i < len; ++i)
94 {
95 out[i * 2] = hex[(buf[i] >> 4) & 0xF];
96 out[i * 2 + 1] = hex[buf[i] & 0xF];
97 }
98 return out;
99}

다음에 의해서 참조됨 : ProtocolAdapter::onEd785Response().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ConvertEucKrToUtf8()

std::string ConvertEucKrToUtf8 ( const std::string & euckr)
static
6{
7 if (euckr.empty())
8 return {};
9
10 // EUC-KR → UTF-16
11 int wlen = ::MultiByteToWideChar(949, 0, euckr.c_str(), (int)euckr.size(), nullptr, 0);
12 if (wlen <= 0)
13 return euckr; // 변환 실패 시 원본 반환
14
15 std::wstring wstr;
16 wstr.resize(wlen);
17 ::MultiByteToWideChar(949, 0, euckr.c_str(), (int)euckr.size(), wstr.data(), wlen);
18
19 // UTF-16 → UTF-8
20 int u8len = ::WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), (int)wstr.size(), nullptr, 0, nullptr, nullptr);
21 if (u8len <= 0)
22 return euckr;
23
24 std::string utf8;
25 utf8.resize(u8len);
26 ::WideCharToMultiByte(CP_UTF8, 0, wstr.c_str(), (int)wstr.size(), utf8.data(), u8len, nullptr, nullptr);
27 return utf8;
28}

다음에 의해서 참조됨 : ProtocolAdapter::bytesToUtf8String().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetKv()

std::string GetKv ( const std::vector< std::pair< std::string, std::string > > & kvs,
const std::string & key )
static
57{
58 for (auto &kv : kvs)
59 if (_stricmp(kv.first.c_str(), key.c_str()) == 0)
60 return kv.second;
61 return {};
62}

다음에 의해서 참조됨 : ProtocolAdapter::ParseAndAppendElectronicMoney().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ HasKv()

bool HasKv ( const std::vector< std::pair< std::string, std::string > > & kvs,
const std::string & key )
static
65{
66 for (auto &kv : kvs)
67 if (_stricmp(kv.first.c_str(), key.c_str()) == 0)
68 return true;
69 return false;
70}

다음에 의해서 참조됨 : ProtocolAdapter::onCommand(), ProtocolAdapter::ParseAndAppendElectronicMoney().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ JoinKvOrdered()

std::string JoinKvOrdered ( const std::vector< std::pair< std::string, std::string > > & kvs)
static
73{
74 std::ostringstream os;
75 bool first = true;
76 for (auto &kv : kvs)
77 {
78 if (!first)
79 os << ';';
80 first = false;
81 os << kv.first << '=' << kv.second;
82 }
83 return os.str();
84}

다음에 의해서 참조됨 : ProtocolAdapter::onCommand(), ProtocolAdapter::sendAndWait().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ParseKvOrdered()

std::vector< std::pair< std::string, std::string > > ParseKvOrdered ( const std::string & s)
static
32{
33 std::vector<std::pair<std::string, std::string>> out;
34 size_t i = 0;
35 while (i < s.size())
36 {
37 size_t sc = s.find(';', i);
38 std::string tok = s.substr(i, (sc == std::string::npos ? s.size() : sc) - i);
39 if (!tok.empty())
40 {
41 size_t eq = tok.find('=');
42 if (eq != std::string::npos)
43 {
44 std::string k = tok.substr(0, eq);
45 std::string v = tok.substr(eq + 1);
46 out.emplace_back(k, v);
47 }
48 }
49 if (sc == std::string::npos)
50 break;
51 i = sc + 1;
52 }
53 return out;
54}

다음에 의해서 참조됨 : ProtocolAdapter::onCommand(), ProtocolAdapter::sendAndWait().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ Utf8ToWide()

std::wstring Utf8ToWide ( const std::string & text)
static
102{
103 if (text.empty())
104 return {};
105
106 int required = ::MultiByteToWideChar(CP_UTF8, 0, text.c_str(), static_cast<int>(text.size()), nullptr, 0);
107 if (required <= 0)
108 return {};
109
110 std::wstring wide;
111 wide.resize(required);
112 ::MultiByteToWideChar(CP_UTF8, 0, text.c_str(), static_cast<int>(text.size()), wide.data(), required);
113 return wide;
114}

다음에 의해서 참조됨 : ProtocolAdapter::onEd785Response().

이 함수를 호출하는 함수들에 대한 그래프입니다.: