Spicy
typedefs.h
1 // Copyright (c) 2020-2021 by the Zeek Project. See LICENSE for details.
2 
3 #pragma once
4 
5 #include <string>
6 #include <utility>
7 
8 #include <hilti/rt/fiber.h>
9 #include <hilti/rt/types/stream.h>
10 
11 #include <spicy/rt/parsed-unit.h>
12 #include <spicy/rt/unit-context.h>
13 
14 namespace spicy::rt {
15 
16 template<typename T>
17 using UnitType = hilti::rt::ValueReference<T>;
18 
19 template<typename T>
20 using UnitRef = hilti::rt::StrongReference<T>;
21 
24  const std::optional<hilti::rt::stream::View>&,
25  const std::optional<UnitContext>& context);
26 
28 template<typename T>
29 using Parse2Function = hilti::rt::Resumable (*)(UnitType<T>&, hilti::rt::ValueReference<hilti::rt::Stream>&,
30  const std::optional<hilti::rt::stream::View>&,
31  const std::optional<UnitContext>& context);
32 
34  hilti::rt::ValueReference<hilti::rt::Stream>&,
35  const std::optional<hilti::rt::stream::View>&,
36  const std::optional<UnitContext>& context);
37 
42 using ContextNewFunction = UnitContext (*)();
43 
44 namespace sink::detail {
45 struct State;
46 } // namespace sink::detail
47 
48 namespace detail {
49 
55 using ParseSinkFunction =
56  std::function<std::pair<hilti::rt::StrongReferenceGeneric, spicy::rt::sink::detail::State*>()>;
57 } // namespace detail
58 
59 } // namespace spicy::rt
Definition: reference.h:328
Definition: reference.h:47
Definition: fiber.h:274