#include <string.h>
#include "MemoryWrapperStream.h"
namespace
 
{
	
namespace
 
	{
		
::
(
void
* 
, 
 )
			:buffer((
char
*)
)
			,size(
)
			,position(
0
)
		{
			
if
(
<=
0
)
			{
				
=
0
;
				
=
0
;
			}
		}
		
::
()
		{
		}
		
bool
 ::
()
const
		{
			
return
 !=
0
;
		}
		
bool
 ::
()
const
		{
			
return
 !=
0
;
		}
		
bool
 ::
()
const
		{
			
return
 !=
0
;
		}
		
bool
 ::
()
const
		{
			
return
 !=
0
;
		}
		
bool
 ::
()
const
		{
			
return
 !=
0
;
		}
		
bool
 ::
()
const
		{
			
return
 !=
0
;
		}
		
void
 ::
()
		{
			
=
0
;
			
=-
1
;
			
=-
1
;
		}
		
 ::
()
const
		{
			
return
 ;
		}
		
 ::
()
const
		{
			
return
 ;
		}
		
void
 ::
(
 )
		{
			
(
+
);
		}
		
void
 ::
(
 )
		{
			CHECK_ERROR(buffer!=0, L"MemoryWrapperStream::SeekFromBegin(pos_t)#Stream is closed, cannot perform this operation.");
			do
{
if
(!(
!=
0
))
throw
 (
L"MemoryWrapperStream::SeekFromBegin(pos_t)#Stream is closed, cannot perform this operation."
);}
while
(
0
);
  
			 =(
)
;
			
if
(
expected
<
0
)
			{
				
=
0
;
			}
			
else
 if
(
expected
>=
)
			{
				
=
;
			}
			
else
			{
				
=
expected
;
			}
		}
		
void
 ::
(
 )
		{
			
(
-
);
		}
		
 ::
(
void
* 
, 
 )
		{
			CHECK_ERROR(buffer!=0, L"MemoryWrapperStream::Read(pos_t)#Stream is closed, cannot perform this operation.");
			do
{
if
(!(
!=
0
))
throw
 (
L"MemoryWrapperStream::Read(pos_t)#Stream is closed, cannot perform this operation."
);}
while
(
0
);
  
			CHECK_ERROR(_size>=0, L"MemoryWrapperStream::Read(void*, vint)#Argument size cannot be negative.");
			do
{
if
(!(
>=
0
))
throw
 (
L"MemoryWrapperStream::Read(void*, vint)#Argument size cannot be negative."
);}
while
(
0
);
  
			 =
-
;
			
if
(
>
max
)
			{
				
=
max
;
			}
			
(
, 
+
, 
);
			
+=
;
			
return
 ;
		}
		
 ::
(
void
* 
, 
 )
		{
			CHECK_ERROR(buffer!=0, L"MemoryWrapperStream::Write(pos_t)#Stream is closed, cannot perform this operation.");
			do
{
if
(!(
!=
0
))
throw
 (
L"MemoryWrapperStream::Write(pos_t)#Stream is closed, cannot perform this operation."
);}
while
(
0
);
  
			CHECK_ERROR(_size>=0, L"MemoryWrapperStream::Write(void*, vint)#Argument size cannot be negative.");
			do
{
if
(!(
>=
0
))
throw
 (
L"MemoryWrapperStream::Write(void*, vint)#Argument size cannot be negative."
);}
while
(
0
);
  
			 =
-
;
			
if
(
>
max
)
			{
				
=
max
;
			}
			
(
+
, 
, 
);
			
+=
;
			
return
 ;
		}
		
 ::
(
void
* 
, 
 )
		{
			CHECK_ERROR(buffer!=0, L"MemoryWrapperStream::Peek(pos_t)#Stream is closed, cannot perform this operation.");
			do
{
if
(!(
!=
0
))
throw
 (
L"MemoryWrapperStream::Peek(pos_t)#Stream is closed, cannot perform this operation."
);}
while
(
0
);
  
			CHECK_ERROR(_size>=0, L"MemoryWrapperStream::Peek(void*, vint)#Argument size cannot be negative.");
			do
{
if
(!(
>=
0
))
throw
 (
L"MemoryWrapperStream::Peek(void*, vint)#Argument size cannot be negative."
);}
while
(
0
);
  
			 =
-
;
			
if
(
>
max
)
			{
				
=
max
;
			}
			
(
, 
+
, 
);
			
return
 ;
		}
	}
}