CFx SDK Documentation  2023 SP0
RawByteData.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2017, Open Design Alliance (the "Alliance").
3 // All rights reserved.
4 //
5 // This software and its documentation and related materials are owned by
6 // the Alliance. The software may only be incorporated into application
7 // programs owned by members of the Alliance, subject to a signed
8 // Membership Agreement and Supplemental Software License Agreement with the
9 // Alliance. The structure and organization of this software are the valuable
10 // trade secrets of the Alliance and its suppliers. The software is also
11 // protected by copyright law and international treaty provisions. Application
12 // programs incorporating this software must include the following statement
13 // with their copyright notices:
14 //
15 // This application incorporates Teigha(R) software pursuant to a license
16 // agreement with Open Design Alliance.
17 // Teigha(R) Copyright (C) 2002-2017 by Open Design Alliance.
18 // All rights reserved.
19 //
20 // By use of this software, its documentation or related materials, you
21 // acknowledge and accept the above terms.
23 
24 
25 #ifndef _ODRAWBYTEDATA_INCLUDED_
26 #define _ODRAWBYTEDATA_INCLUDED_
27 
28 #include "TD_PackPush.h"
29 
30 #include "OleStorage.h"
31 
36 class OdRawByteData : public OdByteData
37 {
38  const OdUInt8* m_pData;
39  OdUInt32 m_nDataLeft;
40 protected:
42  : m_pData(0)
43  , m_nDataLeft(0)
44  {
45  }
46 public:
47  void init(const OdUInt8* pData, OdUInt32 length)
48  {
49  m_pData = pData;
50  m_nDataLeft = length;
51  }
52 
54  {
55  return m_nDataLeft;
56  }
57 
58  void read(OdUInt32 nBytes, void* buffer)
59  {
60  if(m_nDataLeft >= nBytes)
61  {
62  m_nDataLeft -= nBytes;
63  ::memcpy(buffer, m_pData, nBytes);
64  m_pData += nBytes;
65  }
66  else
67  throw OdError(eEndOfFile);
68  }
69 };
70 
71 #include "TD_PackPop.h"
72 
73 #endif // _ODRAWBYTEDATA_INCLUDED_
unsigned int OdUInt32
unsigned char OdUInt8
void init(const OdUInt8 *pData, OdUInt32 length)
Definition: RawByteData.h:47
OdUInt32 bytesLeft() const
Definition: RawByteData.h:53
void read(OdUInt32 nBytes, void *buffer)
Definition: RawByteData.h:58
GLuint buffer
Definition: gles2_ext.h:178
GLuint GLsizei GLsizei * length
Definition: gles2_ext.h:274