summaryrefslogtreecommitdiffstats
path: root/src/BookContent.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/BookContent.h')
-rw-r--r--src/BookContent.h30
1 files changed, 24 insertions, 6 deletions
diff --git a/src/BookContent.h b/src/BookContent.h
index 43fd93742..f8a6b6a38 100644
--- a/src/BookContent.h
+++ b/src/BookContent.h
@@ -14,7 +14,9 @@ class cBookContent
{
public:
/** Creates a empty book */
- cBookContent() {}
+ cBookContent():
+ m_IsSigned(false)
+ {}
/** Set the author of the book */
void SetAuthor(const AString & a_Author) { m_Author = a_Author; }
@@ -28,9 +30,6 @@ public:
/** Returns the title of the book */
const AString & GetTitle(void) const { return m_Title; }
- /** Add a page to the end of the book */
- void AddPage(const AString & a_Page) { m_Pages.emplace_back(a_Page); }
-
/** Clears the whole book */
void Clear();
@@ -39,13 +38,29 @@ public:
// tolua_end
+ /** Required in ManualBindings to save the page as simple string or json string */
+ void SetIsSigned(bool a_IsSigned) { m_IsSigned = a_IsSigned; }
+
+ /** Returns true if the book is signed */
+ bool IsSigned(void) const { return m_IsSigned; }
+
+ /** Add a page to the end of the book */
+ void AddPage(const AString & a_Page) { m_Pages.emplace_back(a_Page); }
+
+ /** Returns the page at the index */
+ const AString & GetPage(size_t a_Index) { return m_Pages[a_Index]; }
+
+ /** Changes the page at the index */
+ void SetPage(size_t a_Index, const AString & a_Page) { m_Pages[a_Index] = a_Page; }
+
+ /** Removes all pages */
void ClearPages(void)
{
m_Pages.clear();
}
- /** Returns a AStringVector ref to the pages. Used in ManualBindings and for saving the book */
- const AStringVector & GetPages(void) const { return m_Pages; }
+ /** Returns a ref to the vector. Used in ManualBindings and for saving the book */
+ const std::vector<AString> & GetPages(void) const { return m_Pages; }
/** Read the book content from nbt. The boolean a_SaveAsJson is optional. If the book is signed, the text should be in a json string */
static void ParseFromNBT(int TagTag, cBookContent & a_BookContent, const cParsedNBT & a_NBT, bool a_SaveAsJson = false);
@@ -63,4 +78,7 @@ private:
/** Contains the pages */
AStringVector m_Pages;
+ /** If true the book is written */
+ bool m_IsSigned;
+
}; // tolua_export