summaryrefslogtreecommitdiff
path: root/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h
diff options
context:
space:
mode:
Diffstat (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h')
-rwxr-xr-xutils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h
new file mode 100755
index 0000000000..fc5a14e357
--- /dev/null
+++ b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.h
@@ -0,0 +1,52 @@
1/*
2* InputBuffer.h - Part of the PeLib library.
3*
4* Copyright (c) 2004 - 2005 Sebastian Porst (webmaster@the-interweb.com)
5* All rights reserved.
6*
7* This software is licensed under the zlib/libpng License.
8* For more details see http://www.opensource.org/licenses/zlib-license.php
9* or the license information file (license.htm) in the root directory
10* of PeLib.
11*/
12
13#ifndef INPUTBUFFER_H
14#define INPUTBUFFER_H
15
16#include <vector>
17#include <iterator>
18#include <cassert>
19
20namespace PeLib
21{
22 class InputBuffer
23 {
24 private:
25 std::vector<unsigned char>& m_vBuffer;
26 unsigned long ulIndex;
27
28 public:
29 InputBuffer(std::vector<unsigned char>& vBuffer);
30
31 const unsigned char* data() const;
32 unsigned long size();
33
34 template<typename T>
35 InputBuffer& operator>>(T& value)
36 {
37 assert(ulIndex + sizeof(value) <= m_vBuffer.size());
38 value = *(T*)(&m_vBuffer[ulIndex]);//reinterpret_cast<T*>(&m_vBuffer[ulIndex]);
39 ulIndex += sizeof(T);
40 return *this;
41 }
42
43 void read(char* lpBuffer, unsigned long ulSize);
44 void reset();
45 void set(unsigned long ulIndex);
46 unsigned long get();
47 void setBuffer(std::vector<unsigned char>& vBuffer);
48// void updateData(unsigned long ulIndex,
49 };
50}
51
52#endif