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