Keyple Util C++ Library 2.3.0.5-SNAPSHOT
Reference Terminal Reader API for C++
HexUtil.h
Go to the documentation of this file.
1/**************************************************************************************************
2 * Copyright (c) 2023 Calypso Networks Association https://calypsonet.org/ *
3 * *
4 * See the NOTICE file(s) distributed with this work for additional information regarding *
5 * copyright ownership. *
6 * *
7 * This program and the accompanying materials are made available under the terms of the Eclipse *
8 * Public License 2.0 which is available at http://www.eclipse.org/legal/epl-2.0 *
9 * *
10 * SPDX-License-Identifier: EPL-2.0 *
11 **************************************************************************************************/
12
13#pragma once
14
15#include <cstdint>
16#include <string>
17#include <vector>
18
19/* Keyple Core Util */
20#include "KeypleUtilExport.h"
21
22namespace keyple {
23namespace core {
24namespace util {
25
27public:
40 static bool isValid(const std::string& hex);
41
54 static const std::vector<uint8_t> toByteArray(const std::string& hex);
55
70 static uint8_t toByte(const std::string& hex);
71
87 static uint16_t toShort(const std::string& hex);
88
103 static uint32_t toInt(const std::string& hex);
104
119 static uint64_t toLong(const std::string& hex);
120
128 static const std::string toHex(const std::vector<uint8_t>& tab);
129
137 static const std::string toHex(const uint8_t val);
138
149 static const std::string toHex(const uint16_t val);
150
161 static const std::string toHex(const uint32_t val);
162
173 static const std::string toHex(const uint64_t val);
174
175private:
179 static const std::vector<std::string> mByteToHex;
180
184 static const std::vector<uint8_t> mHexToNibble;
185
189 HexUtil();
190};
191
192}
193}
194}
#define KEYPLEUTIL_API