danicoin/src/Common/StringInputStream.cpp
2016-01-18 15:33:29 +00:00

24 lines
567 B
C++
Executable file

// Copyright (c) 2011-2016 The Cryptonote developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "StringInputStream.h"
#include <string.h>
namespace Common {
StringInputStream::StringInputStream(const std::string& in) : in(in), offset(0) {
}
size_t StringInputStream::readSome(void* data, size_t size) {
if (size > in.size() - offset) {
size = in.size() - offset;
}
memcpy(data, in.data() + offset, size);
offset += size;
return size;
}
}