diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2015-04-24 08:55:20 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2015-04-24 08:55:20 -0400 |
commit | 3ae8a821c3b627f3b02df636e7649f28b97d6f57 (patch) | |
tree | 79d5d3f2b262b7f5d60cc6135b80221878aa74b8 /indra/llcommon/llfile.h | |
parent | 39b17157f9c31a4b911113561d4fc8f86396c430 (diff) | |
parent | fde0868231a25b8c9ce03a86cb53f1738d35688d (diff) |
merge
Diffstat (limited to 'indra/llcommon/llfile.h')
-rwxr-xr-x | indra/llcommon/llfile.h | 110 |
1 files changed, 33 insertions, 77 deletions
diff --git a/indra/llcommon/llfile.h b/indra/llcommon/llfile.h index f56b22bf9a..347c9867aa 100755 --- a/indra/llcommon/llfile.h +++ b/indra/llcommon/llfile.h @@ -188,11 +188,11 @@ protected: /*virtual*/ int sync(); std::streamsize xsgetn(char_type*, std::streamsize); - std::streamsize xsputn(char_type*, std::streamsize); + std::streamsize xsputn(const char_type*, std::streamsize); #endif }; - +#if LL_WINDOWS /** * @brief Controlling input for files. * @@ -201,11 +201,11 @@ protected: * sequence, an instance of std::basic_filebuf (or a platform-specific derivative) * which allows construction using a pre-exisintg file stream buffer. * We refer to this std::basic_filebuf (or derivative) as @c sb. -*/ + */ class LL_COMMON_API llifstream : public std::istream { // input stream associated with a C stream -public: + public: // Constructors: /** * @brief Default constructor. @@ -213,7 +213,7 @@ public: * Initializes @c sb using its default constructor, and passes * @c &sb to the base class initializer. Does not open any files * (you haven't given it a filename to open). - */ + */ llifstream(); /** @@ -222,44 +222,18 @@ public: * @param Mode Open file in specified mode (see std::ios_base). * * @c ios_base::in is automatically included in @a mode. - */ + */ explicit llifstream(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in); + ios_base::openmode _Mode = ios_base::in); explicit llifstream(const char* _Filename, - ios_base::openmode _Mode = ios_base::in); - - /** - * @brief Create a stream using an open c file stream. - * @param File An open @c FILE*. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ - explicit llifstream(_Filet *_File, - ios_base::openmode _Mode = ios_base::in, - //size_t _Size = static_cast<size_t>(BUFSIZ)); - size_t _Size = static_cast<size_t>(1)); - - /** - * @brief Create a stream using an open file descriptor. - * @param fd An open file descriptor. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ -#if !LL_WINDOWS - explicit llifstream(int __fd, - ios_base::openmode _Mode = ios_base::in, - //size_t _Size = static_cast<size_t>(BUFSIZ)); - size_t _Size = static_cast<size_t>(1)); -#endif + ios_base::openmode _Mode = ios_base::in); /** * @brief The destructor does nothing. * * The file is closed by the filebuf object, not the formatting * stream. - */ + */ virtual ~llifstream() {} // Members: @@ -275,7 +249,7 @@ public: /** * @brief Wrapper to test for an open file. * @return @c rdbuf()->is_open() - */ + */ bool is_open() const; /** @@ -285,22 +259,22 @@ public: * * Calls @c llstdio_filebuf::open(s,mode|in). If that function * fails, @c failbit is set in the stream's error state. - */ + */ void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::in) + ios_base::openmode _Mode = ios_base::in) { open(_Filename.c_str(), _Mode); } void open(const char* _Filename, - ios_base::openmode _Mode = ios_base::in); + ios_base::openmode _Mode = ios_base::in); /** * @brief Close the file. * * Calls @c llstdio_filebuf::close(). If that function * fails, @c failbit is set in the stream's error state. - */ + */ void close(); -private: + private: llstdio_filebuf _M_filebuf; }; @@ -316,7 +290,7 @@ private: */ class LL_COMMON_API llofstream : public std::ostream { -public: + public: // Constructors: /** * @brief Default constructor. @@ -324,7 +298,7 @@ public: * Initializes @c sb using its default constructor, and passes * @c &sb to the base class initializer. Does not open any files * (you haven't given it a filename to open). - */ + */ llofstream(); /** @@ -334,37 +308,11 @@ public: * * @c ios_base::out|ios_base::trunc is automatically included in * @a mode. - */ + */ explicit llofstream(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); explicit llofstream(const char* _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); - - /** - * @brief Create a stream using an open c file stream. - * @param File An open @c FILE*. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ - explicit llofstream(_Filet *_File, - ios_base::openmode _Mode = ios_base::out, - //size_t _Size = static_cast<size_t>(BUFSIZ)); - size_t _Size = static_cast<size_t>(1)); - - /** - * @brief Create a stream using an open file descriptor. - * @param fd An open file descriptor. - @param Mode Same meaning as in a standard filebuf. - @param Size Optimal or preferred size of internal buffer, in chars. - Defaults to system's @c BUFSIZ. - */ -#if !LL_WINDOWS - explicit llofstream(int __fd, - ios_base::openmode _Mode = ios_base::out, - //size_t _Size = static_cast<size_t>(BUFSIZ)); - size_t _Size = static_cast<size_t>(1)); -#endif + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); /** * @brief The destructor does nothing. @@ -397,22 +345,22 @@ public: * * Calls @c llstdio_filebuf::open(s,mode|out). If that function * fails, @c failbit is set in the stream's error state. - */ + */ void open(const std::string& _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc) + ios_base::openmode _Mode = ios_base::out|ios_base::trunc) { open(_Filename.c_str(), _Mode); } void open(const char* _Filename, - ios_base::openmode _Mode = ios_base::out|ios_base::trunc); + ios_base::openmode _Mode = ios_base::out|ios_base::trunc); /** * @brief Close the file. * * Calls @c llstdio_filebuf::close(). If that function * fails, @c failbit is set in the stream's error state. - */ + */ void close(); -private: + private: llstdio_filebuf _M_filebuf; }; @@ -427,4 +375,12 @@ private: std::streamsize LL_COMMON_API llifstream_size(llifstream& fstr); std::streamsize LL_COMMON_API llofstream_size(llofstream& fstr); +#else // ! LL_WINDOWS + +// on non-windows, llifstream and llofstream are just mapped directly to the std:: equivalents +typedef std::ifstream llifstream; +typedef std::ofstream llofstream; + +#endif // LL_WINDOWS or ! LL_WINDOWS + #endif // not LL_LLFILE_H |