inkcpp
Loading...
Searching...
No Matches
story.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
9#include "types.h"
10
11namespace ink::runtime
12{
25class story
26{
27public:
28 virtual ~story(){};
29#pragma region Interface Methods
39 virtual globals new_globals() = 0;
44
55 virtual runner new_runner(globals store = nullptr) = 0;
69 virtual runner
70 new_runner_from_snapshot(const snapshot& obj, globals store = nullptr, unsigned runner_id = 0)
71 = 0;
72
77 virtual hash_t hash() const = 0;
78#pragma endregion
79
80#pragma region Factory Methods
91 static story* from_file(const char* filename);
92
105 static story* from_binary(const unsigned char* data, size_t length, bool freeOnDestroy = true);
106#pragma endregion
107};
108} // namespace ink::runtime
109
Container for an InkCPP runtime snapshot.
Definition snapshot.h:56
Pointer wrapper to an object whose lifetime is tied to a story object.
Definition story_ptr.h:85
A loaded ink story.
Definition story.h:26
virtual globals new_globals_from_snapshot(const snapshot &obj)=0
Reconstructs globals from snapshot.
virtual runner new_runner_from_snapshot(const snapshot &obj, globals store=nullptr, unsigned runner_id=0)=0
reconstruct runner from a snapshot
static story * from_file(const char *filename)
Creates a new story object from a file.
virtual hash_t hash() const =0
hash of binary/story.
virtual runner new_runner(globals store=nullptr)=0
Creates a new runner.
static story * from_binary(const unsigned char *data, size_t length, bool freeOnDestroy=true)
Create a new story object from binary buffer.
virtual globals new_globals()=0
Creates a new global store.
Contaning all modules and classes used for the inkles ink runtime.
Definition choice.h:13
uint32_t hash_t
Name hash (used for temporary variables)
Definition system.h:72