![]() |
Spicy
|
Classes | |
| class | Backtrace |
| struct | Configuration |
| struct | Context |
| class | Exception |
| class | FormattingError |
| class | WouldBlock |
| class | Resumable |
| class | IntrusivePtr |
| class | Library |
| class | Profiler |
| struct | Nothing |
| class | Result |
| struct | TypeInfo |
| class | Address |
| struct | Bitfield |
| class | Bool |
| class | Bytes |
| class | Interval |
| class | Map |
| class | Network |
| struct | Null |
| class | Port |
| class | ValueReference |
| class | StrongReference |
| class | WeakReference |
| class | StrongReferenceGeneric |
| class | RegExp |
| class | Set |
| class | Stream |
| class | Time |
| class | Union |
| class | Vector |
| struct | ResourceUsage |
| class | TemporaryDirectory |
| struct | scope_exit |
Typedefs | |
| template<typename T > | |
| using | Controllable = std::enable_shared_from_this< T > |
| template<typename... Ts> | |
| using | Tuple = std::tuple< std::optional< Ts >... > |
Functions | |
| bool | operator== (const Backtrace &a, const Backtrace &b) |
| std::string | demangle (const std::string &symbol) |
| 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 (std::string_view s, const Args &... args) |
| template<typename T > | |
| void | print (const T &t, const hilti::rt::TypeInfo *, bool newline=true) |
| void | __does_not_exist () |
| void | init () |
| void | done () |
| bool | isInitialized () |
| void | executeManualPreInits () |
| template<class T , class U > | |
| IntrusivePtr< T > | cast_intrusive (IntrusivePtr< U > p) noexcept |
| template<typename T > | |
| auto | range (const T &t) |
| void | fatalError (std::string_view msg) __attribute__((noreturn)) |
| void | warning (std::string_view msg) |
| bool | operator== (const Nothing &, const Nothing &) |
| bool | operator!= (const Nothing &, const Nothing &) |
| template<typename T > | |
| Result< T > | make_result (T &&t) |
| std::ostream & | operator<< (std::ostream &out, const TypeInfo &t) |
| std::ostream & | operator<< (std::ostream &out, const TypeInfo *t) |
| HILTI_RT_ENUM (AddressFamily, Undef, IPv4, IPv6) | |
| std::ostream & | operator<< (std::ostream &out, const Address &x) |
| std::ostream & | operator<< (std::ostream &out, const AddressFamily &family) |
| template<typename... Ts> | |
| Bitfield< Ts... > | make_bitfield (const hilti::rt::TypeInfo *ti, Ts... args) |
| 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) |
| HILTI_RT_ENUM (Protocol, Undef=0, TCP, UDP, ICMP) | |
| 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) |
| std::ostream & | operator<< (std::ostream &out, const stream::Statistics &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) |
| template<typename CharT , size_t N> | |
| std::string | to_string_for_print (const CharT(&x)[N]) |
| 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 (std::string_view msg) __attribute__((noreturn)) |
| std::string | version () |
| void | abort_with_backtrace () __attribute__((noreturn)) |
| 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 (std::string_view s, std::string_view prefix) |
| bool | endsWith (std::string_view s, std::string_view suffix) |
| 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 | expandUTF8Escapes (std::string s) |
| std::string | escapeBytes (std::string_view s, bitmask< render_style::Bytes > style=render_style::Bytes::Default) |
| std::string | escapeUTF8 (std::string_view s, bitmask< render_style::UTF8 > style=render_style::UTF8::Default) |
| 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) |
| HILTI_RT_ENUM (ByteOrder, Little, Big, Network, Host, Undef=-1) | |
| 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 builds on std::vector, but adds a couple of things:
- We record if an element has been set at all. - We add safe HILTI-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.
| using hilti::rt::Tuple = typedef std::tuple<std::optional<Ts>...> |
Runtime representation of HILTI's tuple type. As tuple element can be left unset, we wrap them into optionals.
| Ts | types of the tuple elements |
| 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::profiler::detail::done | ( | ) |
Shuts down the run-time library, freeing all resources. Once executed, no libhilti functionality can be used anymore.
| bool hilti::rt::endsWith | ( | std::string_view | s, |
| std::string_view | suffix | ||
| ) |
Returns true if a string ends with another.
|
constexpr |
Python-style enumerate() that returns an iterable yielding pairs (index, val). From http://reedbeta.com/blog/python-like-enumerate-in-cpp17/.
| void hilti::rt::executeManualPreInits | ( | ) |
Execute any functions registered through RegisterManualPreInit.
| void hilti::rt::fatalError | ( | std::string_view | msg | ) |
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).
| std::string hilti::rt::fmt | ( | const char * | fmt, |
| const Args &... | args | ||
| ) |
sprintf-style string formatting.
| std::string hilti::rt::fmt | ( | std::string_view | 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 during runtime when encountering unexpected input/situations. Base class for exceptions indicating non-recoverable misuse of some functionality. 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 | |||
| ) |
| hilti::rt::HILTI_RT_ENUM | ( | ByteOrder | , |
| Little | , | ||
| Big | , | ||
| Network | , | ||
| Host | , | ||
| Undef | = -1 |
||
| ) |
Available byte orders.
| hilti::rt::HILTI_RT_ENUM | ( | Protocol | , |
| Undef | = 0, |
||
| TCP | , | ||
| UDP | , | ||
| ICMP | |||
| ) |
Protocols that can be associated with a Port.
| void hilti::rt::profiler::detail::init | ( | ) |
Initializes the HILTI run-time library. This must be called once at startup before any other libhilti functionality can be used.
| void hilti::rt::internalError | ( | std::string_view | msg | ) |
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.
|
inlinenoexcept |
Returns a string view with all leading white space removed.
|
inlinenoexcept |
Returns a string view with all leading characters of a given set removed.
| Bitfield<Ts...> hilti::rt::make_bitfield | ( | const hilti::rt::TypeInfo * | ti, |
| Ts... | args | ||
| ) |
Construct a Bitfield.
Since a bitfield always owns its values this takes all fields by value.
| Result<T> hilti::rt::make_result | ( | T && | t | ) |
Similar to std::make_optional, construct a result from a value.
|
constexpr |
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, |
| const hilti::rt::TypeInfo * | , | ||
| bool | newline = true |
||
| ) |
Corresponds to hilti::print.
| 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 usage.
| 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 white space removed.
|
inlinenoexcept |
Returns a string view with all trailing characters of a given set removed.
| std::vector< std::string_view > hilti::rt::split | ( | std::string_view | s | ) |
Splits a string at all occurrences of successive white space.
| 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::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.
| bool hilti::rt::startsWith | ( | std::string_view | s, |
| std::string_view | prefix | ||
| ) |
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 white space removed.
|
inlinenoexcept |
Returns a string view with all leading & trailing characters of a given set 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 | ( | std::string_view | msg | ) |
Reports a warning.