/////////////////////////////////////////////////////////////////////////////// // Copyright (C) 2002-2025, Open Design Alliance (the "Alliance"). // All rights reserved. // // This software and its documentation and related materials are owned by // the Alliance. The software may only be incorporated into application // programs owned by members of the Alliance, subject to a signed // Membership Agreement and Supplemental Software License Agreement with the // Alliance. The structure and organization of this software are the valuable // trade secrets of the Alliance and its suppliers. The software is also // protected by copyright law and international treaty provisions. Application // programs incorporating this software must include the following statement // with their copyright notices: // // This application incorporates Open Design Alliance software pursuant to a license // agreement with Open Design Alliance. // Open Design Alliance Copyright (C) 2002-2025 by Open Design Alliance. // All rights reserved. // // By use of this software, its documentation or related materials, you // acknowledge and accept the above terms. /////////////////////////////////////////////////////////////////////////////// // Base implementation of JsonServer interface for GLES2 Json device #ifndef ODGLES2JSONSERVERBASEIMPL #define ODGLES2JSONSERVERBASEIMPL #include "TD_PackPush.h" #include "JsonServer.h" #include "Tr/TrVisUniqueId.h" class OdDbBaseDatabasePE; /** \details */ class OdGLES2JsonServerBaseImpl : public OdGLES2JsonServer, protected OdTrVisUniqueID::DefUIDTransformer { protected: int m_nIdent; OdDbBaseDatabasePE* m_pDbPE; bool m_bClientDependentSectionOnly; OdBool m_bEmptyMetaFile; OdBool m_bEnableFaces; OdAnsiString m_sTmpBuf; // for sprintf or format on one level upper indent char* m_pszTmpBuf; int m_lenTmpBuf; # if defined(odSprintfA) # define ODFMTBEG(len) \ { \ { \ m_pszTmpBuf = m_sTmpBuf.getBuffer(m_lenTmpBuf = (int)len + 1); \ odSprintfA(m_pszTmpBuf, m_lenTmpBuf, # define ODFMTADD() \ ); \ } \ } \ { \ { \ odSprintfA(m_pszTmpBuf += odStrLenA(m_pszTmpBuf), m_lenTmpBuf, # define ODFMTFORBEGEX(len, expr) \ { \ m_pszTmpBuf = m_sTmpBuf.getBuffer(m_lenTmpBuf = len * nData + 1); \ for (OdUInt32 index = 0; index < nData; index++, m_pszTmpBuf += odStrLenA(m_pszTmpBuf)) \ { \ expr; \ odSprintfA(m_pszTmpBuf, m_lenTmpBuf, # else # define ODFMTBEG(len) \ { \ { \ m_sTmpBuf.format( # define ODFMTADD() \ ); \ } \ } { \ { \ m_sTmpBuf += OdAnsiString().format( # define ODFMTFORBEGEX(len, expr) \ { \ m_sTmpBuf.empty(); \ for (OdUInt32 index = 0; index < nData; index++) \ { \ expr; \ m_sTmpBuf += OdAnsiString().format( # endif # define ODFMTFORBEG(len) ODFMTFORBEGEX(len,) # define ODFMTEND() \ ); \ } \ } # define ODFLTFMT(cstrpref, val, cstrsfx) \ ((val >= 0.0f ? val : - val) >= 0.1f && (val >= 0.0f ? val : - val) < 1e+16) ? cstrpref "%f" cstrsfx : cstrpref "%g" cstrsfx public: OdGLES2JsonServerBaseImpl(const OdDbBaseDatabase* pDb = NULL); void setClientDependentSectionOnlyFlag(bool bSet) { m_bClientDependentSectionOnly = bSet; } void setDatabase(const OdDbBaseDatabase* pDb = NULL); void setEnableFaces(OdBool enable) { m_bEnableFaces = enable; } OdBool isEnableFaces() const override { return m_bEnableFaces; } void append(OdAnsiString& to, OdDbStub* from) const override; // should be overrode for JSON virtual void ident(const char* pTag, const char* pText, const OdGLES2JsonServer::JsonType &) = 0; void IncreaseNesting(const char* pLevelName, const OdGLES2JsonServer::JsonType& JsonType) ODRX_OVERRIDE; void DecreaseNesting(const char* pLevelName, const OdGLES2JsonServer::JsonType& JsonType) ODRX_OVERRIDE; void DropId(const char* pTagName, OdUInt64 data, OdTrVisUniqueID* pId, OdInt32 enAdv) ODRX_OVERRIDE; void DropBoolean(const char* pTagName, bool data) ODRX_OVERRIDE; void DropUInt8(const char* pTagName, OdUInt8 data) ODRX_OVERRIDE; void DropUInt32(const char* pTagName, OdUInt32 data) ODRX_OVERRIDE; void DropUInt64(const char* pTagName, OdUInt64 data) ODRX_OVERRIDE; void DropInt32(const char* pTagName, OdInt32 data) ODRX_OVERRIDE; void DropChars(const char* pTagName, const char* pStr) ODRX_OVERRIDE; void DropString(const char* pTagName, const OdString& pStr) ODRX_OVERRIDE; void DropInts(const char* pTagName, OdUInt32 nData, const OdUInt16* pData) ODRX_OVERRIDE; void DropUInts(const char* pTagName, OdUInt32 nData, const OdUInt32* pData) ODRX_OVERRIDE; void DropFloats(const char* pTagName, OdUInt32 nData, const float* pData) ODRX_OVERRIDE; void DropFloat(const char* pTagName, float data) ODRX_OVERRIDE; void DropFloat2(const char* pTagName, float data1, float data2) ODRX_OVERRIDE; void DropFloat3(const char* pTagName, float data1, float data2, float data3) ODRX_OVERRIDE; void DropFloat4(const char* pTagName, float data1, float data2, float data3, float data4) ODRX_OVERRIDE; void DropUInt8RGB(const char* pTagName, OdUInt8 data1, OdUInt8 data2, OdUInt8 data3, OdUInt8 data4) ODRX_OVERRIDE; void DropMatrix(const char* pTagName, const OdGeMatrix3d& data) ODRX_OVERRIDE; void DropBinaryStream(const char* pTagName, const OdUInt8* pData, OdUInt32 nData) ODRX_OVERRIDE; void DropDbOwning(const char* pTagName, OdTrVisOwning owningId) ODRX_OVERRIDE; bool UpdateClientDependentSectionOnly() const ODRX_OVERRIDE; }; #include "TD_PackPop.h" #endif // ODGLES2JSONSERVERBASEIMPL