//============================================================================== // charstream.cpp // Generic I/O text stream. // // Notice // Copyright ©2010 by David R. Tribble, all rights reserved. // Permission is granted to any person or entity except those designated // by the United States Department of State as a terrorist, or terrorist // government or agency, to use and distribute this source code provided // that the original copyright notice remains present and unaltered. //============================================================================== // Identification static char REV[] = "@(#)drt/src/lib/charstream.cpp $Revision: 1.1 $$Date: 2011/05/08 02:39:56 $"; // Includes #include #define sys_ctype_h #include #define sys_errno_h #include #define sys_iso646_h #include #define sys_stdio_h #include #define sys_string_h #if _WIN32 #define WINDOWS_LEAN_AND_MEAN #include #include #endif #include "charstream.hpp" //------------------------------------------------------------------------------ // CharStream::~CharStream() // Destructor. //------------------------------------------------------------------------------ CharStream::~CharStream() { #if CharStream_VS != 100 #error class CharStream has changed #endif // De-initialize } //------------------------------------------------------------------------------ // CharStream::CharStream() // Constructor. //------------------------------------------------------------------------------ CharStream::CharStream(): m_errno(0), m_mode(MODE_NONE), m_ftype(FTYPE_8BIT), m_eoln(EOLN_NONE) { #if CharStream_VS != 100 #error class CharStream has changed #endif // Initialize } //------------------------------------------------------------------------------ // CharStream::error() // Retrieve the last error (::errno) code. //------------------------------------------------------------------------------ int CharStream::error() const { #if CharStream_VS/100 != 1 #error class CharStream has changed #endif return m_errno; } //------------------------------------------------------------------------------ // CharStream::getMode() // Retrieve the I/O mode of this I/O stream. //------------------------------------------------------------------------------ enum CharStream::Mode CharStream::getMode() const { #if CharStream_VS/100 != 1 #error class CharStream has changed #endif return m_mode; } //------------------------------------------------------------------------------ // CharStream::getFileType() // Retrieve the file type of this I/O stream. //------------------------------------------------------------------------------ enum CharStream::FileType CharStream::getFileType() const { #if CharStream_VS/100 != 1 #error class CharStream has changed #endif return m_ftype; } //------------------------------------------------------------------------------ // CharStream::getEolnType() // Retrieve the newline mode of this I/O stream. //------------------------------------------------------------------------------ enum CharStream::EolnType CharStream::getEolnType() const { #if CharStream_VS/100 != 1 #error class CharStream has changed #endif return m_eoln; } // End charstream.cpp