inkcpp
Loading...
Searching...
No Matches
ink::runtime::choice Class Reference

An ink choice that is being presented to the user. More...

#include <choice.h>

Public Member Functions

int index () const
 Choice index.
 
const char * text () const
 Choice text.
 
bool has_tags () const
 does this choice has tags?
 
size_t num_tags () const
 number of tags associated with this choice
 
const char * get_tag (size_t index) const
 Access a tag by index.
 

Friends

class internal::runner_impl
 

Detailed Description

An ink choice that is being presented to the user.

Contains all the data about a single choice being faced by an ink runner. Of primary concern is the index and the text.

See also
runner

Member Function Documentation

◆ get_tag()

const char * ink::runtime::choice::get_tag ( size_t index) const

Access a tag by index.

Note that this method only allows the retrieval of tags attached to the current line. For tags at the top of the script, use get_global_tag()

Parameters
indextag id to fetch [0;num_tags())
Returns
pointer to the tag string memory or nullptr if the index is invalid
See also
has_tags num_tags get_global_tag get_knot_tag

◆ index()

int ink::runtime::choice::index ( ) const
inline

Choice index.

Pass this to the runner to choose this choice and have it follow its branch.

Returns
index of the choice. 0 is the first, etc.

◆ num_tags()

size_t ink::runtime::choice::num_tags ( ) const

number of tags associated with this choice

See also
has_tags()

◆ text()

const char * ink::runtime::choice::text ( ) const
inline

Choice text.

Text to display to the user for choosing this choice.

Returns
choice text as a string

The documentation for this class was generated from the following file: