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);
std::map< OdDbHandle, OdDbHandle > OdDbHandleMap
#define ODA_ASSERT_ONCE(exp)
OdUInt32 decodeBase64(const OdAnsiString &stringToDecode, OdBinaryData &out)
OdString decodeBase64ToOdString(const char *data)
OdUInt32 encodeToBase64(const unsigned char *bytesToEncode, OdUInt32 length, OdAnsiString &sOut, bool inQuotes=false)
static void writeData(OdTf::TypesEnum t, OdTfDwgFilerImpl *m_filer, OdTfDiffFilerImpl *schemeIter, OdString *tableNameFromXml=0)
static void checkCondition(T value, OdTfDwgFilerImpl *schemeIter)
OdDbHandleMap applyDifference(OdDbDatabase *pDb, bool bApplyDiff, bool bPreserveHandles, const char *filePath)
void calculateDifference(OdDbDatabase *pDb, OdStreamBufPtr bufPtr, const char *filePath)
const T * asArrayPtr() const
void resize(size_type logicalLength, const T &value)
void setChangesCalc(ChangesCalculation *pointer)
virtual OdDbDatabase * database() const ODRX_OVERRIDE
OdTfDwgFilerImpl * getImpl()
virtual OdDbObjectId rdSoftOwnershipId()
virtual void wrPoint2d(const OdGePoint2d &value)
virtual OdInt64 rdInt64()
OdTfDiffFilerImpl * m_pFilerXmlData
virtual OdDbObjectId rdHardPointerId()
virtual void wrVector2d(const OdGeVector2d &value)
virtual OdDbDatabase * rdDatabase()
virtual void wrBytes(const void *buffer, OdUInt32 numBytes)
virtual void wrDbHandle(const OdDbHandle &value)
virtual void wrSoftOwnershipId(const OdDbObjectId &value)
virtual void wrHardOwnershipId(const OdDbObjectId &value)
virtual void wrDatabase(OdDbDatabase *pDb)
virtual void wrHardPointerId(const OdDbObjectId &value)
virtual void seek(OdInt64 offset, OdDb::FilerSeekType seekType) ODRX_OVERRIDE
virtual void rdBytes(void *buffer, OdUInt32 numBytes)
virtual OdUInt64 tell() const ODRX_OVERRIDE
virtual void wrScale3d(const OdGeScale3d &value)
virtual OdDbObjectId rdSoftPointerId()
ODRX_DECLARE_MEMBERS(OdTfDwgFiler)
virtual OdInt32 rdInt32()
virtual OdGeScale3d rdScale3d()
virtual void wrInt8(OdInt8 value)
virtual void wrUInt8(OdUInt8 value)
virtual void addReference(OdDbObjectId id, OdDb::ReferenceType rt) ODRX_OVERRIDE
virtual void wrInt32(OdInt32 value)
virtual OdString rdString()
virtual OdUInt8 rdUInt8()
virtual void * rdAddress()
virtual OdDbHandle rdDbHandle()
virtual OdRxClass * rdClass()
virtual void wrClass(const OdRxClass *c)
virtual OdDbObjectId rdHardOwnershipId()
virtual OdGePoint2d rdPoint2d()
virtual void wrInt16(OdInt16 value)
virtual OdGeVector2d rdVector2d()
virtual double rdDouble()
virtual void wrBool(bool value)
virtual void wrSoftPointerId(const OdDbObjectId &value)
virtual OdInt16 rdInt16()
virtual bool usesReferences() const ODRX_OVERRIDE
virtual void wrInt64(OdInt64 value)
virtual OdGeVector3d rdVector3d()
virtual OdGePoint3d rdPoint3d()
virtual void wrAddress(const void *value)
static TiXmlDocument * saveDwgToXml(OdDbDatabase *pDb, const char *pcszXsdFilename, OdDbObjectId idObj)
virtual void wrString(const OdString &value)
virtual bool rdBool() ODRX_OVERRIDE
virtual void wrVector3d(const OdGeVector3d &value)
virtual void wrDouble(double value)
virtual void wrPoint3d(const OdGePoint3d &value)
virtual FilerType filerType() const ODRX_OVERRIDE
GLfloat GLfloat GLfloat z
GLint GLenum GLsizei GLsizei GLint GLsizei const void * data
GLuint const GLchar * name
GLuint GLsizei GLsizei * length
GLsizei const GLfloat * value
TRecordNewObject(OdString name, OdUInt32 pos, size_t num)