This makes it possible to explicitly set the mode for a Memory, and in
particular to create a write-only Memory. ZlibCompressed does not work
with M_RDWR so writing compressed data to memory was impossible before
this commit.
namespace Msp {
namespace IO {
namespace Msp {
namespace IO {
-Memory::Memory(char *d, unsigned s)
+Memory::Memory(char *d, unsigned s, Mode m)
-Memory::Memory(char *b, char *e)
+Memory::Memory(char *b, char *e, Mode m)
}
Memory::Memory(const char *cd, unsigned s)
}
Memory::Memory(const char *cd, unsigned s)
unsigned Memory::do_read(char *buf, unsigned size)
{
unsigned Memory::do_read(char *buf, unsigned size)
{
+ check_access(M_READ);
+
if(pos==end)
{
set_eof();
if(pos==end)
{
set_eof();
bool Memory::getline(string &line)
{
bool Memory::getline(string &line)
{
+ check_access(M_READ);
+
if(pos==end)
{
set_eof();
if(pos==end)
{
set_eof();
+ check_access(M_READ);
+
if(pos==end)
{
set_eof();
if(pos==end)
{
set_eof();
- Memory(char *, unsigned);
- Memory(char *, char *);
+ Memory(char *, unsigned, Mode = M_RDWR);
+ Memory(char *, char *, Mode = M_RDWR);
Memory(const char *, unsigned);
Memory(const char *, const char *);
private:
Memory(const char *, unsigned);
Memory(const char *, const char *);
private: