Spicy
real.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <string>
6 #include <tuple>
7 
8 #include <hilti/rt/extension-points.h>
9 #include <hilti/rt/types/bytes.h>
10 #include <hilti/rt/types/stream.h>
11 #include <hilti/rt/util.h>
12 
13 namespace hilti::rt {
14 
15 namespace real {
17 enum class Type : int64_t { Undef, IEEE754_Single, IEEE754_Double };
18 
20 extern Bytes pack(double d, Type type, ByteOrder fmt);
21 
23 extern Result<std::tuple<double, Bytes>> unpack(const Bytes& data, Type type, ByteOrder fmt);
24 
26 extern Result<std::tuple<double, stream::View>> unpack(const stream::View& data, Type type, ByteOrder fmt);
27 
28 } // namespace real
29 
30 namespace detail::adl {
31 std::string to_string(double x, tag /*unused*/);
32 std::string to_string(const real::Type& x, tag /*unused*/);
33 } // namespace detail::adl
34 
35 } // namespace hilti::rt
std::string to_string(T &&x)
Definition: extension-points.h:26
Definition: any.h:7
ByteOrder
Definition: util.h:503
std::string fmt(const char *fmt, const Args &... args)
Definition: fmt.h:13