Start support for multiple build targets.
This commit is contained in:
parent
e3e03dc31f
commit
3dce256213
52 changed files with 1044 additions and 340 deletions
41
src/base/core/streams/IOStream.h
Normal file
41
src/base/core/streams/IOStream.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
|
||||
#include "Vector.h"
|
||||
#include "Stream.h"
|
||||
|
||||
template<typename T>
|
||||
class InputStream : public Stream
|
||||
{
|
||||
public:
|
||||
virtual bool get(T& item) = 0;
|
||||
|
||||
virtual int get(Vector<T>& items)
|
||||
{
|
||||
size_t count = 0;
|
||||
T item;
|
||||
while(good() && count < items.size())
|
||||
{
|
||||
if (const auto ok = get(item); !ok)
|
||||
{
|
||||
break;
|
||||
}
|
||||
items[count] = item;
|
||||
count++;
|
||||
}
|
||||
if (has_error())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return count;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class OutputStream : public Stream
|
||||
{
|
||||
public:
|
||||
virtual int write(T* data, size_t size) = 0;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue