forked from mcneel/opennurbs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathopennurbs_userdata_obsolete.cpp
181 lines (148 loc) · 6.18 KB
/
opennurbs_userdata_obsolete.cpp
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
169
170
171
172
173
174
175
176
177
178
179
180
/* $NoKeywords: $ */
/*
//
// Copyright (c) 1993-2012 Robert McNeel & Associates. All rights reserved.
// OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
// McNeel & Associates.
//
// THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
// ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
// MERCHANTABILITY ARE HEREBY DISCLAIMED.
//
// For complete openNURBS copyright information see <http://www.opennurbs.org>.
//
////////////////////////////////////////////////////////////////
*/
#include "opennurbs.h"
#if !defined(ON_COMPILING_OPENNURBS)
// This check is included in all opennurbs source .c and .cpp files to insure
// ON_COMPILING_OPENNURBS is defined when opennurbs source is compiled.
// When opennurbs source is being compiled, ON_COMPILING_OPENNURBS is defined
// and the opennurbs .h files alter what is declared and how it is declared.
#error ON_COMPILING_OPENNURBS must be defined when compiling opennurbs
#endif
///////////////////////////////////////////////////////////////
//
// This file is the user data grave yard.
// It contains code necessary to read and destroy obsolete user data
// that was saved in 3dm archives at some point.
// If this code were deleted, then the obsolete user data would persist
// as "goo" for a long time after it is no longer needed.
//
static bool ON_Internal_ReadObsoleteUserDataAnonymouseChunk(ON_BinaryArchive& archive)
{
// If the obsolete user data's Write()/Read() function wrapped all the contents in
// an anonymous chunk (which is the suggested best practice), then
// this skip over everything in the chunk and not generate any file read warnings or errors.
int major_version = 0;
int minor_version = 0;
bool rc = archive.BeginRead3dmChunk(TCODE_ANONYMOUS_CHUNK,&major_version,&minor_version);
if ( !rc )
return false;
// Skip all obsolete information
const bool bSupressPartiallyReadChunkWarning = true;
if ( !archive.EndRead3dmChunk(bSupressPartiallyReadChunkWarning) )
rc = false;
return rc;
}
class /*NEVER EXPORT THIS CLASS DEFINITION*/ ON_Internal_ObsoleteUserData : public ON_UserData
{
ON_OBJECT_DECLARE(ON_Internal_ObsoleteUserData);
public:
ON_Internal_ObsoleteUserData() = default;
~ON_Internal_ObsoleteUserData() = default;
ON_Internal_ObsoleteUserData(const ON_Internal_ObsoleteUserData& src) = default;
ON_Internal_ObsoleteUserData& operator=(const ON_Internal_ObsoleteUserData& src) = default;
public:
bool Archive() const override
{
// NEVER WRITE
return false;
}
bool Read(ON_BinaryArchive& binary_archive) override
{
return ON_Internal_ReadObsoleteUserDataAnonymouseChunk(binary_archive);
}
bool DeleteAfterRead(
const class ON_BinaryArchive& archive,
class ON_Object* parent_object
) const override
{
return true;
}
bool IsValid( class ON_TextLog* text_log = nullptr ) const override
{
return true;
}
bool GetDescription(ON_wString& description) override
{
description = L"OBSOLETE user data";
return true;
}
};
ON_OBJECT_IMPLEMENT(ON_Internal_ObsoleteUserData,ON_UserData,"EDA27090-1DDD-4E4D-AB0C-75CCF0216565");
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
class /*NEVER EXPORT THIS CLASS DEFINITION*/ ON_OBSOLETE_IDefLayerSettingsUserData : public ON_Internal_ObsoleteUserData
{
// This class was used in V5 files - the information it saved never worked correctly.
ON_OBJECT_DECLARE(ON_OBSOLETE_IDefLayerSettingsUserData);
public:
ON_OBSOLETE_IDefLayerSettingsUserData()
{
m_userdata_uuid = ON_CLASS_ID(ON_OBSOLETE_IDefLayerSettingsUserData);
m_application_uuid = ON_opennurbs5_id;
m_userdata_copycount = 0; // never copy this user data
}
~ON_OBSOLETE_IDefLayerSettingsUserData() = default;
ON_OBSOLETE_IDefLayerSettingsUserData(const ON_OBSOLETE_IDefLayerSettingsUserData& src)
: ON_Internal_ObsoleteUserData(src)
{
m_userdata_uuid = ON_CLASS_ID(ON_OBSOLETE_IDefLayerSettingsUserData);
m_application_uuid = ON_opennurbs5_id;
m_userdata_copycount = 0; // never copy this user data
}
ON_OBSOLETE_IDefLayerSettingsUserData& operator=(const ON_OBSOLETE_IDefLayerSettingsUserData& src) = default;
public:
bool GetDescription(ON_wString& description) override
{
description = L"OBSOLETE ON_OBSOLETE_IDefLayerSettingsUserData";
return true;
}
};
ON_OBJECT_IMPLEMENT(ON_OBSOLETE_IDefLayerSettingsUserData,ON_UserData,"11EE2C1F-F90D-4C6A-A7CD-EC8532E1E32D");
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
class /*NEVER EXPORT THIS CLASS DEFINITION*/ ON_OBSOLETE_LayerSettingsUserData : public ON_Internal_ObsoleteUserData
{
// This class was used in V5 files - the information it saved never worked correctly.
ON_OBJECT_DECLARE(ON_OBSOLETE_LayerSettingsUserData);
public:
ON_OBSOLETE_LayerSettingsUserData()
{
m_userdata_uuid = ON_CLASS_ID(ON_OBSOLETE_LayerSettingsUserData);
m_application_uuid = ON_opennurbs5_id;
m_userdata_copycount = 0; // never copy this user data
}
~ON_OBSOLETE_LayerSettingsUserData() = default;
ON_OBSOLETE_LayerSettingsUserData(const ON_OBSOLETE_LayerSettingsUserData& src)
: ON_Internal_ObsoleteUserData(src)
{
m_userdata_uuid = ON_CLASS_ID(ON_OBSOLETE_LayerSettingsUserData);
m_application_uuid = ON_opennurbs5_id;
m_userdata_copycount = 0; // never copy this user data
}
ON_OBSOLETE_LayerSettingsUserData& operator=(const ON_OBSOLETE_LayerSettingsUserData&) = default;
public:
bool GetDescription(ON_wString& description) override
{
description = L"OBSOLETE ON_OBSOLETE_LayerSettingsUserData";
return true;
}
};
ON_OBJECT_IMPLEMENT(ON_OBSOLETE_LayerSettingsUserData,ON_UserData,"BFB63C09-4BC7-4727-89BB-7CC754118200");
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////