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 } // namespace internal
21
31 class choice
32 {
33 public:
42 int index() const { return _index; }
43
51 const char* text() const { return _text; }
52
54 bool has_tags() const { return _tags_start != _tags_end; }
55
59 size_t num_tags() const;
60
62 const char* get_tag(size_t index) const;
63
64 private:
65 friend class internal::runner_impl;
66
67 uint32_t path() const { return _path; }
68
69 choice& setup(
70 internal::basic_stream&, internal::string_table& strings, internal::list_table& lists,
71 int index, uint32_t path, thread_t thread, thread_t scope_thread,
72 const internal::runner_impl& runner, size_t tags_start, size_t tags_end
73 );
74
75 protected:
76 const char* _text = nullptr;
77 const internal::runner_impl* _runner = nullptr;
78 size_t _tags_start = 0;
79 size_t _tags_end = 0;
80 uint32_t _path = ~0U;
81 thread_t _thread = ~0U;
82 thread_t _scope_thread = ~0U;
83 int _index = -1;
84 };
85
86} // namespace runtime
87} // namespace ink
An ink choice that is being presented to the user.
Definition choice.h:32
bool has_tags() const
does this choice has tags?
Definition choice.h:54
size_t num_tags() const
number of tags associated with this choice
const char * text() const
Choice text.
Definition choice.h:51
int index() const
Choice index.
Definition choice.h:42
const char * get_tag(size_t index) const
Access a tag by index.
Contaning all modules and classes used for the inkles ink runtime.
Definition choice.h:13
story_ptr< runner_interface > runner
alias for an managed ink::runtime::runner_interface pointer
Definition types.h:22
Namespace contaning all modules and classes from InkCPP.
Definition choice.h:11
unsigned int uint32_t
define basic numeric type
Definition system.h:71
uint32_t thread_t
Used to uniquely identify threads.
Definition system.h:119