inkcpp
Toggle main menu visibility
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
10
namespace
ink
11
{
12
namespace
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
const
char
* _text =
nullptr
;
78
const
internal::snap_tag* _tags_start =
nullptr
;
79
const
internal::snap_tag* _tags_end =
nullptr
;
80
uint32_t
_path = ~0U;
81
thread_t
_thread = ~0U;
82
int
_index = -1;
83
};
84
85
}
// namespace runtime
86
}
// namespace ink
ink::runtime::choice
An ink choice that is being presented to the user.
Definition
choice.h:33
ink::runtime::choice::has_tags
bool has_tags() const
does this choice has tags?
Definition
choice.h:55
ink::runtime::choice::num_tags
size_t num_tags() const
number of tags associated with this choice
ink::runtime::choice::text
const char * text() const
Choice text.
Definition
choice.h:52
ink::runtime::choice::index
int index() const
Choice index.
Definition
choice.h:43
ink::runtime::choice::get_tag
const char * get_tag(size_t index) const
Access a tag by index.
ink::runtime
Contaning all modules and classes used for the inkles ink runtime.
Definition
choice.h:13
ink
Namespace contaning all modules and classes from InkCPP.
Definition
choice.h:11
ink::uint32_t
unsigned int uint32_t
define basic numeric type
Definition
system.h:71
ink::thread_t
uint32_t thread_t
Used to uniquely identify threads.
Definition
system.h:119
inkcpp
include
choice.h
Generated by
1.17.0