-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmeta_filedata.h
168 lines (158 loc) · 5.33 KB
/
meta_filedata.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/*
* PGE File Library - a library to process file formats, part of Moondust project
*
* Copyright (c) 2014-2025 Vitaly Novichkov <[email protected]>
*
* The MIT License (MIT)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
/*!
* \file meta_filedata.h
* \brief Contains defition of the common meta-data structures and classes
*/
#pragma once
#ifndef META_FILEDATA_H
#define META_FILEDATA_H
#include "pge_file_lib_globs.h"
#include <memory>
/**
* @brief Common data structure meta-data
*/
struct FileFormatMeta
{
FileFormatMeta():
ReadFileValid(true),
ERROR_linenum(-1),
RecentFormat(0),
RecentFormatVersion(0),
modified(true),
untitled(true),
smbx64strict(false)
{}
//! Is file parsed correctly, false if some error is occouped
bool ReadFileValid;
//! Error messsage
PGESTRING ERROR_info;
//! Line data where error was occouped
PGESTRING ERROR_linedata;
//! Number of line where error was occouped
long ERROR_linenum;
//! Recently used (open or save) file format
int RecentFormat;
//! Recently used format version (for SMBX1...64 files only)
unsigned int RecentFormatVersion;
//! Is file was modified since open?
bool modified;
//! Is this level made from scratch and was not saved into file?
bool untitled;
//! Enable SMBX64 Standard restrictions
//! (disable unsupported features and warn about limit exiting)
bool smbx64strict;
//! Recent file name since file was opened
PGESTRING filename;
//! Recent file path where file was located since it was opened
PGESTRING path;
//! A config pack identify string.
PGESTRING configPackId;
// Missmatching of a config pack identify string with a same string at
// the currently loaded config pack will lead a warning of possible
// incompatibility.
};
/**
* @brief Common element meta-data
*/
struct ElementMeta
{
ElementMeta() :
array_id(0),
index(0),
userdata(nullptr) {}
//! Array-ID is an unique key value identificates each unique element object.
//! Re-counts on each file reloading
unsigned int array_id;
//! Recent array index where element was saved (used to speed-up settings synchronization)
unsigned int index;
//! JSON-like string with a custom properties (without master brackets, like "param":"value,["subparam":value])
PGESTRING custom_params;
//! User data pointer, Useful in the editors to have direct pointer to pre-placed elements
void *userdata;
};
/*!
* \brief Position bookmark entry structure
*/
struct Bookmark
{
PGESTRING bookmarkName; //!< Name of bookmark
double x; //!< Bookmarked X position of the camera
double y; //!< Bookmarked Y position of the camera
};
/*!
* \brief Contains backup of helpful techincal data used by PGE Editor
*/
class CrashData
{
public:
/*!
* \brief Constructor
*/
explicit CrashData();
/*!
* \brief Copy constructor
* \param _cd another CrashData object
*/
CrashData(const CrashData &_cd);
CrashData &operator=(const CrashData &_cd);
/*!
* \brief Sets default preferences
*/
void reset();
//! Is crash data was used by editor (if false, LVLX writer will not record crash data into file)
bool used;
//! Is this level was untitled since crash occopued?
bool untitled;
//! Is this level was modified before crash occouped?
bool modifyed;
//! Turn on strict SMBX64 mode
bool strictModeSMBX64;
//! Recent file format ID (specific enum in the format structure declaration)
int fmtID;
//! Recent file format version
unsigned int fmtVer;
//! Full original file path file which was opened before crash occouped
PGESTRING fullPath;
//! Full episode path of file which was opened before crash occouped
PGESTRING path;
//! Base file name of file which was opened before crash occouped
PGESTRING filename;
};
/*!
* \brief Contains additional helpful meda-data used by PGE Applications
*/
struct MetaData
{
//! Array of all position bookmarks presented in the opened file
PGELIST<Bookmark> bookmarks;
/* For Editor application only*/
//! Crash backup of Editor's special data
CrashData crash;
//!Helper meta-data
FileFormatMeta meta;
};
#endif // META_FILEDATA_H