зеркало из https://github.com/mozilla/pjs.git
And again.
This commit is contained in:
Родитель
733aa2a69d
Коммит
dd79f3130c
|
@ -92,6 +92,8 @@
|
||||||
#define NS_NAMESPACE namespace
|
#define NS_NAMESPACE namespace
|
||||||
#define NS_NAMESPACE_END
|
#define NS_NAMESPACE_END
|
||||||
#define BASIC_STREAMBUF basic_streambuf
|
#define BASIC_STREAMBUF basic_streambuf
|
||||||
|
#define IOS_BASE ios_base
|
||||||
|
|
||||||
#include <istream>
|
#include <istream>
|
||||||
using std::ios_base;
|
using std::ios_base;
|
||||||
using std::basic_streambuf;
|
using std::basic_streambuf;
|
||||||
|
@ -103,13 +105,18 @@
|
||||||
using std::basic_ostream;
|
using std::basic_ostream;
|
||||||
using std::basic_iostream;
|
using std::basic_iostream;
|
||||||
using std::char_traits;
|
using std::char_traits;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <istream.h>
|
|
||||||
#define NS_NAMESPACE_PROTOTYPE static
|
#define NS_NAMESPACE_PROTOTYPE static
|
||||||
#define NS_NAMESPACE struct
|
#define NS_NAMESPACE struct
|
||||||
#define NS_NAMESPACE_END ;
|
#define NS_NAMESPACE_END ;
|
||||||
#define BASIC_STREAMBUF streambuf
|
#define BASIC_STREAMBUF streambuf
|
||||||
#endif
|
#define IOS_BASE ios
|
||||||
|
|
||||||
|
#include <istream.h>
|
||||||
|
|
||||||
|
#endif // NS_USING_NAMESPACE
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
|
|
||||||
|
@ -128,7 +135,8 @@
|
||||||
#define NS_READ_LOCK(mut)
|
#define NS_READ_LOCK(mut)
|
||||||
#define NS_WRITE_LOCK(mut)
|
#define NS_WRITE_LOCK(mut)
|
||||||
|
|
||||||
#endif //==================== End Compiler-specific macros ===============================
|
#endif // __MWERKS__
|
||||||
|
//=========================== End Compiler-specific macros ===============================
|
||||||
|
|
||||||
//========================================================================================
|
//========================================================================================
|
||||||
NS_NAMESPACE nsFileStreamHelpers
|
NS_NAMESPACE nsFileStreamHelpers
|
||||||
|
@ -138,7 +146,7 @@ NS_NAMESPACE nsFileStreamHelpers
|
||||||
{
|
{
|
||||||
NS_NAMESPACE_PROTOTYPE PRFileDesc* open(
|
NS_NAMESPACE_PROTOTYPE PRFileDesc* open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode);
|
PRIntn accessMode);
|
||||||
} NS_NAMESPACE_END // nsFileStreamHelpers
|
} NS_NAMESPACE_END // nsFileStreamHelpers
|
||||||
|
|
||||||
|
@ -172,7 +180,7 @@ public:
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
filebuf_type* open(
|
filebuf_type* open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode);
|
PRIntn accessMode);
|
||||||
filebuf_type* close();
|
filebuf_type* close();
|
||||||
|
|
||||||
|
@ -181,10 +189,10 @@ protected:
|
||||||
virtual int_type pbackfail(int_type c=traits::eof());
|
virtual int_type pbackfail(int_type c=traits::eof());
|
||||||
virtual int_type underflow();
|
virtual int_type underflow();
|
||||||
virtual pos_type seekoff(
|
virtual pos_type seekoff(
|
||||||
off_type off, ios::seekdir way,
|
off_type off, IOS_BASE::seekdir way,
|
||||||
ios::openmode which=ios::in|ios::out);
|
IOS_BASE::openmode which=IOS_BASE::in|IOS_BASE::out);
|
||||||
virtual pos_type seekpos(pos_type sp,
|
virtual pos_type seekpos(pos_type sp,
|
||||||
ios::openmode which=ios::in|ios::out);
|
IOS_BASE::openmode which=IOS_BASE::in|IOS_BASE::out);
|
||||||
virtual BASIC_STREAMBUF<charT, traits>* setbuf(char_type* s, streamsize n);
|
virtual BASIC_STREAMBUF<charT, traits>* setbuf(char_type* s, streamsize n);
|
||||||
virtual int sync();
|
virtual int sync();
|
||||||
virtual int_type uflow();
|
virtual int_type uflow();
|
||||||
|
@ -195,7 +203,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PRFileDesc* mFileDesc;
|
PRFileDesc* mFileDesc;
|
||||||
ios::openmode mode_;
|
IOS_BASE::openmode mode_;
|
||||||
}; // class nsFileBufferT
|
}; // class nsFileBufferT
|
||||||
|
|
||||||
//========================================================================================
|
//========================================================================================
|
||||||
|
@ -216,7 +224,7 @@ public:
|
||||||
nsInputFileStreamT();
|
nsInputFileStreamT();
|
||||||
explicit nsInputFileStreamT(
|
explicit nsInputFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode=ios::in,
|
IOS_BASE::openmode mode=IOS_BASE::in,
|
||||||
PRIntn accessMode = 0x00400);
|
PRIntn accessMode = 0x00400);
|
||||||
|
|
||||||
virtual ~nsInputFileStreamT();
|
virtual ~nsInputFileStreamT();
|
||||||
|
@ -225,7 +233,7 @@ public:
|
||||||
inline bool is_open();
|
inline bool is_open();
|
||||||
inline void open(
|
inline void open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode=ios::in,
|
IOS_BASE::openmode mode=IOS_BASE::in,
|
||||||
PRIntn accessMode = 0x00400);
|
PRIntn accessMode = 0x00400);
|
||||||
inline void close();
|
inline void close();
|
||||||
|
|
||||||
|
@ -251,7 +259,7 @@ public:
|
||||||
nsOutputFileStreamT();
|
nsOutputFileStreamT();
|
||||||
explicit nsOutputFileStreamT(
|
explicit nsOutputFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode = ios::out|ios::trunc,
|
IOS_BASE::openmode mode = IOS_BASE::out|IOS_BASE::trunc,
|
||||||
PRIntn accessMode = 0x00200);
|
PRIntn accessMode = 0x00200);
|
||||||
|
|
||||||
virtual ~nsOutputFileStreamT();
|
virtual ~nsOutputFileStreamT();
|
||||||
|
@ -260,7 +268,7 @@ public:
|
||||||
inline bool is_open();
|
inline bool is_open();
|
||||||
inline void open(
|
inline void open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode = ios::out|ios::trunc,
|
IOS_BASE::openmode mode = IOS_BASE::out|IOS_BASE::trunc,
|
||||||
PRIntn accessMode = 0x00200);
|
PRIntn accessMode = 0x00200);
|
||||||
inline void close();
|
inline void close();
|
||||||
|
|
||||||
|
@ -310,7 +318,7 @@ nsFileBufferT<charT, traits>::is_open() const
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
nsFileBufferT<charT, traits>* nsFileBufferT<charT, traits>::open(
|
nsFileBufferT<charT, traits>* nsFileBufferT<charT, traits>::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
@ -501,18 +509,18 @@ nsFileBufferT<charT, traits>::showmanyc()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
nsFileBufferT<charT, traits>::pos_type nsFileBufferT<charT, traits>::seekoff(
|
nsFileBufferT<charT, traits>::pos_type nsFileBufferT<charT, traits>::seekoff(
|
||||||
off_type off,
|
off_type off,
|
||||||
ios::seekdir way,
|
IOS_BASE::seekdir way,
|
||||||
ios::openmode /* which */)
|
IOS_BASE::openmode /* which */)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
if (!mFileDesc || ((way&ios::beg) && off<0) || ((way&ios::end) && off > 0))
|
if (!mFileDesc || ((way&IOS_BASE::beg) && off<0) || ((way&IOS_BASE::end) && off > 0))
|
||||||
return pos_type(-1);
|
return pos_type(-1);
|
||||||
PRSeekWhence poseek = PR_SEEK_CUR;
|
PRSeekWhence poseek = PR_SEEK_CUR;
|
||||||
switch (way)
|
switch (way)
|
||||||
{
|
{
|
||||||
case ios::beg : poseek= PR_SEEK_SET;
|
case IOS_BASE::beg : poseek= PR_SEEK_SET;
|
||||||
break;
|
break;
|
||||||
case ios::end : poseek= PR_SEEK_END;
|
case IOS_BASE::end : poseek= PR_SEEK_END;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PRInt32 position = PR_Seek(mFileDesc, off, poseek);
|
PRInt32 position = PR_Seek(mFileDesc, off, poseek);
|
||||||
|
@ -524,7 +532,7 @@ nsFileBufferT<charT, traits>::pos_type nsFileBufferT<charT, traits>::seekoff(
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
nsFileBufferT<charT, traits>::pos_type
|
nsFileBufferT<charT, traits>::pos_type
|
||||||
nsFileBufferT<charT, traits>::seekpos(pos_type sp, ios::openmode)
|
nsFileBufferT<charT, traits>::seekpos(pos_type sp, IOS_BASE::openmode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
if (!mFileDesc || sp==pos_type(-1))
|
if (!mFileDesc || sp==pos_type(-1))
|
||||||
|
@ -552,7 +560,7 @@ inline nsInputFileStreamT<charT, traits>::nsInputFileStreamT()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
inline nsInputFileStreamT<charT, traits>::nsInputFileStreamT(
|
inline nsInputFileStreamT<charT, traits>::nsInputFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
: basic_istream<charT, traits>(&mBuffer)
|
: basic_istream<charT, traits>(&mBuffer)
|
||||||
|
@ -592,7 +600,7 @@ template<class charT, class traits>
|
||||||
inline void
|
inline void
|
||||||
nsInputFileStreamT<charT, traits>::open(
|
nsInputFileStreamT<charT, traits>::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
@ -626,7 +634,7 @@ inline nsOutputFileStreamT<charT, traits>::nsOutputFileStreamT()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
nsOutputFileStreamT<charT, traits>::nsOutputFileStreamT(
|
nsOutputFileStreamT<charT, traits>::nsOutputFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
: basic_ostream<charT, traits>(&mBuffer)
|
: basic_ostream<charT, traits>(&mBuffer)
|
||||||
|
@ -664,7 +672,7 @@ inline bool nsOutputFileStreamT<charT, traits>:: is_open()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
inline void nsOutputFileStreamT<charT, traits>::open(
|
inline void nsOutputFileStreamT<charT, traits>::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
@ -698,7 +706,7 @@ public:
|
||||||
nsIOFileStreamT();
|
nsIOFileStreamT();
|
||||||
explicit nsIOFileStreamT(
|
explicit nsIOFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode = ios::in|ios::out,
|
IOS_BASE::openmode mode = IOS_BASE::in|IOS_BASE::out,
|
||||||
PRIntn accessMode = 0x00600);
|
PRIntn accessMode = 0x00600);
|
||||||
|
|
||||||
virtual ~nsIOFileStreamT();
|
virtual ~nsIOFileStreamT();
|
||||||
|
@ -707,7 +715,7 @@ public:
|
||||||
inline bool is_open();
|
inline bool is_open();
|
||||||
inline void open(
|
inline void open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode = ios::in|ios::out,
|
IOS_BASE::openmode mode = IOS_BASE::in|IOS_BASE::out,
|
||||||
PRIntn accessMode = 0x00600);
|
PRIntn accessMode = 0x00600);
|
||||||
inline void close();
|
inline void close();
|
||||||
|
|
||||||
|
@ -732,7 +740,7 @@ inline nsIOFileStreamT<charT, traits>::nsIOFileStreamT()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
inline nsIOFileStreamT<charT, traits>::nsIOFileStreamT(
|
inline nsIOFileStreamT<charT, traits>::nsIOFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
: mBuffer(), basic_iostream<charT, traits>(&mBuffer)
|
: mBuffer(), basic_iostream<charT, traits>(&mBuffer)
|
||||||
|
@ -770,7 +778,7 @@ template<class charT, class traits>
|
||||||
inline void
|
inline void
|
||||||
nsIOFileStreamT<charT, traits>::open(
|
nsIOFileStreamT<charT, traits>::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,25 +29,25 @@
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
PRFileDesc* nsFileStreamHelpers::open(
|
PRFileDesc* nsFileStreamHelpers::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
PRFileDesc* descriptor = 0;
|
PRFileDesc* descriptor = 0;
|
||||||
const ios::openmode valid_modes[]=
|
const IOS_BASE::openmode valid_modes[]=
|
||||||
{
|
{
|
||||||
ios::out,
|
IOS_BASE::out,
|
||||||
ios::out | ios::app,
|
IOS_BASE::out | IOS_BASE::app,
|
||||||
ios::out | ios::trunc,
|
IOS_BASE::out | IOS_BASE::trunc,
|
||||||
ios::in,
|
IOS_BASE::in,
|
||||||
ios::in | ios::out,
|
IOS_BASE::in | IOS_BASE::out,
|
||||||
ios::in | ios::out | ios::trunc,
|
IOS_BASE::in | IOS_BASE::out | IOS_BASE::trunc,
|
||||||
// ios::out | ios::binary,
|
// IOS_BASE::out | IOS_BASE::binary,
|
||||||
// ios::out | ios::app | ios::binary,
|
// IOS_BASE::out | IOS_BASE::app | IOS_BASE::binary,
|
||||||
// ios::out | ios::trunc | ios::binary,
|
// IOS_BASE::out | IOS_BASE::trunc | IOS_BASE::binary,
|
||||||
// ios::in | ios::binary,
|
// IOS_BASE::in | IOS_BASE::binary,
|
||||||
// ios::in | ios::out | ios::binary,
|
// IOS_BASE::in | IOS_BASE::out | IOS_BASE::binary,
|
||||||
// ios::in | ios::out | ios::trunc | ios::binary,
|
// IOS_BASE::in | IOS_BASE::out | IOS_BASE::trunc | IOS_BASE::binary,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ PRFileDesc* nsFileStreamHelpers::open(
|
||||||
// "w+b",
|
// "w+b",
|
||||||
0 };
|
0 };
|
||||||
int ind=0;
|
int ind=0;
|
||||||
while (valid_modes[ind] && valid_modes[ind] != (mode&~ios::ate))
|
while (valid_modes[ind] && valid_modes[ind] != (mode&~IOS_BASE::ate))
|
||||||
++ind;
|
++ind;
|
||||||
if (!nspr_modes[ind])
|
if (!nspr_modes[ind])
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -118,7 +118,7 @@ PRFileDesc* nsFileStreamHelpers::open(
|
||||||
// Platforms other than Macintosh...
|
// Platforms other than Macintosh...
|
||||||
if ((descriptor = PR_Open(inFile, nspr_modes[ind], accessMode)) != 0)
|
if ((descriptor = PR_Open(inFile, nspr_modes[ind], accessMode)) != 0)
|
||||||
#endif
|
#endif
|
||||||
if (mode&ios::ate && PR_Seek(descriptor, 0, PR_SEEK_END) >= 0)
|
if (mode&IOS_BASE::ate && PR_Seek(descriptor, 0, PR_SEEK_END) >= 0)
|
||||||
{
|
{
|
||||||
PR_Close(descriptor);
|
PR_Close(descriptor);
|
||||||
descriptor = 0;
|
descriptor = 0;
|
||||||
|
|
|
@ -29,25 +29,25 @@
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
PRFileDesc* nsFileStreamHelpers::open(
|
PRFileDesc* nsFileStreamHelpers::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
PRFileDesc* descriptor = 0;
|
PRFileDesc* descriptor = 0;
|
||||||
const ios::openmode valid_modes[]=
|
const IOS_BASE::openmode valid_modes[]=
|
||||||
{
|
{
|
||||||
ios::out,
|
IOS_BASE::out,
|
||||||
ios::out | ios::app,
|
IOS_BASE::out | IOS_BASE::app,
|
||||||
ios::out | ios::trunc,
|
IOS_BASE::out | IOS_BASE::trunc,
|
||||||
ios::in,
|
IOS_BASE::in,
|
||||||
ios::in | ios::out,
|
IOS_BASE::in | IOS_BASE::out,
|
||||||
ios::in | ios::out | ios::trunc,
|
IOS_BASE::in | IOS_BASE::out | IOS_BASE::trunc,
|
||||||
// ios::out | ios::binary,
|
// IOS_BASE::out | IOS_BASE::binary,
|
||||||
// ios::out | ios::app | ios::binary,
|
// IOS_BASE::out | IOS_BASE::app | IOS_BASE::binary,
|
||||||
// ios::out | ios::trunc | ios::binary,
|
// IOS_BASE::out | IOS_BASE::trunc | IOS_BASE::binary,
|
||||||
// ios::in | ios::binary,
|
// IOS_BASE::in | IOS_BASE::binary,
|
||||||
// ios::in | ios::out | ios::binary,
|
// IOS_BASE::in | IOS_BASE::out | IOS_BASE::binary,
|
||||||
// ios::in | ios::out | ios::trunc | ios::binary,
|
// IOS_BASE::in | IOS_BASE::out | IOS_BASE::trunc | IOS_BASE::binary,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ PRFileDesc* nsFileStreamHelpers::open(
|
||||||
// "w+b",
|
// "w+b",
|
||||||
0 };
|
0 };
|
||||||
int ind=0;
|
int ind=0;
|
||||||
while (valid_modes[ind] && valid_modes[ind] != (mode&~ios::ate))
|
while (valid_modes[ind] && valid_modes[ind] != (mode&~IOS_BASE::ate))
|
||||||
++ind;
|
++ind;
|
||||||
if (!nspr_modes[ind])
|
if (!nspr_modes[ind])
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -118,7 +118,7 @@ PRFileDesc* nsFileStreamHelpers::open(
|
||||||
// Platforms other than Macintosh...
|
// Platforms other than Macintosh...
|
||||||
if ((descriptor = PR_Open(inFile, nspr_modes[ind], accessMode)) != 0)
|
if ((descriptor = PR_Open(inFile, nspr_modes[ind], accessMode)) != 0)
|
||||||
#endif
|
#endif
|
||||||
if (mode&ios::ate && PR_Seek(descriptor, 0, PR_SEEK_END) >= 0)
|
if (mode&IOS_BASE::ate && PR_Seek(descriptor, 0, PR_SEEK_END) >= 0)
|
||||||
{
|
{
|
||||||
PR_Close(descriptor);
|
PR_Close(descriptor);
|
||||||
descriptor = 0;
|
descriptor = 0;
|
||||||
|
|
|
@ -92,6 +92,8 @@
|
||||||
#define NS_NAMESPACE namespace
|
#define NS_NAMESPACE namespace
|
||||||
#define NS_NAMESPACE_END
|
#define NS_NAMESPACE_END
|
||||||
#define BASIC_STREAMBUF basic_streambuf
|
#define BASIC_STREAMBUF basic_streambuf
|
||||||
|
#define IOS_BASE ios_base
|
||||||
|
|
||||||
#include <istream>
|
#include <istream>
|
||||||
using std::ios_base;
|
using std::ios_base;
|
||||||
using std::basic_streambuf;
|
using std::basic_streambuf;
|
||||||
|
@ -103,13 +105,18 @@
|
||||||
using std::basic_ostream;
|
using std::basic_ostream;
|
||||||
using std::basic_iostream;
|
using std::basic_iostream;
|
||||||
using std::char_traits;
|
using std::char_traits;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#include <istream.h>
|
|
||||||
#define NS_NAMESPACE_PROTOTYPE static
|
#define NS_NAMESPACE_PROTOTYPE static
|
||||||
#define NS_NAMESPACE struct
|
#define NS_NAMESPACE struct
|
||||||
#define NS_NAMESPACE_END ;
|
#define NS_NAMESPACE_END ;
|
||||||
#define BASIC_STREAMBUF streambuf
|
#define BASIC_STREAMBUF streambuf
|
||||||
#endif
|
#define IOS_BASE ios
|
||||||
|
|
||||||
|
#include <istream.h>
|
||||||
|
|
||||||
|
#endif // NS_USING_NAMESPACE
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
#ifdef __MWERKS__
|
||||||
|
|
||||||
|
@ -128,7 +135,8 @@
|
||||||
#define NS_READ_LOCK(mut)
|
#define NS_READ_LOCK(mut)
|
||||||
#define NS_WRITE_LOCK(mut)
|
#define NS_WRITE_LOCK(mut)
|
||||||
|
|
||||||
#endif //==================== End Compiler-specific macros ===============================
|
#endif // __MWERKS__
|
||||||
|
//=========================== End Compiler-specific macros ===============================
|
||||||
|
|
||||||
//========================================================================================
|
//========================================================================================
|
||||||
NS_NAMESPACE nsFileStreamHelpers
|
NS_NAMESPACE nsFileStreamHelpers
|
||||||
|
@ -138,7 +146,7 @@ NS_NAMESPACE nsFileStreamHelpers
|
||||||
{
|
{
|
||||||
NS_NAMESPACE_PROTOTYPE PRFileDesc* open(
|
NS_NAMESPACE_PROTOTYPE PRFileDesc* open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode);
|
PRIntn accessMode);
|
||||||
} NS_NAMESPACE_END // nsFileStreamHelpers
|
} NS_NAMESPACE_END // nsFileStreamHelpers
|
||||||
|
|
||||||
|
@ -172,7 +180,7 @@ public:
|
||||||
bool is_open() const;
|
bool is_open() const;
|
||||||
filebuf_type* open(
|
filebuf_type* open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode);
|
PRIntn accessMode);
|
||||||
filebuf_type* close();
|
filebuf_type* close();
|
||||||
|
|
||||||
|
@ -181,10 +189,10 @@ protected:
|
||||||
virtual int_type pbackfail(int_type c=traits::eof());
|
virtual int_type pbackfail(int_type c=traits::eof());
|
||||||
virtual int_type underflow();
|
virtual int_type underflow();
|
||||||
virtual pos_type seekoff(
|
virtual pos_type seekoff(
|
||||||
off_type off, ios::seekdir way,
|
off_type off, IOS_BASE::seekdir way,
|
||||||
ios::openmode which=ios::in|ios::out);
|
IOS_BASE::openmode which=IOS_BASE::in|IOS_BASE::out);
|
||||||
virtual pos_type seekpos(pos_type sp,
|
virtual pos_type seekpos(pos_type sp,
|
||||||
ios::openmode which=ios::in|ios::out);
|
IOS_BASE::openmode which=IOS_BASE::in|IOS_BASE::out);
|
||||||
virtual BASIC_STREAMBUF<charT, traits>* setbuf(char_type* s, streamsize n);
|
virtual BASIC_STREAMBUF<charT, traits>* setbuf(char_type* s, streamsize n);
|
||||||
virtual int sync();
|
virtual int sync();
|
||||||
virtual int_type uflow();
|
virtual int_type uflow();
|
||||||
|
@ -195,7 +203,7 @@ protected:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
PRFileDesc* mFileDesc;
|
PRFileDesc* mFileDesc;
|
||||||
ios::openmode mode_;
|
IOS_BASE::openmode mode_;
|
||||||
}; // class nsFileBufferT
|
}; // class nsFileBufferT
|
||||||
|
|
||||||
//========================================================================================
|
//========================================================================================
|
||||||
|
@ -216,7 +224,7 @@ public:
|
||||||
nsInputFileStreamT();
|
nsInputFileStreamT();
|
||||||
explicit nsInputFileStreamT(
|
explicit nsInputFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode=ios::in,
|
IOS_BASE::openmode mode=IOS_BASE::in,
|
||||||
PRIntn accessMode = 0x00400);
|
PRIntn accessMode = 0x00400);
|
||||||
|
|
||||||
virtual ~nsInputFileStreamT();
|
virtual ~nsInputFileStreamT();
|
||||||
|
@ -225,7 +233,7 @@ public:
|
||||||
inline bool is_open();
|
inline bool is_open();
|
||||||
inline void open(
|
inline void open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode=ios::in,
|
IOS_BASE::openmode mode=IOS_BASE::in,
|
||||||
PRIntn accessMode = 0x00400);
|
PRIntn accessMode = 0x00400);
|
||||||
inline void close();
|
inline void close();
|
||||||
|
|
||||||
|
@ -251,7 +259,7 @@ public:
|
||||||
nsOutputFileStreamT();
|
nsOutputFileStreamT();
|
||||||
explicit nsOutputFileStreamT(
|
explicit nsOutputFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode = ios::out|ios::trunc,
|
IOS_BASE::openmode mode = IOS_BASE::out|IOS_BASE::trunc,
|
||||||
PRIntn accessMode = 0x00200);
|
PRIntn accessMode = 0x00200);
|
||||||
|
|
||||||
virtual ~nsOutputFileStreamT();
|
virtual ~nsOutputFileStreamT();
|
||||||
|
@ -260,7 +268,7 @@ public:
|
||||||
inline bool is_open();
|
inline bool is_open();
|
||||||
inline void open(
|
inline void open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode = ios::out|ios::trunc,
|
IOS_BASE::openmode mode = IOS_BASE::out|IOS_BASE::trunc,
|
||||||
PRIntn accessMode = 0x00200);
|
PRIntn accessMode = 0x00200);
|
||||||
inline void close();
|
inline void close();
|
||||||
|
|
||||||
|
@ -310,7 +318,7 @@ nsFileBufferT<charT, traits>::is_open() const
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
nsFileBufferT<charT, traits>* nsFileBufferT<charT, traits>::open(
|
nsFileBufferT<charT, traits>* nsFileBufferT<charT, traits>::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
@ -501,18 +509,18 @@ nsFileBufferT<charT, traits>::showmanyc()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
nsFileBufferT<charT, traits>::pos_type nsFileBufferT<charT, traits>::seekoff(
|
nsFileBufferT<charT, traits>::pos_type nsFileBufferT<charT, traits>::seekoff(
|
||||||
off_type off,
|
off_type off,
|
||||||
ios::seekdir way,
|
IOS_BASE::seekdir way,
|
||||||
ios::openmode /* which */)
|
IOS_BASE::openmode /* which */)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
if (!mFileDesc || ((way&ios::beg) && off<0) || ((way&ios::end) && off > 0))
|
if (!mFileDesc || ((way&IOS_BASE::beg) && off<0) || ((way&IOS_BASE::end) && off > 0))
|
||||||
return pos_type(-1);
|
return pos_type(-1);
|
||||||
PRSeekWhence poseek = PR_SEEK_CUR;
|
PRSeekWhence poseek = PR_SEEK_CUR;
|
||||||
switch (way)
|
switch (way)
|
||||||
{
|
{
|
||||||
case ios::beg : poseek= PR_SEEK_SET;
|
case IOS_BASE::beg : poseek= PR_SEEK_SET;
|
||||||
break;
|
break;
|
||||||
case ios::end : poseek= PR_SEEK_END;
|
case IOS_BASE::end : poseek= PR_SEEK_END;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
PRInt32 position = PR_Seek(mFileDesc, off, poseek);
|
PRInt32 position = PR_Seek(mFileDesc, off, poseek);
|
||||||
|
@ -524,7 +532,7 @@ nsFileBufferT<charT, traits>::pos_type nsFileBufferT<charT, traits>::seekoff(
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
nsFileBufferT<charT, traits>::pos_type
|
nsFileBufferT<charT, traits>::pos_type
|
||||||
nsFileBufferT<charT, traits>::seekpos(pos_type sp, ios::openmode)
|
nsFileBufferT<charT, traits>::seekpos(pos_type sp, IOS_BASE::openmode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
if (!mFileDesc || sp==pos_type(-1))
|
if (!mFileDesc || sp==pos_type(-1))
|
||||||
|
@ -552,7 +560,7 @@ inline nsInputFileStreamT<charT, traits>::nsInputFileStreamT()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
inline nsInputFileStreamT<charT, traits>::nsInputFileStreamT(
|
inline nsInputFileStreamT<charT, traits>::nsInputFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
: basic_istream<charT, traits>(&mBuffer)
|
: basic_istream<charT, traits>(&mBuffer)
|
||||||
|
@ -592,7 +600,7 @@ template<class charT, class traits>
|
||||||
inline void
|
inline void
|
||||||
nsInputFileStreamT<charT, traits>::open(
|
nsInputFileStreamT<charT, traits>::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
@ -626,7 +634,7 @@ inline nsOutputFileStreamT<charT, traits>::nsOutputFileStreamT()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
nsOutputFileStreamT<charT, traits>::nsOutputFileStreamT(
|
nsOutputFileStreamT<charT, traits>::nsOutputFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
: basic_ostream<charT, traits>(&mBuffer)
|
: basic_ostream<charT, traits>(&mBuffer)
|
||||||
|
@ -664,7 +672,7 @@ inline bool nsOutputFileStreamT<charT, traits>:: is_open()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
inline void nsOutputFileStreamT<charT, traits>::open(
|
inline void nsOutputFileStreamT<charT, traits>::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
@ -698,7 +706,7 @@ public:
|
||||||
nsIOFileStreamT();
|
nsIOFileStreamT();
|
||||||
explicit nsIOFileStreamT(
|
explicit nsIOFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode = ios::in|ios::out,
|
IOS_BASE::openmode mode = IOS_BASE::in|IOS_BASE::out,
|
||||||
PRIntn accessMode = 0x00600);
|
PRIntn accessMode = 0x00600);
|
||||||
|
|
||||||
virtual ~nsIOFileStreamT();
|
virtual ~nsIOFileStreamT();
|
||||||
|
@ -707,7 +715,7 @@ public:
|
||||||
inline bool is_open();
|
inline bool is_open();
|
||||||
inline void open(
|
inline void open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode = ios::in|ios::out,
|
IOS_BASE::openmode mode = IOS_BASE::in|IOS_BASE::out,
|
||||||
PRIntn accessMode = 0x00600);
|
PRIntn accessMode = 0x00600);
|
||||||
inline void close();
|
inline void close();
|
||||||
|
|
||||||
|
@ -732,7 +740,7 @@ inline nsIOFileStreamT<charT, traits>::nsIOFileStreamT()
|
||||||
template<class charT, class traits>
|
template<class charT, class traits>
|
||||||
inline nsIOFileStreamT<charT, traits>::nsIOFileStreamT(
|
inline nsIOFileStreamT<charT, traits>::nsIOFileStreamT(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
: mBuffer(), basic_iostream<charT, traits>(&mBuffer)
|
: mBuffer(), basic_iostream<charT, traits>(&mBuffer)
|
||||||
|
@ -770,7 +778,7 @@ template<class charT, class traits>
|
||||||
inline void
|
inline void
|
||||||
nsIOFileStreamT<charT, traits>::open(
|
nsIOFileStreamT<charT, traits>::open(
|
||||||
const nsFilePath& inFile,
|
const nsFilePath& inFile,
|
||||||
ios::openmode mode,
|
IOS_BASE::openmode mode,
|
||||||
PRIntn accessMode)
|
PRIntn accessMode)
|
||||||
//----------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче