![]() |
Spicy
|
Classes | |
class | Address |
class | Backtrace |
class | Bool |
class | Bytes |
struct | Configuration |
struct | Context |
class | DeferredExpression |
class | Exception |
class | FormattingError |
class | Interval |
class | IntrusivePtr |
struct | is_tuple |
struct | is_tuple< std::tuple< T... > > |
class | Library |
class | Map |
class | Network |
struct | Nothing |
struct | Null |
class | Port |
class | RegExp |
struct | ResourceUsage |
class | Result |
class | Resumable |
class | Set |
class | Stream |
class | StrongReference |
class | StrongReferenceGeneric |
class | TemporaryDirectory |
class | Time |
struct | TypeInfo |
class | Union |
class | ValueReference |
class | Vector |
class | WeakReference |
class | WouldBlock |
Typedefs | |
template<typename T > | |
using | Controllable = std::enable_shared_from_this< T > |
Enumerations | |
enum | AddressFamily : int64_t { Undef, IPv4, IPv6 } |
enum | Protocol : int64_t { Undef = 0, TCP, UDP, ICMP } |
enum | ByteOrder : int64_t { Little, Big, Network, Host, Undef = -1 } |
Functions | |
bool | operator== (const Backtrace &a, const Backtrace &b) |
std::string | demangle (const std::string &symbol) |
template<typename Result > | |
std::string | to_string_for_print (const DeferredExpression< Result > &x) |
template<typename Result > | |
std::ostream & | operator<< (std::ostream &out, const DeferredExpression< Result > &x) |
std::ostream & | operator<< (std::ostream &stream, const Exception &e) |
HILTI_EXCEPTION (InvalidArgument, RuntimeError) | |
HILTI_EXCEPTION (InvalidValue, RuntimeError) | |
HILTI_EXCEPTION (MissingData, RecoverableFailure) | |
template<typename T > | |
std::string | to_string (T &&x) |
template<typename T > | |
std::string | to_string_for_print (const T &x) |
template<typename... Args> | |
std::string | fmt (const char *fmt, const Args &... args) |
template<typename... Args> | |
std::string | fmt (const std::string &s, const Args &... args) |
template<typename T > | |
void | print (const T &t, bool newline=true) |
template<typename T , typename std::enable_if_t< is_tuple< T >::value > * = nullptr> | |
void | printValues (const T &t, bool newline=true) |
void | __does_not_exist () |
void | init () |
void | done () |
bool | isInitialized () |
template<class T , class U > | |
IntrusivePtr< T > | cast_intrusive (IntrusivePtr< U > p) noexcept |
template<typename T > | |
auto | range (const T &t) |
void | fatalError (const std::string &msg) __attribute__((noreturn)) |
void | warning (const std::string &msg) |
bool | operator== (const Nothing &, const Nothing &) |
bool | operator!= (const Nothing &, const Nothing &) |
std::ostream & | operator<< (std::ostream &out, const Address &x) |
std::ostream & | operator<< (std::ostream &out, const AddressFamily &family) |
std::ostream & | operator<< (std::ostream &out, const Bytes &x) |
std::ostream & | operator<< (std::ostream &out, const Interval &x) |
template<typename K , typename V > | |
std::ostream & | operator<< (std::ostream &out, const Map< K, V > &x) |
template<typename K , typename V > | |
std::ostream & | operator<< (std::ostream &out, const std::pair< K, V > &x) |
std::ostream & | operator<< (std::ostream &out, const map::Empty &x) |
std::ostream & | operator<< (std::ostream &out, const Network &x) |
std::ostream & | operator<< (std::ostream &out, const Null &x) |
template<> | |
std::string | detail::to_string_for_print< std::optional< std::string > > (const std::optional< std::string > &x) |
template<> | |
std::string | detail::to_string_for_print< std::optional< std::string_view > > (const std::optional< std::string_view > &x) |
std::ostream & | operator<< (std::ostream &out, const Protocol &x) |
std::ostream & | operator<< (std::ostream &out, const Port &x) |
template<> | |
std::string | detail::to_string_for_print< StrongReference< std::string > > (const StrongReference< std::string > &x) |
template<> | |
std::string | detail::to_string_for_print< WeakReference< std::string > > (const WeakReference< std::string > &x) |
template<> | |
std::string | detail::to_string_for_print< ValueReference< std::string > > (const ValueReference< std::string > &x) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const StrongReference< T > &x) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const ValueReference< T > &x) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const WeakReference< T > &x) |
std::ostream & | operator<< (std::ostream &out, const RegExp &x) |
template<> | |
std::string | detail::to_string_for_print< Result< std::string > > (const Result< std::string > &x) |
template<> | |
std::string | detail::to_string_for_print< Result< std::string_view > > (const Result< std::string_view > &x) |
template<typename T > | |
std::ostream & | operator<< (std::ostream &out, const Set< T > &x) |
std::ostream & | operator<< (std::ostream &out, const set::Empty &x) |
template<> | |
std::string | detail::to_string_for_print< stream::View > (const stream::View &x) |
std::ostream & | operator<< (std::ostream &out, const Stream &x) |
template<> | |
std::string | detail::to_string_for_print< std::string > (const std::string &x) |
template<> | |
std::string | detail::to_string_for_print< std::string_view > (const std::string_view &x) |
std::ostream & | operator<< (std::ostream &out, const Time &x) |
template<typename T , typename Allocator > | |
std::ostream & | operator<< (std::ostream &out, const Vector< T, Allocator > &x) |
std::ostream & | operator<< (std::ostream &out, const vector::Empty &x) |
template<typename T , typename Allocator > | |
bool | operator!= (const Vector< T, Allocator > &a, const Vector< T, Allocator > &b) |
void | internalError (const std::string &msg) __attribute__((noreturn)) |
std::string | version () |
void | abort_with_backtrace () __attribute__((noreturn)) |
std::string | linker_scope () |
void | cannot_be_reached () __attribute__((noreturn)) |
ResourceUsage | resource_usage () |
std::optional< std::string > | getenv (const std::string &name) |
hilti::rt::Result< hilti::rt::filesystem::path > | createTemporaryFile (const std::string &prefix="") |
hilti::rt::filesystem::path | normalizePath (const hilti::rt::filesystem::path &p) |
std::string_view | rtrim (std::string_view s, const std::string &chars) noexcept |
std::string_view | ltrim (std::string_view s, const std::string &chars) noexcept |
std::string_view | trim (std::string_view s, const std::string &chars) noexcept |
std::string_view | rtrim (std::string_view s) noexcept |
std::string_view | ltrim (std::string_view s) noexcept |
std::string_view | trim (std::string_view s) noexcept |
std::vector< std::string_view > | split (std::string_view s, std::string_view delim) |
std::vector< std::string_view > | split (std::string_view s) |
std::pair< std::string, std::string > | split1 (std::string s) |
std::pair< std::string, std::string > | rsplit1 (std::string s) |
std::pair< std::string, std::string > | split1 (std::string s, const std::string &delim) |
std::pair< std::string, std::string > | rsplit1 (std::string s, const std::string &delim) |
std::string | replace (std::string s, std::string_view o, std::string_view n) |
bool | startsWith (const std::string &s, const std::string &prefix) |
template<typename T , typename TIter = decltype(std::begin(std::declval<T>())), typename = decltype(std::end(std::declval<T>()))> | |
constexpr auto | enumerate (T &&iterable) |
std::string | expandEscapes (std::string s) |
std::string | escapeBytes (std::string_view s, bool escape_quotes=false, bool use_octal=false) |
std::string | escapeUTF8 (std::string_view s, bool escape_quotes=false, bool escape_control=true, bool keep_hex=false) |
template<typename T > | |
std::string | join (const T &l, const std::string &delim="") |
template<typename C , typename F > | |
auto | transform (const C &x, F f) |
template<class Iter , typename Result > | |
Iter | atoi_n (Iter s, Iter e, uint8_t base, Result *result) |
template<typename I1 , typename I2 > | |
I1 | pow (I1 base, I2 exp) |
template<typename F , std::size_t I = 0, typename... Ts> | |
void | tuple_for_each (const std::tuple< Ts... > &tup, F func) |
template<typename T , typename F , std::size_t TupSize = std::tuple_size_v<std::decay_t<T>>> | |
constexpr auto | map_tuple (T &&tup, F f) |
template<typename T , std::size_t TupSize = std::tuple_size_v<std::decay_t<T>>> | |
auto | join_tuple (T &&tup) |
template<typename T , std::size_t TupSize = std::tuple_size_v<std::decay_t<T>>> | |
auto | join_tuple_for_print (T &&tup) |
ByteOrder | systemByteOrder () |
std::string | strftime (const std::string &format, const Time &time) |
Time | strptime (const std::string &buf, const std::string &format) |
template<typename... Hashes> | |
constexpr std::size_t | hashCombine (std::size_t hash1, std::size_t hash2, Hashes... hashes) |
This header defines functions that are made available to HILTI programs inside the hilti::*
namespace.
A map that mostly builds on std::map, but adds a couple of things:
- We add safe HILTI-side iterators become detectably invalid when the main containers gets destroyed. - [Future] Automatic element expiration.
A set that mostly builds on std::set, but adds a couple of things:
- We add safe HILTI-side iterators become detectably invalid when the main containers gets destroyed. - [Future] Automatic element expiration.
A vector that for large part built on std::vector, but adds a couple of things:
- We record if an element has been set at all. - We add safe HILTIs-side iterators become detectably invalid when the main containers gets destroyed. - We add auto-growth on assign. - We track which elements are set at all.
using hilti::rt::Controllable = typedef std::enable_shared_from_this<T> |
Base for classes that ValueReference::self
can receive.
|
strong |
Available byte orders.
|
strong |
Protocols that can be associated with a Port
.
void hilti::rt::abort_with_backtrace | ( | ) |
Dumps a backtrack to stderr and then aborts execution.
|
inline |
Parses a numerical value from a character sequence into an integer. Character sequences can start with +
or -
to denote the sign.
Users should check the returned iterator to detect how many characters were extracted. If the returned iterator is different from s
the extracted numerical value was stored in the memory pointed to by result
; otherwise result
remains unchanged.
s != e
. void hilti::rt::cannot_be_reached | ( | ) |
Aborts with an internal error saying we should not be where we are.
|
noexcept |
Casts an IntrusivePtr
object to another by way of static_cast on the underlying pointer.
p | The pointer of type U to cast to another type, T . |
T
. hilti::rt::Result< hilti::rt::filesystem::path > hilti::rt::createTemporaryFile | ( | const std::string & | prefix = "" | ) |
Creates a temporary file in the system temporary directory.
prefix | prefix to use for the file's basename |
|
inline |
Wrapper around the ABI's C++ demangle function.
void hilti::rt::done | ( | ) |
Shuts down the run-time library, freeing all resources. Once executed, no libhilti functionality can be used anymore.
constexpr auto hilti::rt::enumerate | ( | T && | iterable | ) |
Python-style enumerate() that returns an iterable yielding pairs (index, val)
. From http://reedbeta.com/blog/python-like-enumerate-in-cpp17/.
|
inline |
Reports an internal error and aborts execution. Reports a fatal error and immediately aborts execution. This skips all cleanup and should be used only for catastrophic library issues; not for anything that can happen during "normal" operation (which is almost everything).
Reports an fatal error and aborts execution.
std::string hilti::rt::fmt | ( | const char * | fmt, |
const Args &... | args | ||
) |
sprintf-style string formatting.
std::string hilti::rt::fmt | ( | const std::string & | s, |
const Args &... | args | ||
) |
sprintf-style string formatting.
std::optional< std::string > hilti::rt::getenv | ( | const std::string & | name | ) |
Returns the value of an environment variable, if set.
hilti::rt::HILTI_EXCEPTION | ( | InvalidArgument | , |
RuntimeError | |||
) |
Base class for exceptions thrown by the runtime system. Base class for exceptions created by HILTI programs. Base class for exceptions which can be recovered. Thrown when an assert
statement fails. Exception triggered when a division by zero is attempted.Thrown for trouble encountered while managing the runtime environment. Exception indicating access to an already expired weak reference. Exception reflecting an attempt to modify a stream object that's been frozen.Exception indicating an undefined use of a reference type. Thrown when an invalid container index is accessed. Exception flagging invalid arguments passed to a function.
hilti::rt::HILTI_EXCEPTION | ( | InvalidValue | , |
RuntimeError | |||
) |
hilti::rt::HILTI_EXCEPTION | ( | MissingData | , |
RecoverableFailure | |||
) |
void hilti::rt::init | ( | ) |
Initializes the HILTI run-time library. This must be called once at startup before any other libhilti functionality can be used.
|
inline |
Reports an internal error and aborts execution.
bool hilti::rt::isInitialized | ( | ) |
Returns true if init() has already been called.
std::string hilti::rt::join | ( | const T & | l, |
const std::string & | delim = "" |
||
) |
Joins elements of a container into a string, using a specified delimiter to separate them.
auto hilti::rt::join_tuple | ( | T && | tup | ) |
Converts a tuple's elements into string representations and then concatenates those with separating commas. This version converts the tuple elements into strings using HILTI's standard rendering (which, e.g., means that strings will be surrounded by quotes).
auto hilti::rt::join_tuple_for_print | ( | T && | tup | ) |
Converts a tuple's elements into string representations and then concatenates those with separating commas. This version converts the tuple elements into strings as if they were given to a HILTI print
statements (which, e.g., means that top-level strings won't be surrounded by quotes).
|
inline |
Returns the unique scope of the current HLTO module.
|
inlinenoexcept |
Returns a string view with all leading characters of a given set removed.
|
inlinenoexcept |
Returns a string view with all leading white space removed.
constexpr auto hilti::rt::map_tuple | ( | T && | tup, |
F | f | ||
) |
Applies a transformation function to each element of a tuple, returning a new tuple.
hilti::rt::filesystem::path hilti::rt::normalizePath | ( | const hilti::rt::filesystem::path & | p | ) |
Turns a path into an absolute path with all dots removed.
|
inline |
Computes integer powers
void hilti::rt::print | ( | const T & | t, |
bool | newline = true |
||
) |
Corresponds to hilti::print
.
void hilti::rt::printValues | ( | const T & | t, |
bool | newline = true |
||
) |
Corresponds to hilti::printValues
.
auto hilti::rt::range | ( | const T & | t | ) |
Wrapper that returns an object suitable to operate range-based for loop on to iterator over a sequence.
std::string hilti::rt::replace | ( | std::string | s, |
std::string_view | o, | ||
std::string_view | n | ||
) |
Replaces all occurrences of one string with another.
hilti::rt::ResourceUsage hilti::rt::resource_usage | ( | ) |
Returns statistics about the current resource uage.
std::pair< std::string, std::string > hilti::rt::rsplit1 | ( | std::string | s | ) |
Splits a string once at the last occurrence of successive whitespace. Leaves the 2nd element of the result pair unset if whitespace does not occur.
std::pair< std::string, std::string > hilti::rt::rsplit1 | ( | std::string | s, |
const std::string & | delim | ||
) |
Splits a string once at the last occurrence of a delimiter. Leaves the 1st element of the result pair unset if the delimiter does not occur.
|
inlinenoexcept |
Returns a string view with all trailing characters of a given set removed.
|
inlinenoexcept |
Returns a string view with all trailing white space removed.
std::vector< std::string_view > hilti::rt::split | ( | std::string_view | s, |
std::string_view | delim | ||
) |
Splits a string at all occurrences of a delimiter. Successive occurrences of the delimiter will be split into multiple pieces.
std::vector< std::string_view > hilti::rt::split | ( | std::string_view | s | ) |
Splits a string at all occurrences of successive white space.
std::pair< std::string, std::string > hilti::rt::split1 | ( | std::string | s | ) |
Splits a string once at the 1st occurrence of successive whitespace. Leaves the 2nd element of the result pair unset if whitespace does not occur.
std::pair< std::string, std::string > hilti::rt::split1 | ( | std::string | s, |
const std::string & | delim | ||
) |
Splits a string once at the 1st occurrence of a delimiter. Leaves the 2nd element of the result pair unset if the delimiter does not occur.
|
inline |
Returns true if a string begins with another.
Returns true if a string begins with another.
std::string hilti::rt::strftime | ( | const std::string & | format, |
const Time & | time | ||
) |
Formats a time according to user-specified format string.
This function uses the currently active locale and timezone to format values. Formatted strings cannot exceed 128 bytes.
format | a POSIX-conformant format string, see https://pubs.opengroup.org/onlinepubs/009695399/functions/strftime.html for the available format specifiers |
time | timestamp to format |
<tt>InvalidArgument</tt> | if the timestamp could not be formatted |
hilti::rt::Time hilti::rt::strptime | ( | const std::string & | buf, |
const std::string & | format | ||
) |
Parse time from string.
This function uses the currently active locale and timezone to parse values.
buf | string to parse |
format | format string dictating how to interpret buf , see https://pubs.opengroup.org/onlinepubs/009695399/functions/strptime.html for the available format specifiers. |
<tt>InvalidArgument</tt> | if the time value could not be parsed OutOfRange if the parse time value cannot be represented |
hilti::rt::ByteOrder hilti::rt::systemByteOrder | ( | ) |
Returns the byte order of the system we're running on. The result is either ByteOrder::Little
or ByteOrder::Big
.
std::string hilti::rt::to_string | ( | T && | x | ) |
Converts a HILTI runtime type into a string representation.
|
inline |
Converts a HILTI runtime type into the string representation that hilti::print()
outputs. This representation is slightly different from the standard one (e.g., it doesn't enclose top-level strings in quotation marks).
auto hilti::rt::transform | ( | const C & | x, |
F | f | ||
) |
Applies a function to each element of container.
|
inlinenoexcept |
Returns a string view with all leading & trailing characters of a given set removed.
|
inlinenoexcept |
Returns a string view with all leading & trailing white space removed.
void hilti::rt::tuple_for_each | ( | const std::tuple< Ts... > & | tup, |
F | func | ||
) |
Generic tuple for-each that runs a callback for each element.
std::string hilti::rt::version | ( | ) |
Returns a string identifying the version of the runtime library.
void hilti::rt::warning | ( | const std::string & | msg | ) |
Reports a warning.