16#if !defined(ON_ARCHIVE_INC_)
17#define ON_ARCHIVE_INC_
20#if defined(ON_COMPILER_MSC)
39int ON_DebugWriteObject(
const class ON_Object* pObject );
55int ON_DebugWritePoint(
const class ON_3dPoint* p3dPoint );
76class ON_ObjectAttributes;
124#if defined(ON_DLL_TEMPLATE)
128#pragma warning( push )
129#pragma warning( disable : 4231 )
132#pragma warning( pop )
174 bool BigSeekFromCurrentPosition(
ON__INT64 offset );
186 bool ToggleByteOrder(
194 const char* TypecodeName(
unsigned int tcode );
197 char* ON_TypecodeParse(
unsigned int tcode,
char* typecode_name,
size_t max_length );
199 bool ReadMode()
const;
200 bool WriteMode()
const;
208 ON::endian Endian()
const;
210 int BadCRCCount()
const;
212 bool ReadByte(
size_t,
void* );
214 bool WriteByte(
size_t,
const void* );
240 bool EnableCRCCalculation(
bool bEnable );
267 bool ReadCompressedBufferSize(
size_t* sizeof__outbuffer );
290 bool ReadCompressedBuffer(
291 size_t sizeof__outbuffer,
305 bool WriteCompressedBuffer(
306 size_t sizeof__inbuffer,
310 bool ReadBool(
bool* );
375 bool ReadBigSize(
size_t* );
377 bool ReadBigTime( time_t* );
439 bool ReadTime(
struct tm& );
459 bool ReadComponentIndex( ON_COMPONENT_INDEX& );
492 bool WriteBool(
bool );
515 const unsigned short*
557 bool WriteBigSize(
size_t );
559 bool WriteBigTime( time_t );
604 bool WriteLine(
const ON_Line&);
606 bool WriteArc(
const ON_Arc&);
612 bool WriteUuid(
const ON_UUID& );
620 bool WriteTime(
const struct tm& );
633 const unsigned short*
638 bool WriteComponentIndex(
const ON_COMPONENT_INDEX& );
726 bool EnableSave3dmRenderMeshes(
ON_BOOL32 =
true );
727 bool Save3dmRenderMeshes()
const;
729 bool EnableSave3dmAnalysisMeshes(
ON_BOOL32 =
true );
730 bool Save3dmAnalysisMeshes()
const;
732 bool EnableSaveUserData(
ON_BOOL32 =
true );
733 bool SaveUserData()
const;
738 bool Write3dmStartSection(
746 bool Read3dmStartSection(
754 bool Write3dmProperties(
757 bool Read3dmProperties(
764 bool Write3dmSettings(
767 bool Read3dmSettings(
774 bool BeginWrite3dmBitmapTable();
776 bool EndWrite3dmBitmapTable();
778 bool BeginRead3dmBitmapTable();
783 bool EndRead3dmBitmapTable();
788 bool BeginWrite3dmTextureMappingTable();
790 bool EndWrite3dmTextureMappingTable();
792 bool BeginRead3dmTextureMappingTable();
793 int Read3dmTextureMapping(
796 bool EndRead3dmTextureMappingTable();
801 bool BeginWrite3dmMaterialTable();
803 bool EndWrite3dmMaterialTable();
805 bool BeginRead3dmMaterialTable();
809 bool EndRead3dmMaterialTable();
814 bool BeginWrite3dmLinetypeTable();
816 bool EndWrite3dmLinetypeTable();
818 bool BeginRead3dmLinetypeTable();
820 bool EndRead3dmLinetypeTable();
825 bool BeginWrite3dmLayerTable();
826 bool Write3dmLayer(
const ON_Layer& );
827 bool EndWrite3dmLayerTable();
829 bool BeginRead3dmLayerTable();
833 bool EndRead3dmLayerTable();
838 bool BeginWrite3dmGroupTable();
839 bool Write3dmGroup(
const ON_Group& );
840 bool EndWrite3dmGroupTable();
842 bool BeginRead3dmGroupTable();
883 bool EndRead3dmGroupTable();
889 bool BeginWrite3dmFontTable();
890 bool Write3dmFont(
const ON_Font& );
891 bool EndWrite3dmFontTable();
893 bool BeginRead3dmFontTable();
934 bool EndRead3dmFontTable();
940 bool BeginWrite3dmDimStyleTable();
942 bool EndWrite3dmDimStyleTable();
944 bool BeginRead3dmDimStyleTable();
986 bool EndRead3dmDimStyleTable();
992 bool BeginWrite3dmLightTable();
993 bool Write3dmLight(
const ON_Light&,
996 bool EndWrite3dmLightTable();
998 bool BeginRead3dmLightTable();
1006 bool EndRead3dmLightTable();
1012 bool BeginWrite3dmHatchPatternTable();
1014 bool EndWrite3dmHatchPatternTable();
1016 bool BeginRead3dmHatchPatternTable();
1018 bool EndRead3dmHatchPatternTable();
1023 bool BeginWrite3dmInstanceDefinitionTable();
1025 bool EndWrite3dmInstanceDefinitionTable();
1027 bool BeginRead3dmInstanceDefinitionTable();
1063 int Read3dmInstanceDefinition(
1067 bool EndRead3dmInstanceDefinitionTable();
1072 bool BeginWrite3dmObjectTable();
1073 bool Write3dmObject(
1077 bool EndWrite3dmObjectTable();
1079 bool BeginRead3dmObjectTable();
1089 bool EndRead3dmObjectTable();
1094 bool BeginWrite3dmHistoryRecordTable();
1095 bool Write3dmHistoryRecord(
1098 bool EndWrite3dmHistoryRecordTable();
1100 bool BeginRead3dmHistoryRecordTable();
1108 int Read3dmHistoryRecord(
1111 bool EndRead3dmHistoryRecordTable();
1147 bool BeginWrite3dmUserTable(
1150 int goo_3dm_version,
1151 int goo_opennurbs_version
1154 bool EndWrite3dmUserTable();
1177 bool Write3dmAnonymousUserTableRecord(
1179 int goo_3dm_version,
1180 int goo_opennurbs_version,
1185#if defined(ON_COMPILER_MSC)
1186 __declspec(deprecated)
1188 bool BeginWrite3dmUserTable(
const ON_UUID& );
1191#if defined(ON_COMPILER_MSC)
1192 __declspec(deprecated)
1194 bool Write3dmAnonymousUserTable(
const ON_3dmGoo& );
1213 bool BeginRead3dmUserTable(
1215 bool* bLastSavedAsGoo,
1216 int* archive_3dm_version,
1217 int* archive_opennurbs_version
1228 bool Read3dmAnonymousUserTable(
1229 int archive_3dm_version,
1230 int archive_opennurbs_version,
1234 bool EndRead3dmUserTable();
1237#if defined(ON_COMPILER_MSC)
1238 __declspec(deprecated)
1240 bool BeginRead3dmUserTable(
1245#if defined(ON_COMPILER_MSC)
1246 __declspec(deprecated)
1248 bool Read3dmAnonymousUserTable(
ON_3dmGoo& );
1266 bool Write3dmEndMark();
1281 bool Read3dmEndMark(
1305 bool BeginWrite3dmChunk(
1310 bool BeginWrite3dmBigChunk(
1328 bool BeginWrite3dmChunk(
1336 bool EndWrite3dmChunk();
1341#if defined(ON_COMPILER_MSC)
1342 __declspec(deprecated)
1344 bool BeginRead3dmChunk(
1351 bool BeginRead3dmBigChunk(
1368 bool BeginRead3dmChunk(
1369 unsigned int expected_tcode,
1378 bool EndRead3dmChunk();
1407 bool BeginWriteDictionary(
1410 const wchar_t* dictionary_name
1428 bool EndWriteDictionary();
1446 bool BeginWriteDictionaryEntry(
1448 const wchar_t* entry_name
1450 bool EndWriteDictionaryEntry();
1452 bool BeginReadDictionary(
1457 bool EndReadDictionary();
1471 int BeginReadDictionaryEntry(
1475 bool EndReadDictionaryEntry();
1480#if defined(ON_COMPILER_MSC)
1481 __declspec(deprecated)
1483 bool PeekAt3dmChunkType(
1488 bool PeekAt3dmBigChunkType(
1493 bool Seek3dmChunkFromStart(
1501 bool Seek3dmChunkFromCurrentPosition(
1516 bool Write3dmChunkVersion(
1520 bool Read3dmChunkVersion(
1535 bool WriteObjectUserData(
const ON_Object&
object );
1547 bool ReadObjectUserData(
ON_Object&
object );
1565 int Archive3dmVersion()
const;
1587 int ArchiveOpenNURBSVersion()
const;
1605 size_t ArchiveStartOffset()
const;
1609 no_active_table = 0,
1655 bool FindTableInDamagedArchive(
1656 unsigned int tcode_table,
1657 unsigned int tcode_record,
1680 int recursion_depth = 0
1701 size_t Write(
size_t,
const void* ) = 0;
1724 int LoadUserDataApplication(
1728 bool SetArchive3dmVersion(
int);
1736 bool WriteInt16(
size_t,
const ON__INT16* );
1740 bool WriteInt32(
size_t,
const ON__INT32* );
1744 bool WriteInt64(
size_t,
const ON__INT64* );
1747 bool BeginWrite3dmTable(
1750 bool EndWrite3dmTable(
1753 bool BeginRead3dmTable(
1756 bool EndRead3dmTable(
1769 int Read3dmV1Object(
1779 bool Read3dmV1AttributesOrMaterial(
1787 int Read3dmV1LayerIndex(
const char* )
const;
1802 ON::archive_mode Mode()
const;
1803 void UpdateCRC(
size_t,
const void* );
1830 unsigned int ErrorMessageMask()
const;
1867 table_type TableTypeFromTypecode(
unsigned int );
1879 bool FindMisplacedTable(
1887 bool ReadObjectUserDataAnonymousChunk(
1888 const ON__UINT64 length_TCODE_ANONYMOUS_CHUNK,
1889 const int archive_3dm_version,
1890 const int archive_opennurbs_version,
1894 size_t SizeofChunkLength()
const;
1912 sizeof_x_buffer = 16384
1914 unsigned char buffer[sizeof_x_buffer];
1919 size_t WriteDeflate(
1927 bool CompressionInit();
1928 void CompressionEnd();
1985 size_t CurrentPosition()
const;
1986 bool SeekFromCurrentPosition(
int);
1987 bool SeekFromStart(
size_t);
1991 bool SeekFromEnd(
int );
2001 void EnableMemoryBuffer(
2006 size_t Read(
size_t,
void* );
2007 size_t Write(
size_t,
const void* );
2052 size_t sizeof_buffer,
2055 int archive_3dm_version,
2056 int archive_opennurbs_version
2065 size_t SizeOfBuffer()
const;
2071 const void* Buffer()
const;
2074 size_t CurrentPosition()
const;
2075 bool SeekFromCurrentPosition(
int);
2076 bool SeekFromStart(
size_t);
2081 size_t Read(
size_t,
void* );
2082 size_t Write(
size_t,
const void* );
void version()
Prints version information.
Definition autostart.js:59
Definition opennurbs_point.h:253
Definition opennurbs_point.h:655
Definition opennurbs_point.h:403
Definition opennurbs_point.h:931
Definition opennurbs_archive.h:1959
unsigned char * m_goo
Definition opennurbs_archive.h:1971
unsigned int m_typecode
Definition opennurbs_archive.h:1969
int m_value
Definition opennurbs_archive.h:1970
ON_3dmGoo * m_prev_goo
Definition opennurbs_archive.h:1973
ON_3dmGoo * m_next_goo
Definition opennurbs_archive.h:1972
Definition opennurbs_3dm_attributes.h:41
Definition opennurbs_3dm_properties.h:105
Definition opennurbs_3dm_settings.h:684
Definition opennurbs_point.h:555
Definition opennurbs_archive.cpp:8341
Definition opennurbs_arc.h:34
Definition opennurbs_archive.h:152
ON::archive_mode m_mode
Definition opennurbs_archive.h:1935
ON_SimpleArray< ON_UUID > m_V3_plugin_id_list
Definition opennurbs_archive.h:1947
table_type m_active_table
Definition opennurbs_archive.h:1865
bool m_bDoChunkCRC
Definition opennurbs_archive.h:1900
bool WriteInt8(size_t, const ON__INT8 *)
virtual size_t Read(size_t, void *)=0
int m_3dm_v1_layer_index
Definition opennurbs_archive.h:1807
bool m_bSaveRenderMeshes
Definition opennurbs_archive.h:1941
virtual bool AtEnd() const =0
virtual size_t Write(size_t, const void *)=0
ON::endian m_endian
Definition opennurbs_archive.h:1933
virtual bool SeekFromCurrentPosition(int)=0
virtual bool SeekFromStart(size_t)=0
size_t m_3dm_start_section_offset
Definition opennurbs_archive.h:1863
ON_BinaryArchive(const ON_BinaryArchive &)
virtual size_t CurrentPosition() const =0
struct ON__3dmV1LayerIndex * m_V1_layer_list
Definition opennurbs_archive.h:1949
bool m_bSaveUserData
Definition opennurbs_archive.h:1938
int m_3dm_version
Definition opennurbs_archive.h:1806
bool ReadInt8(size_t, ON__INT8 *)
ON::archive_mode mode
Definition opennurbs_archive.h:1909
ON_SimpleArray< ON_3DM_BIG_CHUNK > m_chunk
Definition opennurbs_archive.h:1869
ON_BinaryArchive & operator=(const ON_BinaryArchive &)
bool m_bSaveAnalysisMeshes
Definition opennurbs_archive.h:1942
int m_bad_CRC_count
Definition opennurbs_archive.h:1902
z_stream strm
Definition opennurbs_archive.h:1915
unsigned int m_error_message_mask
Definition opennurbs_archive.h:1828
int m_3dm_opennurbs_version
Definition opennurbs_archive.h:1857
bool m_bEmbedTextureBitmaps
Definition opennurbs_archive.h:1940
int m_3dm_v1_material_index
Definition opennurbs_archive.h:1808
bool m_bSavePreviewImage
Definition opennurbs_archive.h:1939
table_type
Definition opennurbs_archive.h:1608
@ bitmap_table
Definition opennurbs_archive.h:1612
@ object_table
Definition opennurbs_archive.h:1618
@ texture_mapping_table
Definition opennurbs_archive.h:1613
@ dimstyle_table
Definition opennurbs_archive.h:1621
@ font_table
Definition opennurbs_archive.h:1620
@ light_table
Definition opennurbs_archive.h:1617
@ settings_table
Definition opennurbs_archive.h:1611
@ material_table
Definition opennurbs_archive.h:1614
@ historyrecord_table
Definition opennurbs_archive.h:1624
@ properties_table
Definition opennurbs_archive.h:1610
@ instance_definition_table
Definition opennurbs_archive.h:1623
@ linetype_table
Definition opennurbs_archive.h:1615
@ hatchpattern_table
Definition opennurbs_archive.h:1622
@ group_table
Definition opennurbs_archive.h:1619
@ layer_table
Definition opennurbs_archive.h:1616
Definition opennurbs_archive.h:1978
size_t m_memory_buffer_size
Definition opennurbs_archive.h:2021
size_t m_memory_buffer_capacity
Definition opennurbs_archive.h:2020
ON_BinaryFile(const ON_BinaryFile &)
ON_BinaryFile & operator=(const ON_BinaryFile &)
unsigned char * m_memory_buffer
Definition opennurbs_archive.h:2023
FILE * m_fp
Definition opennurbs_archive.h:2012
size_t m_memory_buffer_ptr
Definition opennurbs_archive.h:2022
Definition opennurbs_bitmap.h:28
Definition opennurbs_bounding_box.h:25
Definition opennurbs_circle.h:33
Definition opennurbs_array.h:760
Definition opennurbs_color.h:24
Definition opennurbs_dimstyle.h:20
Definition opennurbs_linestyle.h:43
Definition opennurbs_font.h:20
Definition opennurbs_group.h:20
Definition opennurbs_hatch.h:313
Definition opennurbs_object_history.h:30
Definition opennurbs_instance.h:27
Definition opennurbs_point.h:46
Definition opennurbs_layer.h:20
Definition opennurbs_light.h:20
Definition opennurbs_line.h:20
Definition opennurbs_linetype.h:40
Definition opennurbs_linestyle.h:83
Definition opennurbs_material.h:25
Definition opennurbs_object.h:393
Definition opennurbs_point.h:1169
Definition opennurbs_plane.h:20
Definition opennurbs_archive.h:2033
ON__INT_PTR m_reserved2
Definition opennurbs_archive.h:2091
size_t m_sizeof_buffer
Definition opennurbs_archive.h:2088
size_t m_buffer_position
Definition opennurbs_archive.h:2089
ON__INT_PTR m_reserved4
Definition opennurbs_archive.h:2093
ON__INT_PTR m_reserved3
Definition opennurbs_archive.h:2092
ON_Read3dmBufferArchive(const ON_Read3dmBufferArchive &)
ON__INT_PTR m_reserved1
Definition opennurbs_archive.h:2090
const unsigned char * m_buffer
Definition opennurbs_archive.h:2087
ON_Read3dmBufferArchive & operator=(const ON_Read3dmBufferArchive &)
ON_Read3dmBufferArchive()
void * m_p
Definition opennurbs_archive.h:2086
Definition opennurbs_array.h:46
Definition opennurbs_string.h:150
Definition opennurbs_textlog.h:20
Definition opennurbs_texture_mapping.h:37
Definition opennurbs_uuid.h:31
Definition opennurbs_userdata.h:20
Definition opennurbs_string.h:392
bool ON_IsLongChunkTypecode(ON__UINT32 typecode)
Definition opennurbs_archive.cpp:66
void ON_SetBinaryArchiveOpenNURBSVersion(ON_BinaryArchive &, int)
Definition opennurbs_3dm_properties.cpp:342
bool ON_IsShortChunkTypecode(ON__UINT32 typecode)
ON_DECL bool ON_WriteOneObjectArchive(ON_BinaryArchive &archive, int version, const ON_Object &object)
Definition opennurbs_archive.cpp:12646
#define ON_DECL
Definition opennurbs_defines.h:92
#define ON_CLASS
Definition opennurbs_defines.h:91
short ON__INT16
Definition opennurbs_system.h:317
long long ON__INT64
Definition opennurbs_system.h:353
char ON__INT8
Definition opennurbs_system.h:311
unsigned char ON__UINT8
Definition opennurbs_system.h:314
unsigned long long ON__UINT64
Definition opennurbs_system.h:356
int ON__INT32
Definition opennurbs_system.h:323
unsigned short ON__UINT16
Definition opennurbs_system.h:320
int ON_BOOL32
Definition opennurbs_system.h:362
unsigned int ON__UINT32
Definition opennurbs_system.h:326
int ON__INT_PTR
Definition opennurbs_system.h:377
Definition opennurbs_archive.h:97
ON__UINT64 Length() const
Definition opennurbs_archive.cpp:4130
ON__UINT8 m_reserved2
Definition opennurbs_archive.h:110
ON__UINT64 m_big_offset
Definition opennurbs_archive.h:98
ON__UINT8 m_do_crc16
Definition opennurbs_archive.h:114
ON__UINT16 m_crc16
Definition opennurbs_archive.h:116
ON__UINT32 m_typecode
Definition opennurbs_archive.h:106
ON__INT64 m_big_value
Definition opennurbs_archive.h:105
ON__UINT8 m_bLongChunk
Definition opennurbs_archive.h:108
ON__UINT32 m_crc32
Definition opennurbs_archive.h:117
ON__UINT8 m_do_crc32
Definition opennurbs_archive.h:115
ON__UINT8 m_reserved1
Definition opennurbs_archive.h:109
ON__UINT8 m_reserved3
Definition opennurbs_archive.h:111
Definition opennurbs_archive.h:82
ON__UINT32 m_do_crc32
Definition opennurbs_archive.h:92
int m_do_length
Definition opennurbs_archive.h:89
size_t m_offset
Definition opennurbs_archive.h:83
ON__UINT32 m_crc32
Definition opennurbs_archive.h:93
ON__UINT16 m_crc16
Definition opennurbs_archive.h:91
unsigned int m_typecode
Definition opennurbs_archive.h:87
ON__UINT16 m_do_crc16
Definition opennurbs_archive.h:90
int m_value
Definition opennurbs_archive.h:88
Definition opennurbs_archive.cpp:120