From 7d01fc5e9f58e3939bc640390a89e599bf811b5c Mon Sep 17 00:00:00 2001 From: Jos Groot Lipman Date: Mon, 17 Jun 2024 10:28:40 +0000 Subject: [PATCH] V4.30 23-08-2022 - Visual Studio 2022 svn path=/Slnkdwf/trunk/; revision=65165 --- Barcode/bblib.vcxproj | 10 +- QRCode/QRCode.vcxproj | 10 +- SlnkDWFCom/SLNKDWF.vcxproj | 10 +- SlnkDWFImpl/CxImage/CxImage/cximage.vcxproj | 10 +- SlnkDWFImpl/CxImage/jpeg/Jpeg.vcxproj | 10 +- SlnkDWFImpl/CxImage/png/png.vcxproj | 10 +- SlnkDWFImpl/SLNKDWFStaticRO.vcxproj | 10 +- SlnkDWFImpl/SLNKDWFStaticRW.vcxproj | 10 +- Standalone/SLNKDWFViewer.vcxproj | 10 +- Viewer/Viewer.vcxproj | 10 +- .../global/src/dwfcore/paging/Archive.h | 166 ++++++++++++++++++ WincmdContent/filesys.vcxproj | 10 +- WincmdPacker/WincmdPacker.vcxproj | 10 +- WincmdViewer/WINCDMDWF.vcxproj | 10 +- 14 files changed, 231 insertions(+), 65 deletions(-) create mode 100644 Whiptk770/develop/global/src/dwfcore/paging/Archive.h diff --git a/Barcode/bblib.vcxproj b/Barcode/bblib.vcxproj index 03ef28f..d740fd2 100644 --- a/Barcode/bblib.vcxproj +++ b/Barcode/bblib.vcxproj @@ -22,7 +22,7 @@ {0E49D578-377F-4C07-8339-8737AA9FA0EC} bblib MFCProj - 8.1 + 10.0 @@ -30,26 +30,26 @@ false Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary false Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 diff --git a/QRCode/QRCode.vcxproj b/QRCode/QRCode.vcxproj index bf9d323..ee965d9 100644 --- a/QRCode/QRCode.vcxproj +++ b/QRCode/QRCode.vcxproj @@ -22,7 +22,7 @@ {3EA5B7D3-EA9B-420B-B283-0D92E620B970} QRCode Win32Proj - 8.1 + 10.0 @@ -30,25 +30,25 @@ Static MultiByte true - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 diff --git a/SlnkDWFCom/SLNKDWF.vcxproj b/SlnkDWFCom/SLNKDWF.vcxproj index 7be05f5..ed298f3 100644 --- a/SlnkDWFCom/SLNKDWF.vcxproj +++ b/SlnkDWFCom/SLNKDWF.vcxproj @@ -23,32 +23,32 @@ {7F9F1060-C14D-4DD5-91D3-FA7263FECF5E} SLNKDWF AtlProj - 8.1 + 10.0 DynamicLibrary Static MultiByte - v140 + v143 DynamicLibrary Static MultiByte - v140 + v143 DynamicLibrary Static MultiByte - v140 + v143 DynamicLibrary Static MultiByte - v140 + v143 diff --git a/SlnkDWFImpl/CxImage/CxImage/cximage.vcxproj b/SlnkDWFImpl/CxImage/CxImage/cximage.vcxproj index 2f09f92..2f8ce91 100644 --- a/SlnkDWFImpl/CxImage/CxImage/cximage.vcxproj +++ b/SlnkDWFImpl/CxImage/CxImage/cximage.vcxproj @@ -21,28 +21,28 @@ {C8E16319-530C-47D5-BED8-B18AB41FC01F} MFCProj - 8.1 + 10.0 StaticLibrary - v140 + v143 Dynamic MultiByte StaticLibrary - v140 + v143 StaticLibrary - v140 + v143 false MultiByte StaticLibrary - v140 + v143 false diff --git a/SlnkDWFImpl/CxImage/jpeg/Jpeg.vcxproj b/SlnkDWFImpl/CxImage/jpeg/Jpeg.vcxproj index 2eea0c6..9b9ced3 100644 --- a/SlnkDWFImpl/CxImage/jpeg/Jpeg.vcxproj +++ b/SlnkDWFImpl/CxImage/jpeg/Jpeg.vcxproj @@ -22,26 +22,26 @@ jpeg {95E4E28A-C7FB-4764-BA53-48E3394511EF} MFCProj - 8.1 + 10.0 StaticLibrary - v140 + v143 false StaticLibrary - v140 + v143 StaticLibrary - v140 + v143 Dynamic StaticLibrary - v140 + v143 diff --git a/SlnkDWFImpl/CxImage/png/png.vcxproj b/SlnkDWFImpl/CxImage/png/png.vcxproj index 60f14f2..e04d057 100644 --- a/SlnkDWFImpl/CxImage/png/png.vcxproj +++ b/SlnkDWFImpl/CxImage/png/png.vcxproj @@ -21,28 +21,28 @@ {6C1E65C3-D0FA-488F-8B5A-4790B905117D} MFCProj - 8.1 + 10.0 StaticLibrary - v140 + v143 false MultiByte StaticLibrary - v140 + v143 StaticLibrary - v140 + v143 Dynamic MultiByte StaticLibrary - v140 + v143 diff --git a/SlnkDWFImpl/SLNKDWFStaticRO.vcxproj b/SlnkDWFImpl/SLNKDWFStaticRO.vcxproj index 2914fb3..5e7f73e 100644 --- a/SlnkDWFImpl/SLNKDWFStaticRO.vcxproj +++ b/SlnkDWFImpl/SLNKDWFStaticRO.vcxproj @@ -22,32 +22,32 @@ {CF524F70-4DDD-4040-803B-41B5DE7B1CF9} SLNKDWF AtlProj - 8.1 + 10.0 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 diff --git a/SlnkDWFImpl/SLNKDWFStaticRW.vcxproj b/SlnkDWFImpl/SLNKDWFStaticRW.vcxproj index f094c60..883b538 100644 --- a/SlnkDWFImpl/SLNKDWFStaticRW.vcxproj +++ b/SlnkDWFImpl/SLNKDWFStaticRW.vcxproj @@ -22,32 +22,32 @@ {6EA5FCEC-1DB0-4542-8E41-9423021BD460} SLNKDWF AtlProj - 8.1 + 10.0 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 StaticLibrary Static MultiByte - v140 + v143 diff --git a/Standalone/SLNKDWFViewer.vcxproj b/Standalone/SLNKDWFViewer.vcxproj index 36717c7..22628a7 100644 --- a/Standalone/SLNKDWFViewer.vcxproj +++ b/Standalone/SLNKDWFViewer.vcxproj @@ -21,32 +21,32 @@ {B2601E72-4FF4-4B9C-A89F-C2E7DACF36FD} SLNKDWFViewer - 8.1 + 10.0 Application Static MultiByte - v140 + v143 Application Static MultiByte - v140 + v143 Application Static MultiByte - v140 + v143 Application Static MultiByte - v140 + v143 diff --git a/Viewer/Viewer.vcxproj b/Viewer/Viewer.vcxproj index b413851..1d69b5a 100644 --- a/Viewer/Viewer.vcxproj +++ b/Viewer/Viewer.vcxproj @@ -21,26 +21,26 @@ {6DFC9788-904C-4724-A734-06634061EF00} WINCDMDWF - 8.1 + 10.0 StaticLibrary false - v140 + v143 StaticLibrary false - v140 + v143 StaticLibrary - v140 + v143 StaticLibrary - v140 + v143 diff --git a/Whiptk770/develop/global/src/dwfcore/paging/Archive.h b/Whiptk770/develop/global/src/dwfcore/paging/Archive.h new file mode 100644 index 0000000..fc806b2 --- /dev/null +++ b/Whiptk770/develop/global/src/dwfcore/paging/Archive.h @@ -0,0 +1,166 @@ +// +// Copyright (c) 2003-2006 by Autodesk, Inc. +// +// By using this code, you are agreeing to the terms and conditions of +// the License Agreement included in the documentation for this code. +// +// AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, +// AS TO THE CORRECTNESS OF THIS CODE OR ANY DERIVATIVE +// WORKS WHICH INCORPORATE IT. +// +// AUTODESK PROVIDES THE CODE ON AN "AS-IS" BASIS +// AND EXPLICITLY DISCLAIMS ANY LIABILITY, INCLUDING +// CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS, +// OMISSIONS, AND OTHER PROBLEMS IN THE CODE. +// +// Use, duplication, or disclosure by the U.S. Government is subject to +// restrictions set forth in FAR 52.227-19 (Commercial Computer Software +// Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical +// Data and Computer Software), as applicable. +// + + +#ifndef _DWFCORE_ARCHIVE_H +#define _DWFCORE_ARCHIVE_H +#include "dwfcore/paging/PagingFwd.h" +#include "dwfcore/paging/Adapter.h" + +#include +#include + +/// +///\file dwfcore/paging/Archive.h +/// This header contains the declaration for archive concepts. An in/out archive can serialize a object into a data tBlock. +/// Each specialization of the in/out archive can duo to one single or group types +/// + +namespace DWFCore +{ + /** This namespace is internal + */ + namespace detail + { + /** helper for implement IsPodType ; + */ + template + struct IsPodTypeHelper + { + union + { + T t_; + char i_; + }; + }; + + /** type trait, implemented for check POD( plain old data) type. + */ + template + struct IsPodType + { + enum { size = sizeof(IsPodTypeHelper)}; + }; + } + + /** This class intends to load the data tBlock via DWFInputAdapter interface first, and then create the object and return to caller + \note the default implementation can't duo to any user defined types except POD (plain old data) types. + DWFArchive defined a CONCEPT and concept is a term of GP(generic programming). + A concept contains a set of requirements that describe a family of abstractions. + More information:http://www.generic-programming.org/ + */ + //POD implementation; + ///\param T the type to be loaded + template + class DWFArchive + { + ///if T is not a POD type, it will cause a compilation error. + static const int kCheck = detail::IsPodType::size; + public: + typedef T tValueType; + typedef T* tPointer; + typedef const T* tConstPointer; + typedef typename DWFPagingAdapter::tHandleType tHandleType; + + /** load the data tBlock of the object indicated by hHandle, and create the object with the data. + \pre hHandle != DWFInputAdapter::kInvalidHandle + \pre pObject != 0 + \param rInputAdapter InputAdapter for load from + \param hHandle indicator of the object + \param pObject point to uninitialized object. + \post the object pointed by pObject was constructed. + \throw any + */ + static void load(DWFInputAdapter& rInputAdapter, tHandleType hHandle, tPointer pObject) + { + assert(hHandle != DWFInputAdapter::kInvalidHandle); + assert(pObject != 0); + + DWFInputAdapter::tBufferType buf; + rInputAdapter.load(hHandle, buf); + + if (buf.size() != sizeof(tValueType)) + { + _DWFCORE_THROW( DWFUnexpectedException, /*NOXLATE*/L"The Adapter returned invalid data, data source may be invalid" ); + } + + memcpy(pObject, &buf[0], buf.size()); //because T is a pod type, so here can use memcpy safely + } + + /** it intends to serialize the object and save the data tBlock via DWFOutputAdapter interface. + \pre t != 0 + \param t tPointer of the object will to be saved + \param old hHandle of the object before saved + \return new hHandle of the object after saved. + \post return != invalid_handle + \throw any + */ + static tHandleType save(DWFOutputAdapter& rOutputAdapter, tConstPointer t, tHandleType old) + { + DWFInputAdapter::tBufferType buf(sizeof(tValueType)); + memcpy(&buf[0], t, sizeof(tValueType)); + return rOutputAdapter.save(buf, old); + } + }; + + /** The specialization of DWFArchive for std::basic_string + the descriptions of template parameters can see std::basic_string + */ + template + class DWFArchive > + { + public: + typedef std::basic_string tValueType; + typedef tValueType* tPointer; + typedef const tValueType* tConstPointer; + typedef typename DWFPagingAdapter::tHandleType tHandleType; + + ///\copydoc DWFArchive::load(DWFInputAdapter& rInputAdapter, tHandleType hHandle, tPointer pObject) + static void load(DWFInputAdapter& rInputAdapter, tHandleType hHandle, tPointer pObject) + { + assert(hHandle != DWFInputAdapter::kInvalidHandle); + assert(pObject != 0); + + DWFInputAdapter::tBufferType buf; + rInputAdapter.load(hHandle, buf);//only load the raw data of basic_string + + if (buf.size() % sizeof(T) != 0) + { + _DWFCORE_THROW( DWFUnexpectedException, /*NOXLATE*/L"The Adapter returned invalid data, data source may be damaged" ); + } + + tPointer first = (tPointer)&*buf.begin(); + //restore the object. we can restore any object if the object's public method support these operation. + ::new (pObject) tValueType(first, first + buf.size() / sizeof(tValueType)); + } + + ///\copydoc DWFArchive::save(DWFInputAdapter& rOutputAdapter, tConstPointer p, tHandleType old) + static tHandleType save(DWFOutputAdapter& rOutputAdapter, tConstPointer p, tHandleType old) + { + DWFInputAdapter::tBufferType buf(p->size() * sizeof(tValueType)); + std::copy(p->begin(), p->end(), (tPointer)&buf[0] ); //we have no need to store everything of the object, we just store enough information for restoration. + + return rOutputAdapter.save(buf, old); + } + }; +} + +#endif //end _DWFCORE_ARCHIVE_H diff --git a/WincmdContent/filesys.vcxproj b/WincmdContent/filesys.vcxproj index 3bd7825..35963c9 100644 --- a/WincmdContent/filesys.vcxproj +++ b/WincmdContent/filesys.vcxproj @@ -22,32 +22,32 @@ WincmdContent {2F492A95-A23D-45C9-BBD9-E5B9325B22C1} filesys - 8.1 + 10.0 DynamicLibrary false MultiByte - v140 + v143 DynamicLibrary false MultiByte - v140 + v143 DynamicLibrary false MultiByte - v140 + v143 DynamicLibrary false MultiByte - v140 + v143 diff --git a/WincmdPacker/WincmdPacker.vcxproj b/WincmdPacker/WincmdPacker.vcxproj index a0c8290..fb6dfc1 100644 --- a/WincmdPacker/WincmdPacker.vcxproj +++ b/WincmdPacker/WincmdPacker.vcxproj @@ -21,7 +21,7 @@ {18EC7157-E263-458C-A41C-52E9538A642F} filesys - 8.1 + 10.0 @@ -29,26 +29,26 @@ false Static MultiByte - v140 + v143 DynamicLibrary false Static MultiByte - v140 + v143 DynamicLibrary false MultiByte - v140 + v143 DynamicLibrary false MultiByte - v140 + v143 diff --git a/WincmdViewer/WINCDMDWF.vcxproj b/WincmdViewer/WINCDMDWF.vcxproj index 536ad7d..e793721 100644 --- a/WincmdViewer/WINCDMDWF.vcxproj +++ b/WincmdViewer/WINCDMDWF.vcxproj @@ -22,28 +22,28 @@ WincmdViewer {92F5EB69-069C-43EA-97E7-2F6507AA5873} WINCDMDWF - 8.1 + 10.0 DynamicLibrary false - v140 + v143 DynamicLibrary false - v140 + v143 DynamicLibrary MultiByte - v140 + v143 DynamicLibrary MultiByte - v140 + v143