CFx SDK Documentation
2020SP3
|
Go to the documentation of this file.
23 #ifndef _OdTfDwgFiler_h_Included_
24 #define _OdTfDwgFiler_h_Included_
27 #define STL_USING_STACK
28 #define STL_USING_STREAM
33 #include "../../ThirdParty/tinyxml/tinyxml.h"
40 class OdTfDwgFilerImpl;
42 class OdTfDiffFilerImpl;
56 OdTfDwgFilerImpl* m_pImpl;
58 bool m_usesMultiUserEdit;
61 bool m_bPassXmlDataByCondition;
63 TiXmlString m_nameStackCondition;
77 OdTfDwgFilerImpl*
getImpl() {
return m_pImpl;};
177 OdTfDiffFilerImpl *m_pFilerServerData;
178 OdTfDwgFilerImpl *m_filer;
189 void initParts(
const char *filePath);
201 void writeAppendedObjectsToXml();
205 void writeLogMessageToXml();
209 void writeId_StringStreamsToXml();
223 OdInt32 *massDataLengthRevision,
OdInt16 &opCode,
bool &partialUndo );
230 void getLenghtEachRevision(
OdInt32 &countRevision,
OdInt32 *massDataLengthRevision);
256 buf->getBytes(&strLen, 2);
318 OdTfDwgFilerImpl *m_filer;
321 std::map<OdDbHandle, TRecordNewObject> m_mapCreatedObjects;
329 void writePartialUndoData(
OdDbHandle handle,
OdString tableName, TiXmlDocument &schema);
336 void appendedObjectData(OdTfDiffFilerImpl *schemeIter,
OdTf::TypesEnum &t);
347 void init(
OdDbDatabase * pDb, TiXmlDocument &schema, TiXmlDocument &xml, TiXmlElement *pRoot,
bool bApplyDiff,
const char *filePath);
352 void writeInformationData();
370 TiXmlElement* stepBeginOfTable(TiXmlElement *e)
372 while (strcmp(e->Parent()->Value(),
"TeighaDrawing") != 0)
373 e = (TiXmlElement*)e->Parent();
374 return (TiXmlElement*)e;
377 TiXmlElement* stepToLastDiffItemInPrevTable(TiXmlElement *e)
379 if (strcmp(e->Value(),
"handleNotSystemData") == 0)
381 while (strcmp(e->Parent()->Value(),
"TeighaDrawing") != 0)
382 e = (TiXmlElement*)e->Parent();
384 TiXmlElement *n = (TiXmlElement*)e->PreviousSibling()->LastChild();
387 while (n->LastChild())
388 n = (TiXmlElement*)n->LastChild();
389 while (n->NextSiblingElement())
390 n = n->NextSiblingElement();
391 }
while (n->NextSiblingElement() || n->FirstChildElement());
401 OdAnsiString& sOut,
bool inQuotes =
false)
403 static const char* base64Dict =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
406 char* res = sOut.getBuffer(
length * 8 / 6 + 4 + (inQuotes ? 2 : 0));
414 unsigned char charArraySrc[3];
415 unsigned char charArrayFin[4];
418 charArraySrc[i++] = *(bytesToEncode++);
420 charArrayFin[0] = (charArraySrc[0] & 0xfc) >> 2;
421 charArrayFin[1] = ((charArraySrc[0] & 0x03) << 4) + ((charArraySrc[1] & 0xf0) >> 4);
422 charArrayFin[2] = ((charArraySrc[1] & 0x0f) << 2) + ((charArraySrc[2] & 0xc0) >> 6);
423 charArrayFin[3] = charArraySrc[2] & 0x3f;
425 for (i = 0; i < 4; i++)
426 res[finalLen++] = base64Dict[charArrayFin[i]];
433 for (j = i; j < 3; j++)
434 charArraySrc[j] =
'\0';
436 charArrayFin[0] = (charArraySrc[0] & 0xfc) >> 2;
437 charArrayFin[1] = ((charArraySrc[0] & 0x03) << 4) + ((charArraySrc[1] & 0xf0) >> 4);
438 charArrayFin[2] = ((charArraySrc[1] & 0x0f) << 2) + ((charArraySrc[2] & 0xc0) >> 6);
439 charArrayFin[3] = charArraySrc[2] & 0x3f;
441 for (j = 0; j < i + 1; j++)
442 res[finalLen++] = base64Dict[charArrayFin[j]];
445 res[finalLen++] =
'=';
451 res[finalLen] =
'\"';
452 res[finalLen + 1] = 0;
464 static unsigned char* decode64Dict =
NULL;
467 static const char* base64Dict =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
472 decode64Dict[base64Dict[i]] = (
unsigned char)i;
478 const char* pToDecode = stringToDecode.c_str();
481 outLength -= (pToDecode[
length - 2] ==
'=') ? 2 : ((pToDecode[
length - 1] ==
'=') ? 1 : 0);
488 OdUInt32 sextet_a = (pToDecode[i] ==
'=') ? (0 & i++) : decode64Dict[pToDecode[i++]];
489 OdUInt32 sextet_b = (pToDecode[i] ==
'=') ? (0 & i++) : decode64Dict[pToDecode[i++]];
490 OdUInt32 sextet_c = (pToDecode[i] ==
'=') ? (0 & i++) : decode64Dict[pToDecode[i++]];
491 OdUInt32 sextet_d = (pToDecode[i] ==
'=') ? (0 & i++) : decode64Dict[pToDecode[i++]];
493 OdUInt32 triple = (sextet_a << 3 * 6) + (sextet_b << 2 * 6) + (sextet_c << 1 * 6) + (sextet_d << 0 * 6);
496 data[j++] = (triple >> 2 * 8) & 0xFF;
498 data[j++] = (triple >> 1 * 8) & 0xFF;
500 data[j++] = (triple >> 0 * 8) & 0xFF;
507 OdAnsiString ansiStr(
data);
OdString decodeBase64ToOdString(const char *data)
OdTfDwgFilerImpl * getImpl()
virtual void wrHardOwnershipId(const OdDbObjectId &value)
OdTfDiffFilerImpl * m_pFilerXmlData
virtual OdInt16 rdInt16()
GLuint const GLchar * name
virtual void wrPoint3d(const OdGePoint3d &value)
virtual OdGePoint2d rdPoint2d()
OdUInt32 encodeToBase64(const unsigned char *bytesToEncode, OdUInt32 length, OdAnsiString &sOut, bool inQuotes=false)
OdUInt32 decodeBase64(const OdAnsiString &stringToDecode, OdBinaryData &out)
virtual void wrVector2d(const OdGeVector2d &value)
#define ODA_ASSERT_ONCE(exp)
std::map< OdDbHandle, OdDbHandle > OdDbHandleMap
virtual OdDbObjectId rdSoftOwnershipId()
virtual void wrSoftOwnershipId(const OdDbObjectId &value)
virtual void wrString(const OdString &value)
virtual void wrScale3d(const OdGeScale3d &value)
virtual OdUInt64 tell() const ODRX_OVERRIDE
virtual OdDbObjectId rdHardOwnershipId()
static TiXmlDocument * saveDwgToXml(OdDbDatabase *pDb, const char *pcszXsdFilename, OdDbObjectId idObj)
virtual double rdDouble()
virtual void wrDbHandle(const OdDbHandle &value)
static void writeData(OdTf::TypesEnum t, OdTfDwgFilerImpl *m_filer, OdTfDiffFilerImpl *schemeIter, OdString *tableNameFromXml=0)
virtual OdDbDatabase * rdDatabase()
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
virtual OdGePoint3d rdPoint3d()
TRecordNewObject(OdString name, OdUInt32 pos, size_t num)
virtual FilerType filerType() const ODRX_OVERRIDE
const T * asArrayPtr() const
virtual void wrBool(bool value)
virtual void rdBytes(void *buffer, OdUInt32 numBytes)
virtual void wrInt32(OdInt32 value)
virtual void wrInt64(OdInt64 value)
virtual void wrInt16(OdInt16 value)
virtual void wrHardPointerId(const OdDbObjectId &value)
virtual OdInt64 rdInt64()
virtual OdDbObjectId rdSoftPointerId()
void setChangesCalc(ChangesCalculation *pointer)
virtual void wrInt8(OdInt8 value)
virtual void wrDouble(double value)
void resize(size_type logicalLength, const T &value)
virtual OdDbHandle rdDbHandle()
virtual void wrAddress(const void *value)
GLuint GLsizei GLsizei * length
static void checkCondition(T value, OdTfDwgFilerImpl *schemeIter)
virtual OdDbObjectId rdHardPointerId()
virtual OdInt32 rdInt32()
virtual OdRxClass * rdClass()
virtual void wrClass(const OdRxClass *c)
virtual void seek(OdInt64 offset, OdDb::FilerSeekType seekType) ODRX_OVERRIDE
virtual bool usesReferences() const ODRX_OVERRIDE
virtual void wrDatabase(OdDbDatabase *pDb)
virtual OdGeVector3d rdVector3d()
virtual void wrVector3d(const OdGeVector3d &value)
void calculateDifference(OdDbDatabase *pDb, OdStreamBufPtr bufPtr, const char *filePath)
GLsizei const GLfloat * value
virtual void wrPoint2d(const OdGePoint2d &value)
virtual OdString rdString()
ODRX_DECLARE_MEMBERS(OdTfDwgFiler)
virtual void wrSoftPointerId(const OdDbObjectId &value)
virtual void wrUInt8(OdUInt8 value)
virtual OdUInt8 rdUInt8()
virtual OdGeVector2d rdVector2d()
OdDbHandleMap applyDifference(OdDbDatabase *pDb, bool bApplyDiff, bool bPreserveHandles, const char *filePath)
virtual void * rdAddress()
virtual void wrBytes(const void *buffer, OdUInt32 numBytes)
virtual bool rdBool() ODRX_OVERRIDE
GLfloat GLfloat GLfloat z
virtual void addReference(OdDbObjectId id, OdDb::ReferenceType rt) ODRX_OVERRIDE
virtual OdDbDatabase * database() const ODRX_OVERRIDE
virtual OdGeScale3d rdScale3d()