summaryrefslogtreecommitdiff
path: root/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp')
-rwxr-xr-xutils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp58
1 files changed, 58 insertions, 0 deletions
diff --git a/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp
new file mode 100755
index 0000000000..ae2584edb1
--- /dev/null
+++ b/utils/zenutils/libraries/pelib-0.9/pelib/buffer/InputBuffer.cpp
@@ -0,0 +1,58 @@
1/*
2* InputBuffer.cpp - 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#include "InputBuffer.h"
14
15namespace PeLib
16{
17 unsigned long InputBuffer::get()
18 {
19 return ulIndex;
20 }
21
22 InputBuffer::InputBuffer(std::vector<unsigned char>& vBuffer) : m_vBuffer(vBuffer), ulIndex(0)
23 {
24 }
25
26 const unsigned char* InputBuffer::data() const
27 {
28 return &m_vBuffer[0];
29 }
30
31 unsigned long InputBuffer::size()
32 {
33 return static_cast<unsigned long>(m_vBuffer.size());
34 }
35
36 void InputBuffer::read(char* lpBuffer, unsigned long ulSize)
37 {
38 std::copy(&m_vBuffer[ulIndex], &m_vBuffer[ulIndex + ulSize], lpBuffer);
39 ulIndex += ulSize;
40 }
41
42 void InputBuffer::reset()
43 {
44 m_vBuffer.clear();
45 }
46
47 void InputBuffer::set(unsigned long ulIndex)
48 {
49 this->ulIndex = ulIndex;
50 }
51
52 void InputBuffer::setBuffer(std::vector<unsigned char>& vBuffer)
53 {
54 m_vBuffer = vBuffer;
55 ulIndex = 0;
56 }
57}
58