inkcpp
Loading...
Searching...
No Matches
choice.h
1/* Copyright (c) 2024 Julian Benda
2 *
3 * This file is part of inkCPP which is released under MIT license.
4 * See file LICENSE.txt or go to
5 * https://github.com/JBenda/inkcpp for full license details.
6 */
7#pragma once
8#include "system.h"
9
10namespace ink
11{
12namespace runtime
13{
14 namespace internal
15 {
16 class basic_stream;
17 class runner_impl;
18 class string_table;
19 class list_table;
20 class snap_tag;
21 } // namespace internal
22
32 class choice
33 {
34 public:
43 int index() const { return _index; }
44
52 const char* text() const { return _text; }
53
55 bool has_tags() const { return _tags_start != _tags_end; }
56
60 size_t num_tags() const;
61
63 const char* get_tag(size_t index) const;
64
65 private:
66 friend class internal::runner_impl;
67
68 uint32_t path() const { return _path; }
69
70 choice& setup(
71 internal::basic_stream&, internal::string_table& strings, internal::list_table& lists,
72 int index, uint32_t path, thread_t thread, const internal::snap_tag* tags_start,
73 const internal::snap_tag* tags_end
74 );
75
76 protected:
77 int _index = -1;
78 const char* _text = nullptr;
79 uint32_t _path = ~0;
80 thread_t _thread = ~0;
81 const internal::snap_tag* _tags_start = nullptr;
82 const internal::snap_tag* _tags_end = nullptr;
83 };
84} // namespace runtime
85} // namespace ink
An ink choice that is being presented to the user.
Definition choice.h:33
bool has_tags() const
does this choice has tags?
Definition choice.h:55
size_t num_tags() const
number of tags associated with this choice
const char * text() const
Choice text.
Definition choice.h:52
int index() const
Choice index.
Definition choice.h:43
const char * get_tag(size_t index) const
Access a tag by index.
Namespace contaning all modules and classes from InkCPP.
Definition choice.h:11
unsigned int uint32_t
define basic numeric type
Definition system.h:47
uint32_t thread_t
Used to uniquely identify threads.
Definition system.h:81