#ifndef __IOTRAITS_H #define __IOTRAITS_H #pragma option push -b -a8 -pc -Vx- -Ve- -w-inl -w-aus -w-sig // -*- C++ -*- #ifndef __RWSTD_IOTRAITS #define __RWSTD_IOTRAITS /*************************************************************************** * * iotraits - Declarations for traits * *************************************************************************** * * Copyright (c) 1994-1999 Rogue Wave Software, Inc. All Rights Reserved. * * This computer software is owned by Rogue Wave Software, Inc. and is * protected by U.S. copyright laws and other laws and by international * treaties. This computer software is furnished by Rogue Wave Software, * Inc. pursuant to a written license agreement and may be used, copied, * transmitted, and stored only in accordance with the terms of such * license and with the inclusion of the above copyright notice. This * computer software or any other copies thereof may not be provided or * otherwise made available to any other person. * * U.S. Government Restricted Rights. This computer software is provided * with Restricted Rights. Use, duplication, or disclosure by the * Government is subject to restrictions as set forth in subparagraph (c) * (1) (ii) of The Rights in Technical Data and Computer Software clause * at DFARS 252.227-7013 or subparagraphs (c) (1) and (2) of the * Commercial Computer Software – Restricted Rights at 48 CFR 52.227-19, * as applicable. Manufacturer is Rogue Wave Software, Inc., 5500 * Flatiron Parkway, Boulder, Colorado 80301 USA. * **************************************************************************/ #include #ifndef _RWSTD_NO_NAMESPACE namespace std { #endif /* * Class mbstate_t */ #ifdef _RWSTD_NO_MBSTATE_T struct _RWSTDExport mbstate_t { mbstate_t( long state=0 ) : __mbstate(state) { ; } mbstate_t(const mbstate_t& state) : __mbstate(state.__mbstate) { ; } mbstate_t& operator=(const mbstate_t& state) { if ( &state != this ) __mbstate= state.__mbstate; return *this; } mbstate_t& operator=(const long state) { __mbstate= state; return *this; } bool operator==(const mbstate_t& state) const { return ( __mbstate == state.__mbstate ); } bool operator!=(const mbstate_t& state) const { return ( !(__mbstate == state.__mbstate) ); } long __mbstate; }; #endif // _RWSTD_NO_MBSTATE_T /* * Class fpos */ /* It maintains all the information necessary to restore an arbitrary * sequence, controlled by the Standard C++ library, to a previous stream * position and conversion state. */ template class _RWSTDExportTemplate fpos { public: // // Types: // typedef stateT state_type; inline fpos(long off = 0); #ifdef _RWSTD_NO_MBSTATE_T inline _EXPLICIT fpos(state_type); #endif inline operator long() const; inline fpos(const fpos&); inline fpos& operator= (const fpos&); inline state_type state () const; inline state_type state (state_type); inline fpos& operator+=(const fpos &off); inline fpos operator+(const fpos &off) const; inline fpos& operator-=(const fpos &off); inline fpos operator-(const fpos &off) const; inline fpos& operator+=(int off); inline fpos operator+(int off) const; inline fpos& operator-=(int off); inline fpos operator-(int off) const; inline fpos& operator+=(long off); inline fpos operator+(long off) const; inline fpos& operator-=(long off); inline fpos operator-(long off) const; inline bool operator==(const fpos& rhs) const; inline bool operator!=(const fpos& rhs) const; inline bool operator< (const fpos& rhs) const; inline bool operator> (const fpos& rhs) const; inline bool operator<= (const fpos& rhs) const; inline bool operator>= (const fpos& rhs) const; inline bool operator==(const int& rhs) const; inline bool operator!=(const int& rhs) const; inline bool operator< (const int& rhs) const; inline bool operator> (const int& rhs) const; inline bool operator<= (const int& rhs) const; inline bool operator>= (const int& rhs) const; inline bool operator==(const long& rhs) const; inline bool operator!=(const long& rhs) const; inline bool operator< (const long& rhs) const; inline bool operator> (const long& rhs) const; inline bool operator<= (const long& rhs) const; inline bool operator>= (const long& rhs) const; private: long __pos; // signed displacement state_type __state; // conversion state bool __status; // status }; /* * Class fpos member functions */ /* * fpos(long) */ template inline fpos::fpos(long off) : __pos(off) , __state(stateT()) , __status(true) { if ( off == -1 ) __status = false; } /* * fpos(stateT) */ #ifdef _RWSTD_NO_MBSTATE_T template inline fpos::fpos(stateT state) : __pos(0) , __state(state) , __status(true) {;} #endif // _RWSTD_NO_MBSTATE_T /* * fpos(const fpos&) */ template inline fpos::fpos(const fpos& str_pos) { __pos = str_pos.__pos; __state = str_pos.__state; __status = str_pos.__status; } /* * state_type state(state_type) */ template inline _TYPENAME fpos::state_type fpos::state(state_type state) { state_type var=__state; __state = state; return var; } /* * operator long ( ) */ template inline fpos::operator long() const { return (long) __pos; } /* * fpos& operator=(const fpos&) */ template inline fpos& fpos::operator=(const fpos& str_pos) { if ( &str_pos != this ) { __pos = str_pos.__pos; __state = str_pos.__state; __status = str_pos.__status; } return *this; } /* * state_type state() const */ template inline _TYPENAME fpos::state_type fpos::state() const { return __state; } /* * fpos& operator+=(const fpos&) */ template inline fpos& fpos::operator+=(const fpos& off) { __pos += off.__pos; return *this; } /* * fpos operator+(const fpos&) const */ template inline fpos fpos::operator+(const fpos& off) const { fpos temp(*this); temp.__pos += off.__pos; return temp; } /* * fpos operator-(const fpos& off) const */ template inline fpos fpos::operator-(const fpos& off) const { fpos temp(*this); temp.__pos -= off.__pos; return temp; } /* * fpos& operator-=(const fpos&) */ template inline fpos& fpos::operator-=(const fpos& off) { __pos -= off.__pos; return *this; } /* * fpos& operator+=(int) */ template inline fpos& fpos::operator+=(int off) { __pos += off; return *this; } /* * fpos operator+(int) const */ template inline fpos fpos::operator+(int off) const { fpos temp(*this); temp.__pos += off; return temp; } /* * fpos operator-(int off) const */ template inline fpos fpos::operator-(int off) const { fpos temp(*this); temp.__pos -= off; return temp; } /* * fpos& operator-=(int) */ template inline fpos& fpos::operator-=(int off) { __pos -= off; return *this; } /* * fpos& operator-=(long) */ template inline fpos& fpos::operator-=(long off) { __pos -= off; return *this; } /* * fpos operator-(long off) const */ template inline fpos fpos::operator-(long off) const { fpos temp(*this); temp.__pos -= off; return temp; } /* * fpos& operator+=(long) */ template inline fpos& fpos::operator+=(long off) { __pos += off; return *this; } /* * fpos operator+(long) const */ template inline fpos fpos::operator+(long off) const { fpos temp(*this); temp.__pos += off; return temp; } /* * bool operator==(const fpos&) const */ template inline bool fpos::operator==(const fpos& pos) const { if ( !(__status || pos.__status) ) return true; return ( ( __pos == pos.__pos ) #ifndef _RWSTD_NO_MBSTATE_COMPARE && ( __state == pos.__state ) #endif && ( __status == pos.__status ) ); } /* * bool operator!=(const fpos&) const */ template inline bool fpos::operator!=(const fpos& pos) const { return !(*this == pos); } /* * bool operator< (const fpos&) const */ template inline bool fpos::operator< (const fpos& pos) const { return ( __pos < pos.__pos ); } /* * bool operator> (const fpos&) const */ template inline bool fpos::operator> (const fpos& pos) const { return ( __pos > pos.__pos ); } /* * bool operator<= (const fpos&) const */ template inline bool fpos::operator<= (const fpos& pos) const { return ( __pos <= pos.__pos ); } /* * bool operator>= (const fpos&) const */ template inline bool fpos::operator>= (const fpos& pos) const { return ( __pos >= pos.__pos ); } /* * bool operator==(const int&) const */ template inline bool fpos::operator==(const int& pos) const { return ( __pos == pos ); } /* * bool operator!=(const int&) const */ template inline bool fpos::operator!=(const int& pos) const { return !(*this == pos); } /* * bool operator< (const int&) const */ template inline bool fpos::operator< (const int& pos) const { return ( __pos < pos ); } /* * bool operator> (const int&) const */ template inline bool fpos::operator> (const int& pos) const { return ( __pos > pos ); } /* * bool operator<= (const int&) const */ template inline bool fpos::operator<= (const int& pos) const { return ( __pos <= pos ); } /* * bool operator>= (const int&) const */ template inline bool fpos::operator>= (const int& pos) const { return ( __pos >= pos ); } /* * bool operator==(const long&) const */ template inline bool fpos::operator==(const long& pos) const { return ( __pos == pos ); } /* * bool operator!=(const long&) const */ template inline bool fpos::operator!=(const long& pos) const { return !(*this == pos); } /* * bool operator< (const long&) const */ template inline bool fpos::operator< (const long& pos) const { return ( __pos < pos ); } /* * bool operator> (const long&) const */ template inline bool fpos::operator> (const long& pos) const { return ( __pos > pos ); } /* * bool operator<= (const long&) const */ template inline bool fpos::operator<= (const long& pos) const { return ( __pos >= pos ); } /* * bool operator>= (const long&) const */ template inline bool fpos::operator>= (const long& pos) const { return ( __pos <= pos ); } #ifndef _RWSTD_NO_NAMESPACE } #endif #endif // __RWSTD_IOTRAITS #pragma option pop #endif /* __IOTRAITS_H */