-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
109 changed files
with
8,333 additions
and
8,936 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,88 +1,93 @@ | ||
#pragma once | ||
|
||
|
||
#include "finalmq/helpers/FmqDefines.h" | ||
#include <cstdint> | ||
#include <string> | ||
|
||
#include "finalmq/helpers/FmqDefines.h" | ||
|
||
template <class T> | ||
template<class T> | ||
void string2Number(const std::string& str, T& number) | ||
{ | ||
} | ||
|
||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, bool& number) | ||
{ | ||
static const std::string STR_TRUE = "true"; | ||
if (str != STR_TRUE) | ||
{ | ||
double value = strtof64(str.c_str(), nullptr); | ||
#ifndef WIN32 | ||
#pragma GCC diagnostic push | ||
#pragma GCC diagnostic ignored "-Wfloat-equal" | ||
#endif | ||
if (value == 0) | ||
#ifndef WIN32 | ||
#pragma GCC diagnostic pop | ||
#endif | ||
{ | ||
number = false; | ||
} | ||
} | ||
number = true; | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, std::int8_t& number) | ||
{ | ||
number = static_cast<std::int8_t>(strtol(str.c_str(), nullptr, 10)); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, std::uint8_t& number) | ||
{ | ||
number = static_cast<std::uint8_t>(strtoul(str.c_str(), nullptr, 10)); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, std::int16_t& number) | ||
{ | ||
number = static_cast<std::int16_t>(strtol(str.c_str(), nullptr, 10)); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, std::uint16_t& number) | ||
{ | ||
number = static_cast<std::uint16_t>(strtoul(str.c_str(), nullptr, 10)); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, std::int32_t& number) | ||
{ | ||
number = strtol(str.c_str(), nullptr, 10); | ||
number = static_cast<std::int32_t>(strtol(str.c_str(), nullptr, 10)); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, std::uint32_t& number) | ||
{ | ||
number = strtoul(str.c_str(), nullptr, 10); | ||
number = static_cast<std::uint32_t>(strtoul(str.c_str(), nullptr, 10)); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, std::int64_t& number) | ||
{ | ||
number = strtoll(str.c_str(), nullptr, 10); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, std::uint64_t& number) | ||
{ | ||
number = strtoull(str.c_str(), nullptr, 10); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, float& number) | ||
{ | ||
number = strtof32(str.c_str(), nullptr); | ||
} | ||
|
||
template <> | ||
template<> | ||
void string2Number(const std::string& str, double& number) | ||
{ | ||
number = strtof64(str.c_str(), nullptr); | ||
} | ||
|
Oops, something went wrong.