Commit 36664272 authored by Julien Malik's avatar Julien Malik

COMP: fix compilation of ossim on MacOSX 10.9 with latest XCode

parent de239598
......@@ -19,7 +19,7 @@
// ossimOFStream
//
//*******************************************************************
// $Id: ossimIoStream.h 11176 2007-06-07 19:45:56Z dburken $
// $Id: ossimIoStream.h 22475 2013-11-07 13:28:51Z gpotts $
#ifndef ossimIoStream_HEADER
#define ossimIoStream_HEADER
......@@ -31,27 +31,28 @@
#include <ossim/base/ossimString.h>
class OSSIM_DLL ossimIStream : public ossimStreamBase, public std::istream
class OSSIM_DLL ossimIStream : public ossimStreamBase, public std::basic_istream<char>
{
public:
ossimIStream();
//ossimIStream();
ossimIStream(std::streambuf* sb);
virtual ~ossimIStream();
};
class OSSIM_DLL ossimOStream : public ossimStreamBase, public std::ostream
class OSSIM_DLL ossimOStream : public ossimStreamBase, public std::basic_ostream<char>
{
public:
ossimOStream();
//ossimOStream();
ossimOStream(std::streambuf* sb);
virtual ~ossimOStream();
};
class OSSIM_DLL ossimIOStream : public ossimStreamBase, public std::iostream
class OSSIM_DLL ossimIOStream : public ossimStreamBase, public std::basic_iostream<char>
{
public:
ossimIOStream();
//ossimIOStream();
ossimIOStream(std::streambuf* sb);
virtual ~ossimIOStream();
};
......@@ -126,7 +127,7 @@ protected:
std::stringbuf theBuf;
};
class OSSIM_DLL ossimIOFStream : public ossimStreamBase, public std::fstream
class OSSIM_DLL ossimIOFStream : public ossimStreamBase, public std::basic_fstream<char>
{
public:
ossimIOFStream();
......@@ -138,7 +139,7 @@ public:
virtual ~ossimIOFStream();
};
class OSSIM_DLL ossimIFStream : public ossimStreamBase, public std::ifstream
class OSSIM_DLL ossimIFStream : public ossimStreamBase, public std::basic_ifstream<char>
{
public:
ossimIFStream();
......@@ -150,7 +151,7 @@ public:
};
class OSSIM_DLL ossimOFStream : public ossimStreamBase, public std::ofstream
class OSSIM_DLL ossimOFStream : public ossimStreamBase, public std::basic_ofstream<char>
{
public:
ossimOFStream();
......@@ -163,6 +164,65 @@ public:
};
#ifdef _MSC_VER
class ossimIFStream64 : public std::basic_ifstream<char>
{
public:
ossimIFStream64(const char* pFilename,
std::ios_base::openmode mode = ios_base::in,
int prot = ios_base::_Openprot);
virtual ~ossimIFStream64();
void seekg64(off_type off, ios_base::seekdir way);
void seekg64(streampos pos, ios_base::seekdir way);
static void seekg64(std::istream& str, off_type off, ios_base::seekdir way);
static void seekg64(std::istream& str, std::streampos pos, ios_base::seekdir way);
private:
FILE* theFile;
};
class ossimOFStream64 : public std::basic_ofstream<char>
{
public:
ossimOFStream64(const char* pFilename,
std::ios_base::openmode mode = ios_base::out,
int prot = ios_base::_Openprot);
virtual ~ossimOFStream64();
ossim_uint64 tellp64();
};
#else
class ossimIFStream64 : public std::basic_ifstream<char>
{
public:
ossimIFStream64(const char* pFilename, std::ios_base::openmode mode = ios_base::in, long prot = 0666);
virtual ~ossimIFStream64();
void seekg64(off_type off, ios_base::seekdir way);
static void seekg64(std::istream& str, off_type off, ios_base::seekdir way);
};
class ossimOFStream64 : public std::basic_ofstream<char>
{
public:
ossimOFStream64(const char* pFilename, std::ios_base::openmode mode = ios_base::out, long prot = 0666);
virtual ~ossimOFStream64();
ossim_uint64 tellp64();
};
#endif // _MSC_VER
OSSIM_DLL void operator >> (ossimIStream& in,ossimOStream& out);
OSSIM_DLL ossimIOStream& operator >> (ossimIStream& in,ossimIOStream& out);
OSSIM_DLL void operator >> (ossimIOStream& in,ossimOStream& out);
......
......@@ -19,26 +19,27 @@
// ossimOFStream
//
//*******************************************************************
// $Id: ossimIoStream.cpp 11206 2007-06-13 13:11:35Z gpotts $
// $Id: ossimIoStream.cpp 22477 2013-11-07 17:54:49Z gpotts $
#include <ossim/base/ossimIoStream.h>
/*
ossimIStream::ossimIStream()
: ossimStreamBase(),
#ifdef _MSC_VER
#if defined(_MSC_VER)
std::istream((std::_Uninitialized)0)
#else
std::istream()
#endif
{}
*/
ossimIStream::ossimIStream(std::streambuf* sb)
: ossimStreamBase(),
std::istream(sb)
std::basic_istream<char>(sb)
{}
ossimIStream::~ossimIStream()
{}
/*
ossimOStream::ossimOStream()
: ossimStreamBase(),
#ifdef _MSC_VER
......@@ -47,15 +48,21 @@ ossimOStream::ossimOStream()
std::ostream()
#endif
{}
*/
ossimOStream::ossimOStream(std::streambuf* sb)
: ossimStreamBase(),
std::ostream(sb)
std::basic_ostream<char>(sb)
{}
ossimOStream::~ossimOStream()
{}
ossimIOStream::ossimIOStream(std::streambuf* sb)
:std::basic_iostream<char>(sb)
{
}
/*
ossimIOStream::ossimIOStream()
: ossimStreamBase(),
#ifdef _MSC_VER
......@@ -64,12 +71,12 @@ ossimIOStream::ossimIOStream()
std::iostream()
#endif
{}
*/
ossimIOStream::~ossimIOStream()
{}
ossimIOMemoryStream::ossimIOMemoryStream()
: ossimIOStream(),
: ossimIOStream(&theBuf),
theBuf(std::ios::in|std::ios::out)
{
ossimIOStream::init(&theBuf);
......@@ -110,7 +117,7 @@ ossim_uint64 ossimIOMemoryStream::size()const
ossimIMemoryStream::ossimIMemoryStream(const ossimString& inputBuf)
: ossimIStream(),
: ossimIStream(&theBuf),
theBuf(inputBuf.c_str(), std::ios::in)
{
ossimIStream::init(&theBuf);
......@@ -149,7 +156,7 @@ ossimString ossimIMemoryStream::str()
}
ossimOMemoryStream::ossimOMemoryStream()
: ossimOStream(),
: ossimOStream(&theBuf),
theBuf(std::ios::out)
{
ossimOStream::init(&theBuf);
......@@ -206,12 +213,12 @@ ossimIOFStream::~ossimIOFStream()
ossimIFStream::ossimIFStream()
: ossimStreamBase(),
std::ifstream()
std::basic_ifstream<char>()
{
}
ossimIFStream::ossimIFStream(const char* file, std::ios_base::openmode mode)
: ossimStreamBase(),
std::ifstream(file, mode)
std::basic_ifstream<char>(file, mode)
{
}
......@@ -221,19 +228,147 @@ ossimIFStream::~ossimIFStream()
ossimOFStream::ossimOFStream()
: ossimStreamBase(),
std::ofstream()
std::basic_ofstream<char>()
{
}
ossimOFStream::ossimOFStream(const char* name, std::ios_base::openmode mode)
: ossimStreamBase(),
std::ofstream(name, mode)
std::basic_ofstream<char>(name, mode)
{
}
ossimOFStream::~ossimOFStream()
{
}
#ifdef _MSC_VER
ossimIFStream64::ossimIFStream64(const char* pFilename, std::ios_base::openmode mode, int prot) :
std::basic_ifstream<char>(theFile = std::_Fiopen(pFilename, mode, prot))
{
}
ossimIFStream64::~ossimIFStream64()
{
if(is_open())
{
close();
}
}
void ossimIFStream64::seekg64(off_type off, ios_base::seekdir way)
{
_fseeki64(theFile, off, way);
}
void ossimIFStream64::seekg64(streampos pos, ios_base::seekdir way)
{
// Undo the potentially bad typecast done by _FPOSOFF when fpos is > max long
const off_type off(pos);
const fpos_t fpos = pos.seekpos();
seekg64(off - _FPOSOFF(fpos) + fpos, way);
}
void ossimIFStream64::seekg64(std::istream& str, off_type off,
ios_base::seekdir way)
{
ossimIFStream64* pStream = dynamic_cast<ossimIFStream64*>(&str);
if (pStream != NULL)
{
pStream->seekg64(off, way);
}
else
{
str.seekg(off, way);
}
}
void ossimIFStream64::seekg64(std::istream& str,
std::streampos pos,
ios_base::seekdir way)
{
ossimIFStream64* pStream = dynamic_cast<ossimIFStream64*>(&str);
if (pStream != NULL)
{
pStream->seekg64(pos, way);
}
else
{
str.seekg(pos, way);
}
}
ossimOFStream64::ossimOFStream64(const char* pFilename,
std::ios_base::openmode mode,
int prot) :
std::basic_ofstream<char>(pFilename, mode, prot)
{
}
ossimOFStream64::~ossimOFStream64()
{
if(is_open())
{
close();
}
}
ossim_uint64 ossimOFStream64::tellp64()
{
// Undo the potentially bad typecast done by _FPOSOFF when fpos is > max long
const pos_type pos = tellp();
const off_type off(pos);
const fpos_t fpos = pos.seekpos();
return off - _FPOSOFF(fpos) + fpos;
}
#else
ossimIFStream64::ossimIFStream64(const char* pFilename,
std::ios_base::openmode mode, long prot) :
std::basic_ifstream<char>(pFilename, mode)
{
}
ossimIFStream64::~ossimIFStream64()
{
if(is_open())
{
close();
}
}
void ossimIFStream64::seekg64(off_type off, ios_base::seekdir way)
{
std::basic_ifstream<char>::seekg(off, way);
}
void ossimIFStream64::seekg64(std::istream& str,
off_type off, ios_base::seekdir way)
{
str.seekg(off, way);
}
ossimOFStream64::ossimOFStream64(const char* pFilename,
std::ios_base::openmode mode, long prot) :
std::basic_ofstream<char>(pFilename, mode)
{
}
ossimOFStream64::~ossimOFStream64()
{
if(is_open())
{
close();
}
}
ossim_uint64 ossimOFStream64::tellp64()
{
return tellp();
}
#endif // _MSC_VER
void operator >> (ossimIStream& in,ossimOStream& out)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment