summaryrefslogtreecommitdiff
path: root/misc.h
diff options
context:
space:
mode:
authorJeffrey Walton <noloader@gmail.com>2018-01-12 09:04:12 -0500
committerJeffrey Walton <noloader@gmail.com>2018-01-12 09:04:12 -0500
commita9d6604ee9122b44ab8250e4b52b0ebd48c514e1 (patch)
tree4d598b482edc6ee4e1c4dff9b9a4a986db32508c /misc.h
parent751252b2d92f4fa083061dfbb52825ee1d43f4d0 (diff)
downloadcryptopp-git-a9d6604ee9122b44ab8250e4b52b0ebd48c514e1.tar.gz
Update documentation
Diffstat (limited to 'misc.h')
-rw-r--r--misc.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/misc.h b/misc.h
index b9bc32a6..7401d92d 100644
--- a/misc.h
+++ b/misc.h
@@ -2405,6 +2405,11 @@ struct BlockGetAndPut
typedef PutBlock<T, B, PA> Put;
};
+/// \brief Convert a word to a string
+/// \tparam T class or type
+/// \param value the word to convert
+/// \param order byte order
+/// \returns a string representing the value of the word
template <class T>
std::string WordToString(T value, ByteOrder order = BIG_ENDIAN_ORDER)
{
@@ -2414,6 +2419,11 @@ std::string WordToString(T value, ByteOrder order = BIG_ENDIAN_ORDER)
return std::string((char *)&value, sizeof(value));
}
+/// \brief Convert a string to a word
+/// \tparam T class or type
+/// \param str the string to convert
+/// \param order byte order
+/// \returns a word representing the value of the string
template <class T>
T StringToWord(const std::string &str, ByteOrder order = BIG_ENDIAN_ORDER)
{