Cuberite
A lightweight, fast and extensible game server for Minecraft
SchematicFileSerializer.h
Go to the documentation of this file.
1 
2 // SchematicFileSerializer.h
3 
4 // Declares the cSchematicFileSerializer class representing the interface to load and save cBlockArea to a .schematic file
5 
6 
7 
8 
9 
10 #pragma once
11 
12 #include "../BlockArea.h"
13 #include "../StringCompression.h"
14 
15 
16 
17 
18 
19 // fwd: FastNBT.h
20 class cParsedNBT;
21 
22 
23 
24 
25 
27 {
28 public:
29 
31  static void LoadFromSchematicFile(cBlockArea & a_BlockArea, const std::string & a_FileName);
32 
34  static void LoadFromSchematicString(cBlockArea & a_BlockArea, ContiguousByteBufferView a_SchematicData);
35 
37  static void SaveToSchematicFile(const cBlockArea & a_BlockArea, const std::string & a_FileName);
38 
40  static Compression::Result SaveToSchematicString(const cBlockArea & a_BlockArea);
41 
42 private:
43 
45  static void LoadFromSchematicNBT(cBlockArea & a_BlockArea, const cParsedNBT & a_NBT);
46 
48  static ContiguousByteBuffer SaveToSchematicNBT(const cBlockArea & a_BlockArea);
49 };
std::basic_string_view< std::byte > ContiguousByteBufferView
Definition: Globals.h:376
std::basic_string< std::byte > ContiguousByteBuffer
Definition: Globals.h:375
Contains the result of a compression or extraction operation.
Parses and contains the parsed data Also implements data accessor functions for tree traversal and va...
Definition: FastNBT.h:153
static void SaveToSchematicFile(const cBlockArea &a_BlockArea, const std::string &a_FileName)
Saves the area into a .schematic file.
static void LoadFromSchematicString(cBlockArea &a_BlockArea, ContiguousByteBufferView a_SchematicData)
Loads an area from a string containing the .schematic file data.
static Compression::Result SaveToSchematicString(const cBlockArea &a_BlockArea)
Saves the area into a string containing the .schematic file data.
static void LoadFromSchematicFile(cBlockArea &a_BlockArea, const std::string &a_FileName)
Loads an area from a .schematic file.
static ContiguousByteBuffer SaveToSchematicNBT(const cBlockArea &a_BlockArea)
Saves the area into a NBT representation and returns the NBT data as a string.
static void LoadFromSchematicNBT(cBlockArea &a_BlockArea, const cParsedNBT &a_NBT)
Loads the area from a schematic file uncompressed and parsed into a NBT tree.