TT Client Library 1.0.0
C++ library for Tandem Tales clients.
Loading...
Searching...
No Matches
Ending.h
1#pragma once
2
3#include <string>
4#include <tt/world/Signature.h>
5#include <memory>
6
7#ifndef ENDING_H
8#define ENDING_H
9
10namespace tt {
17 class Ending {
18 public:
20 int id;
22 std::string name;
23
24 // default constructor for json deserialization
25 Ending():id(0), signature(nullptr) {};
26
32 std::string toString() const;
33
39 const std::string& getDescription() const;
40
49 const std::string& getCode() const;
50
56 const Signature* getSignature() const;
57
58 bool operator==(const Ending& rhs) const;
59
60 friend void from_json(const nlohmann::json& j, Ending& obj);
61 friend void to_json(nlohmann::json& j, const Ending& obj);
62 friend std::ostream& operator<<(std::ostream& os, const Ending& a);
63
64 private:
66 std::unique_ptr<Signature> signature;
68 std::string code;
70 std::string description;
71 };
72
73 void from_json(const nlohmann::json& j, Ending& obj);
74 void to_json(nlohmann::json& j, const Ending& obj);
75
83 std::ostream& operator<<(std::ostream& os, const Ending& a);
84}
85
86#endif
An ending is a signed asset that represents one of several possible ways a story can end.
Definition Ending.h:17
const std::string & getDescription() const
Returns a human-readable natural language description of the object.
Definition Ending.cpp:11
int id
This asset's ID number, which is unique among other assets of the same type.
Definition Ending.h:20
std::string name
This asset's name, which is unique among other assets of the same type.
Definition Ending.h:22
friend std::ostream & operator<<(std::ostream &os, const Ending &a)
Override stream insertion operator to allow printing the Ending class.
std::string toString() const
Returns a string representation of this object.
Definition Ending.cpp:6
const Signature * getSignature() const
Returns the signature of this object.
Definition Ending.cpp:21
const std::string & getCode() const
Returns a string of 1's and 0's that uniquely represents this object among other objects of the same ...
Definition Ending.cpp:16
A signature is a logical object that identifies a parameterized asset in a story world.
Definition Signature.h:22
Tandem Tales is a platform that enables short, paired storytelling exercises between two agents over ...
Definition Client.h:22
std::ostream & operator<<(std::ostream &os, const Client &a)
Override stream insertion operator to allow printing the Client class.
Definition Client.cpp:556