home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-25 | 147.6 KB | 4,465 lines |
- /*************************************************************************
- * TOOLS.HXX
- * Tue Oct 25 17:14:32 1994
- * (c) 1992-1994 STAR DIVISION
- *************************************************************************/
- #ifndef _TOOLS_HXX
- #define _TOOLS_HXX
- #ifndef _SOLAR_H
- #include <solar.h>
- #endif
-
- #ifndef _TOOLS_H
- #define _TOOLS_H
-
- #ifndef _SOLAR_H
- #endif
-
- #endif
-
- #ifndef _NEW_HXX
- #define _NEW_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- typedef void (*_NEW_HANDLER)();
- _NEW_HANDLER set_new_handler( _NEW_HANDLER pHandler );
-
- #endif
-
- #ifndef _LINK_HXX
- #define _LINK_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- class LinkHdl
- {
- };
-
- typedef long (LinkHdl::*PFUNC)( void* pCaller );
-
- class Link
- {
- protected:
- LinkHdl* pInst;
- PFUNC pMemFunc;
-
- public:
- Link();
- Link( LinkHdl* pLinkHdl, PFUNC pProc );
-
- long Call( void* pCaller );
-
- BOOL IsSet() const;
- BOOL operator !() const;
-
- BOOL operator==( const Link& rLink ) const;
- BOOL operator!=( const Link& rLink ) const;
-
- #ifdef _MSC_VER
-
- Link( const Link& rLink )
- {
- pInst = rLink.pInst;
- pMemFunc = rLink.pMemFunc;
- }
-
- Link& operator=( const Link& rLink )
- {
- pInst = rLink.pInst;
- pMemFunc = rLink.pMemFunc;
- return *this;
- }
- #endif
- };
-
- #ifndef MPW33
-
- inline Link::Link()
- {
- pInst = NULL;
- pMemFunc = 0;
- }
-
- inline Link::Link( LinkHdl* pLinkHdl, PFUNC pProc )
- {
- pInst = pLinkHdl;
- pMemFunc = pProc;
- }
-
- #endif
-
- inline long Link::Call( void* pCaller )
- {
- if ( pInst != NULL && pMemFunc != NULL )
- return (pInst->*pMemFunc)( pCaller );
- else
- return FALSE;
- }
-
- inline BOOL Link::IsSet() const
- {
- if ( pInst != NULL && pMemFunc != NULL )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL Link::operator !() const
- {
- if ( pInst == NULL || pMemFunc == NULL )
- return TRUE;
- else
- return FALSE;
- }
-
- #if !defined( __ZTC__ )
- #define LINK( pInst, Class, pMemFunc ) \
- Link( (LinkHdl*)(void*)pInst, \
- (PFUNC) (long (Class::*)( void* )) &Class::pMemFunc )
- #define LINK2( pInst, Class, pMemFunc ) \
- Link( (LinkHdl*)pInst, \
- (PFUNC) (long (Class::*)( void* )) &Class::pMemFunc )
- #else
- #define LINK( pInst, Class, pMemFunc ) \
- Link( pInst, (PFUNC) &Class::pMemFunc )
- #define LINK2( pInst, Class, pMemFunc ) \
- Link( (LinkHdl*)(void*)pInst, (PFUNC) &Class::pMemFunc )
- #endif
-
- #endif
-
- #define _PAIR Pair
- #define _POINT Point
- #define _SIZE Size
- #define _RANGE Range
- #define _SELECTION Selection
- #define _RECTANGLE Rectangle
-
- #define _PAIR_2 LPair
- #define _POINT_2 LPoint
- #define _SIZE_2 LSize
- #define _RANGE_2 LRange
- #define _SELECTION_2 LSelection
- #define _RECTANGLE_2 LRectangle
-
- #define _SL_TYPE short
-
- #define RANGE_MIN ((short)0x8000)
- #define RANGE_MAX 0x7FFF
-
- #define SELECTION_MIN ((short)0x8000)
- #define SELECTION_MAX 0x7FFF
-
- #ifndef _TOOLS_H
- #endif
-
- class _PAIR_2;
- class _POINT_2;
- class _SIZE_2;
- class _RANGE_2;
- class _SELECTION_2;
- class _RECTANGLE_2;
-
- class _PAIR
- {
- protected:
- _SL_TYPE nA;
- _SL_TYPE nB;
-
- friend _PAIR_2;
-
- public:
- _PAIR();
- _PAIR( const _PAIR& rPair );
- _PAIR( _SL_TYPE nA, _SL_TYPE nB );
- _PAIR( const _PAIR_2& rPair );
-
- _SL_TYPE A() const { return nA; }
- _SL_TYPE B() const { return nB; }
-
- _SL_TYPE& A() { return nA; }
- _SL_TYPE& B() { return nB; }
-
- BOOL operator == ( const _PAIR& rPair ) const;
- BOOL operator != ( const _PAIR& rPair ) const;
-
- _PAIR& operator = ( const _PAIR& rPair );
- _PAIR& operator = ( const _PAIR_2& rPair );
- };
-
- inline _PAIR::_PAIR()
- {
- nA = nB = 0;
- }
-
- inline _PAIR::_PAIR( const _PAIR& rPair )
- {
- nA = rPair.nA;
- nB = rPair.nB;
- }
-
- inline _PAIR& _PAIR::operator = ( const _PAIR& rPair )
- {
- nA = rPair.nA;
- nB = rPair.nB;
- return *this;
- }
-
- class _POINT : public _PAIR
- {
- public:
- _POINT();
- _POINT( const _POINT& rPOINT );
- _POINT( _SL_TYPE nX, _SL_TYPE nY );
- _POINT( const _POINT_2& rPoint );
-
- _POINT& operator += ( const _POINT& rPoint );
- _POINT& operator -= ( const _POINT& rPoint );
- _POINT& operator *= ( const _SL_TYPE nVal );
- _POINT& operator /= ( const _SL_TYPE nVal );
-
- #ifdef __BORLANDC__
- friend _POINT operator+( const _POINT &rVal1, const _POINT &rVal2 );
- friend _POINT operator-( const _POINT &rVal1, const _POINT &rVal2 );
- friend _POINT operator*( const _POINT &rVal1, const _SL_TYPE nVal2 );
- friend _POINT operator/( const _POINT &rVal1, const _SL_TYPE nVal2 );
- #else
- friend inline _POINT operator+( const _POINT &rVal1, const _POINT &rVal2 );
- friend inline _POINT operator-( const _POINT &rVal1, const _POINT &rVal2 );
- friend inline _POINT operator*( const _POINT &rVal1, const _SL_TYPE nVal2 );
- friend inline _POINT operator/( const _POINT &rVal1, const _SL_TYPE nVal2 );
- #endif
-
- _SL_TYPE X() const { return nA; }
- _SL_TYPE Y() const { return nB; }
-
- _SL_TYPE& X() { return nA; }
- _SL_TYPE& Y() { return nB; }
-
- BOOL IsAbove( const _POINT& rPoint ) const;
- BOOL IsBelow( const _POINT& rPoint ) const;
- BOOL IsLeft( const _POINT& rPoint ) const;
- BOOL IsRight( const _POINT& rPoint ) const;
- };
-
- inline _POINT::_POINT()
- {
- }
-
- inline _POINT::_POINT( const _POINT& rPoint ) : _PAIR( rPoint )
- {
- }
-
- class _SIZE : public _PAIR
- {
- public:
- _SIZE();
- _SIZE( const _SIZE& rSize );
- _SIZE( _SL_TYPE nWidth, _SL_TYPE nHeight );
- _SIZE( const _SIZE_2& rSize );
-
- _SL_TYPE Width() const { return nA; }
- _SL_TYPE Height() const { return nB; }
-
- _SL_TYPE& Width() { return nA; }
- _SL_TYPE& Height() { return nB; }
- };
-
- inline _SIZE::_SIZE()
- {
- }
-
- inline _SIZE::_SIZE( const _SIZE& rSize ) : _PAIR( rSize )
- {
- }
-
- class _RANGE : public _PAIR
- {
- public:
- _RANGE();
- _RANGE( const _RANGE& rRange );
- _RANGE( _SL_TYPE nMin, _SL_TYPE nMax );
- _RANGE( const _RANGE_2& rRange );
-
- _SL_TYPE Min() const { return nA; }
- _SL_TYPE Max() const { return nB; }
- _SL_TYPE Len() const { return nB - nA + 1; }
-
- _SL_TYPE& Min() { return nA; }
- _SL_TYPE& Max() { return nB; }
-
- BOOL IsInside( _SL_TYPE nIs ) const;
-
- void Justify();
- };
-
- inline _RANGE::_RANGE()
- {
- }
-
- inline _RANGE::_RANGE( const _RANGE& rRange ) : _PAIR( rRange )
- {
- }
-
- class _SELECTION : public _PAIR
- {
- public:
- _SELECTION();
- _SELECTION( const _SELECTION& rSelection );
- _SELECTION( _SL_TYPE nPos );
- _SELECTION( _SL_TYPE nMin, _SL_TYPE nMax );
- _SELECTION( const _SELECTION_2& rSelection );
-
- _SL_TYPE Min() const { return nA; }
- _SL_TYPE Max() const { return nB; }
- _SL_TYPE Len() const { return nB - nA; }
-
- _SL_TYPE& Min() { return nA; }
- _SL_TYPE& Max() { return nB; }
-
- BOOL IsInside( _SL_TYPE nIs ) const;
-
- void Justify();
-
- BOOL operator !() const { return !Len(); }
- };
-
- inline _SELECTION::_SELECTION()
- {
- }
-
- inline _SELECTION::_SELECTION( const _SELECTION& rSelection ) :
- _PAIR( rSelection )
- {
- }
-
- #define RECT_EMPTY ((short)-32767)
-
- class _RECTANGLE
- {
- private:
- _SL_TYPE nLeft;
- _SL_TYPE nTop;
- _SL_TYPE nRight;
- _SL_TYPE nBottom;
-
- friend _RECTANGLE_2;
-
- public:
- _RECTANGLE();
- _RECTANGLE( const _RECTANGLE& rRect );
- _RECTANGLE( const _POINT& rLT, const _POINT& rRB );
- _RECTANGLE( _SL_TYPE nLeft, _SL_TYPE nTop,
- _SL_TYPE nRight, _SL_TYPE nBottom );
- _RECTANGLE( const _POINT& rLT, const _SIZE& rSize );
- _RECTANGLE( const _RECTANGLE_2& rRect );
-
- _SL_TYPE Left() const { return nLeft; }
- _SL_TYPE Right() const { return nRight; }
- _SL_TYPE Top() const { return nTop; }
- _SL_TYPE Bottom() const { return nBottom; }
-
- _SL_TYPE& Left() { return nLeft; }
- _SL_TYPE& Right() { return nRight; }
- _SL_TYPE& Top() { return nTop; }
- _SL_TYPE& Bottom() { return nBottom; }
-
- _POINT TopLeft() const;
- _POINT TopRight() const;
- _POINT TopCenter() const;
- _POINT BottomLeft() const;
- _POINT BottomRight() const;
- _POINT BottomCenter() const;
- _POINT LeftCenter() const;
- _POINT RightCenter() const;
- _POINT Center() const;
-
- _POINT ChangePos( const _POINT& rPoint );
- _SIZE ChangeSize( const _SIZE rSize );
- _SIZE GetSize() const;
-
- _SL_TYPE GetWidth() const;
- _SL_TYPE GetHeight() const;
-
- _RECTANGLE& Union( const _RECTANGLE& rRect );
- _RECTANGLE& Intersection( const _RECTANGLE& rRect );
- _RECTANGLE GetUnion( const _RECTANGLE& rRect ) const;
- _RECTANGLE GetIntersection( const _RECTANGLE& rRect ) const;
-
- void Justify();
-
- BOOL IsInside( const _POINT& rPOINT ) const;
- BOOL IsInside( const _RECTANGLE& rRect ) const;
- BOOL IsOver( const _RECTANGLE& rRect ) const;
-
- BOOL IsEmpty() const;
-
- BOOL operator == ( const _RECTANGLE& rRect ) const;
- BOOL operator != ( const _RECTANGLE& rRect ) const;
-
- _RECTANGLE& operator = ( const _RECTANGLE& rRect );
- _RECTANGLE& operator = ( const _RECTANGLE_2& rRect );
- };
-
- inline _RECTANGLE::_RECTANGLE()
- {
- nLeft = nTop = 0;
- nRight = nBottom = RECT_EMPTY;
- }
-
- inline _RECTANGLE::_RECTANGLE( const _RECTANGLE& rRect )
- {
- nLeft = rRect.nLeft;
- nTop = rRect.nTop;
- nRight = rRect.nRight;
- nBottom = rRect.nBottom;
- }
-
- inline _RECTANGLE& _RECTANGLE::operator = ( const _RECTANGLE& rRect )
- {
- nLeft = rRect.nLeft;
- nTop = rRect.nTop;
- nRight = rRect.nRight;
- nBottom = rRect.nBottom;
- return *this;
- }
-
- #undef _PAIR
- #undef _POINT
- #undef _SIZE
- #undef _RANGE
- #undef _SELECTION
- #undef _RECTANGLE
-
- #undef _PAIR_2
- #undef _POINT_2
- #undef _SIZE_2
- #undef _RANGE_2
- #undef _SELECTION_2
- #undef _RECTANGLE_2
-
- #undef _SL_TYPE
-
- #ifdef __private
- #undef private
- #undef __private
- #endif
-
- #ifdef __protected
- #undef protected
- #undef __protected
- #endif
-
- #ifndef private
- #define private public
- #define __private
- #endif
-
- #ifndef protected
- #define protected public
- #define __protected
- #endif
-
- #define _PAIR LPair
- #define _POINT LPoint
- #define _SIZE LSize
- #define _RANGE LRange
- #define _SELECTION LSelection
- #define _RECTANGLE LRectangle
-
- #define _PAIR_2 Pair
- #define _POINT_2 Point
- #define _SIZE_2 Size
- #define _RANGE_2 Range
- #define _SELECTION_2 Selection
- #define _RECTANGLE_2 Rectangle
-
- #define _SL_TYPE long
-
- #define LRANGE_MIN ((long)0x80000000L)
- #define LRANGE_MAX 0x7FFFFFFFL
-
- #define LSELECTION_MIN ((long)0x80000000L)
- #define LSELECTION_MAX 0x7FFFFFFFL
-
- #ifndef _TOOLS_H
- #endif
-
- class _PAIR_2;
- class _POINT_2;
- class _SIZE_2;
- class _RANGE_2;
- class _SELECTION_2;
- class _RECTANGLE_2;
-
- class _PAIR
- {
- protected:
- _SL_TYPE nA;
- _SL_TYPE nB;
-
- friend _PAIR_2;
-
- public:
- _PAIR();
- _PAIR( const _PAIR& rPair );
- _PAIR( _SL_TYPE nA, _SL_TYPE nB );
- _PAIR( const _PAIR_2& rPair );
-
- _SL_TYPE A() const { return nA; }
- _SL_TYPE B() const { return nB; }
-
- _SL_TYPE& A() { return nA; }
- _SL_TYPE& B() { return nB; }
-
- BOOL operator == ( const _PAIR& rPair ) const;
- BOOL operator != ( const _PAIR& rPair ) const;
-
- _PAIR& operator = ( const _PAIR& rPair );
- _PAIR& operator = ( const _PAIR_2& rPair );
- };
-
- inline _PAIR::_PAIR()
- {
- nA = nB = 0;
- }
-
- inline _PAIR::_PAIR( const _PAIR& rPair )
- {
- nA = rPair.nA;
- nB = rPair.nB;
- }
-
- inline _PAIR& _PAIR::operator = ( const _PAIR& rPair )
- {
- nA = rPair.nA;
- nB = rPair.nB;
- return *this;
- }
-
- class _POINT : public _PAIR
- {
- public:
- _POINT();
- _POINT( const _POINT& rPOINT );
- _POINT( _SL_TYPE nX, _SL_TYPE nY );
- _POINT( const _POINT_2& rPoint );
-
- _POINT& operator += ( const _POINT& rPoint );
- _POINT& operator -= ( const _POINT& rPoint );
- _POINT& operator *= ( const _SL_TYPE nVal );
- _POINT& operator /= ( const _SL_TYPE nVal );
-
- #ifdef __BORLANDC__
- friend _POINT operator+( const _POINT &rVal1, const _POINT &rVal2 );
- friend _POINT operator-( const _POINT &rVal1, const _POINT &rVal2 );
- friend _POINT operator*( const _POINT &rVal1, const _SL_TYPE nVal2 );
- friend _POINT operator/( const _POINT &rVal1, const _SL_TYPE nVal2 );
- #else
- friend inline _POINT operator+( const _POINT &rVal1, const _POINT &rVal2 );
- friend inline _POINT operator-( const _POINT &rVal1, const _POINT &rVal2 );
- friend inline _POINT operator*( const _POINT &rVal1, const _SL_TYPE nVal2 );
- friend inline _POINT operator/( const _POINT &rVal1, const _SL_TYPE nVal2 );
- #endif
-
- _SL_TYPE X() const { return nA; }
- _SL_TYPE Y() const { return nB; }
-
- _SL_TYPE& X() { return nA; }
- _SL_TYPE& Y() { return nB; }
-
- BOOL IsAbove( const _POINT& rPoint ) const;
- BOOL IsBelow( const _POINT& rPoint ) const;
- BOOL IsLeft( const _POINT& rPoint ) const;
- BOOL IsRight( const _POINT& rPoint ) const;
- };
-
- inline _POINT::_POINT()
- {
- }
-
- inline _POINT::_POINT( const _POINT& rPoint ) : _PAIR( rPoint )
- {
- }
-
- class _SIZE : public _PAIR
- {
- public:
- _SIZE();
- _SIZE( const _SIZE& rSize );
- _SIZE( _SL_TYPE nWidth, _SL_TYPE nHeight );
- _SIZE( const _SIZE_2& rSize );
-
- _SL_TYPE Width() const { return nA; }
- _SL_TYPE Height() const { return nB; }
-
- _SL_TYPE& Width() { return nA; }
- _SL_TYPE& Height() { return nB; }
- };
-
- inline _SIZE::_SIZE()
- {
- }
-
- inline _SIZE::_SIZE( const _SIZE& rSize ) : _PAIR( rSize )
- {
- }
-
- class _RANGE : public _PAIR
- {
- public:
- _RANGE();
- _RANGE( const _RANGE& rRange );
- _RANGE( _SL_TYPE nMin, _SL_TYPE nMax );
- _RANGE( const _RANGE_2& rRange );
-
- _SL_TYPE Min() const { return nA; }
- _SL_TYPE Max() const { return nB; }
- _SL_TYPE Len() const { return nB - nA + 1; }
-
- _SL_TYPE& Min() { return nA; }
- _SL_TYPE& Max() { return nB; }
-
- BOOL IsInside( _SL_TYPE nIs ) const;
-
- void Justify();
- };
-
- inline _RANGE::_RANGE()
- {
- }
-
- inline _RANGE::_RANGE( const _RANGE& rRange ) : _PAIR( rRange )
- {
- }
-
- class _SELECTION : public _PAIR
- {
- public:
- _SELECTION();
- _SELECTION( const _SELECTION& rSelection );
- _SELECTION( _SL_TYPE nPos );
- _SELECTION( _SL_TYPE nMin, _SL_TYPE nMax );
- _SELECTION( const _SELECTION_2& rSelection );
-
- _SL_TYPE Min() const { return nA; }
- _SL_TYPE Max() const { return nB; }
- _SL_TYPE Len() const { return nB - nA; }
-
- _SL_TYPE& Min() { return nA; }
- _SL_TYPE& Max() { return nB; }
-
- BOOL IsInside( _SL_TYPE nIs ) const;
-
- void Justify();
-
- BOOL operator !() const { return !Len(); }
- };
-
- inline _SELECTION::_SELECTION()
- {
- }
-
- inline _SELECTION::_SELECTION( const _SELECTION& rSelection ) :
- _PAIR( rSelection )
- {
- }
-
- #define RECT_EMPTY ((short)-32767)
-
- class _RECTANGLE
- {
- private:
- _SL_TYPE nLeft;
- _SL_TYPE nTop;
- _SL_TYPE nRight;
- _SL_TYPE nBottom;
-
- friend _RECTANGLE_2;
-
- public:
- _RECTANGLE();
- _RECTANGLE( const _RECTANGLE& rRect );
- _RECTANGLE( const _POINT& rLT, const _POINT& rRB );
- _RECTANGLE( _SL_TYPE nLeft, _SL_TYPE nTop,
- _SL_TYPE nRight, _SL_TYPE nBottom );
- _RECTANGLE( const _POINT& rLT, const _SIZE& rSize );
- _RECTANGLE( const _RECTANGLE_2& rRect );
-
- _SL_TYPE Left() const { return nLeft; }
- _SL_TYPE Right() const { return nRight; }
- _SL_TYPE Top() const { return nTop; }
- _SL_TYPE Bottom() const { return nBottom; }
-
- _SL_TYPE& Left() { return nLeft; }
- _SL_TYPE& Right() { return nRight; }
- _SL_TYPE& Top() { return nTop; }
- _SL_TYPE& Bottom() { return nBottom; }
-
- _POINT TopLeft() const;
- _POINT TopRight() const;
- _POINT TopCenter() const;
- _POINT BottomLeft() const;
- _POINT BottomRight() const;
- _POINT BottomCenter() const;
- _POINT LeftCenter() const;
- _POINT RightCenter() const;
- _POINT Center() const;
-
- _POINT ChangePos( const _POINT& rPoint );
- _SIZE ChangeSize( const _SIZE rSize );
- _SIZE GetSize() const;
-
- _SL_TYPE GetWidth() const;
- _SL_TYPE GetHeight() const;
-
- _RECTANGLE& Union( const _RECTANGLE& rRect );
- _RECTANGLE& Intersection( const _RECTANGLE& rRect );
- _RECTANGLE GetUnion( const _RECTANGLE& rRect ) const;
- _RECTANGLE GetIntersection( const _RECTANGLE& rRect ) const;
-
- void Justify();
-
- BOOL IsInside( const _POINT& rPOINT ) const;
- BOOL IsInside( const _RECTANGLE& rRect ) const;
- BOOL IsOver( const _RECTANGLE& rRect ) const;
-
- BOOL IsEmpty() const;
-
- BOOL operator == ( const _RECTANGLE& rRect ) const;
- BOOL operator != ( const _RECTANGLE& rRect ) const;
-
- _RECTANGLE& operator = ( const _RECTANGLE& rRect );
- _RECTANGLE& operator = ( const _RECTANGLE_2& rRect );
- };
-
- inline _RECTANGLE::_RECTANGLE()
- {
- nLeft = nTop = 0;
- nRight = nBottom = RECT_EMPTY;
- }
-
- inline _RECTANGLE::_RECTANGLE( const _RECTANGLE& rRect )
- {
- nLeft = rRect.nLeft;
- nTop = rRect.nTop;
- nRight = rRect.nRight;
- nBottom = rRect.nBottom;
- }
-
- inline _RECTANGLE& _RECTANGLE::operator = ( const _RECTANGLE& rRect )
- {
- nLeft = rRect.nLeft;
- nTop = rRect.nTop;
- nRight = rRect.nRight;
- nBottom = rRect.nBottom;
- return *this;
- }
-
- #undef _PAIR
- #undef _POINT
- #undef _SIZE
- #undef _RANGE
- #undef _SELECTION
- #undef _RECTANGLE
-
- #undef _PAIR_2
- #undef _POINT_2
- #undef _SIZE_2
- #undef _RANGE_2
- #undef _SELECTION_2
- #undef _RECTANGLE_2
-
- #undef _SL_TYPE
-
- #ifdef __private
- #undef private
- #undef __private
- #endif
-
- #ifdef __protected
- #undef protected
- #undef __protected
- #endif
-
- #define _PAIR Pair
- #define _POINT Point
- #define _SIZE Size
- #define _RANGE Range
- #define _SELECTION Selection
- #define _RECTANGLE Rectangle
-
- #define _PAIR_2 LPair
- #define _POINT_2 LPoint
- #define _SIZE_2 LSize
- #define _RANGE_2 LRange
- #define _SELECTION_2 LSelection
- #define _RECTANGLE_2 LRectangle
-
- #define _SL_TYPE short
-
- #define RANGE_MIN ((short)0x8000)
- #define RANGE_MAX 0x7FFF
-
- #define SELECTION_MIN ((short)0x8000)
- #define SELECTION_MAX 0x7FFF
-
- inline _PAIR::_PAIR( _SL_TYPE _nA, _SL_TYPE _nB )
- {
- _PAIR::nA = _nA;
- _PAIR::nB = _nB;
- }
-
- inline _PAIR::_PAIR( const _PAIR_2& rPair )
- {
- nA = (_SL_TYPE)rPair.nA;
- nB = (_SL_TYPE)rPair.nB;
- }
-
- inline BOOL _PAIR::operator == ( const _PAIR& rPair ) const
- {
- if ( (nA == rPair.nA) && (nB == rPair.nB) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _PAIR::operator != ( const _PAIR& rPair ) const
- {
- if ( (nA != rPair.nA) || (nB != rPair.nB) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline _PAIR& _PAIR::operator = ( const _PAIR_2& rPair )
- {
- nA = (_SL_TYPE)rPair.nA;
- nB = (_SL_TYPE)rPair.nB;
- return *this;
- }
-
- inline _POINT::_POINT( _SL_TYPE nX, _SL_TYPE nY ) : _PAIR( nX, nY )
- {
- }
-
- inline _POINT::_POINT( const _POINT_2& rPoint ) : _PAIR( rPoint )
- {
- }
-
- inline _POINT& _POINT::operator += ( const _POINT& rPoint )
- {
- nA += rPoint.nA;
- nB += rPoint.nB;
- return *this;
- }
-
- inline _POINT& _POINT::operator -= ( const _POINT& rPoint )
- {
- nA -= rPoint.nA;
- nB -= rPoint.nB;
- return *this;
- }
-
- inline _POINT& _POINT::operator *= ( const _SL_TYPE nVal )
- {
- nA *= nVal;
- nB *= nVal;
- return *this;
- }
-
- inline _POINT& _POINT::operator /= ( const _SL_TYPE nVal )
- {
- nA /= nVal;
- nB /= nVal;
- return *this;
- }
-
- inline _POINT operator+( const _POINT &rVal1, const _POINT &rVal2 )
- {
- return _POINT( rVal1.nA+rVal2.nA, rVal1.nB+rVal2.nB );
- }
-
- inline _POINT operator-( const _POINT &rVal1, const _POINT &rVal2 )
- {
- return _POINT( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB );
- }
-
- inline _POINT operator*( const _POINT &rVal1, const _SL_TYPE nVal2 )
- {
- return _POINT( rVal1.nA*nVal2, rVal1.nB*nVal2 );
- }
-
- inline _POINT operator/( const _POINT &rVal1, const _SL_TYPE nVal2 )
- {
- return _POINT( rVal1.nA/nVal2, rVal1.nB/nVal2 );
- }
-
- inline BOOL _POINT::IsAbove( const _POINT& rPoint ) const
- {
- if ( nB > rPoint.nB )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _POINT::IsBelow( const _POINT& rPoint ) const
- {
- if ( nB < rPoint.nB )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _POINT::IsLeft( const _POINT& rPoint ) const
- {
- if ( nA < rPoint.nA )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _POINT::IsRight( const _POINT& rPoint ) const
- {
- if ( nA > rPoint.nA )
- return TRUE;
- else
- return FALSE;
- }
-
- inline _SIZE::_SIZE( _SL_TYPE nWidth, _SL_TYPE nHeight ) :
- _PAIR( nWidth, nHeight )
- {
- }
-
- inline _SIZE::_SIZE( const _SIZE_2& rSize ) : _PAIR( rSize )
- {
- }
-
- inline _RANGE::_RANGE( _SL_TYPE nMin, _SL_TYPE nMax ) : _PAIR( nMin, nMax )
- {
- }
-
- inline _RANGE::_RANGE( const _RANGE_2& rRange ) : _PAIR( rRange )
- {
- }
-
- inline BOOL _RANGE::IsInside( _SL_TYPE nIs ) const
- {
- if ( (nA <= nIs) && (nIs <= nB ) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline void _RANGE::Justify()
- {
- if ( nA > nB )
- {
- _SL_TYPE nHelp = nA;
- nA = nB;
- nB = nHelp;
- }
- }
-
- inline _SELECTION::_SELECTION( _SL_TYPE nPos ) : _PAIR( nPos, nPos )
- {
- }
-
- inline _SELECTION::_SELECTION( _SL_TYPE nMin, _SL_TYPE nMax ) :
- _PAIR( nMin, nMax )
- {
- }
-
- inline _SELECTION::_SELECTION( const _SELECTION_2& rSelection ) :
- _PAIR( rSelection )
- {
- }
-
- inline BOOL _SELECTION::IsInside( _SL_TYPE nIs ) const
- {
- if ( (nA <= nIs) && (nIs < nB ) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline void _SELECTION::Justify()
- {
- if ( nA > nB )
- {
- _SL_TYPE nHelp = nA;
- nA = nB;
- nB = nHelp;
- }
- }
-
- inline _RECTANGLE::_RECTANGLE( const _POINT& rLT, const _POINT& rRB )
- {
- nLeft = rLT.X();
- nTop = rLT.Y();
- nRight = rRB.X();
- nBottom = rRB.Y();
- }
-
- inline _RECTANGLE::_RECTANGLE( _SL_TYPE _nLeft, _SL_TYPE _nTop,
- _SL_TYPE _nRight, _SL_TYPE _nBottom )
- {
- _RECTANGLE::nLeft = _nLeft;
- _RECTANGLE::nTop = _nTop;
- _RECTANGLE::nRight = _nRight;
- _RECTANGLE::nBottom = _nBottom;
- }
-
- inline _RECTANGLE::_RECTANGLE( const _POINT& rLT, const _SIZE& rSize )
- {
- nLeft = rLT.X();
- nTop = rLT.Y();
- nRight = rSize.Width() ? nLeft+rSize.Width()-1 : RECT_EMPTY;
- nBottom = rSize.Height() ? nTop+rSize.Height()-1 : RECT_EMPTY;
- }
-
- inline _RECTANGLE::_RECTANGLE( const _RECTANGLE_2& rRect )
- {
- nLeft = (_SL_TYPE)rRect.nLeft;
- nTop = (_SL_TYPE)rRect.nTop;
- nRight = (_SL_TYPE)rRect.nRight;
- nBottom = (_SL_TYPE)rRect.nBottom;
- }
-
- inline _RECTANGLE& _RECTANGLE::operator = ( const _RECTANGLE_2& rRect )
- {
- nLeft = (_SL_TYPE)rRect.nLeft;
- nTop = (_SL_TYPE)rRect.nTop;
- nRight = (_SL_TYPE)rRect.nRight;
- nBottom = (_SL_TYPE)rRect.nBottom;
- return *this;
- }
-
- inline _POINT _RECTANGLE::TopLeft() const
- {
- return _POINT( nLeft, nTop );
- }
-
- inline _POINT _RECTANGLE::TopRight() const
- {
- return _POINT( (nRight == RECT_EMPTY) ? nLeft : nRight,
- nTop );
- }
-
- inline _POINT _RECTANGLE::BottomLeft() const
- {
- return _POINT( nLeft,
- (nBottom == RECT_EMPTY) ? nTop : nBottom );
- }
-
- inline _POINT _RECTANGLE::BottomRight() const
- {
- return _POINT( (nRight == RECT_EMPTY) ? nLeft : nRight,
- (nBottom == RECT_EMPTY) ? nTop : nBottom );
- }
-
- inline _SL_TYPE _RECTANGLE::GetWidth() const
- {
- _SL_TYPE n;
- if( nRight == RECT_EMPTY )
- n = 0;
- else
- {
- n = nRight - nLeft;
- if( n < 0 )
- n--;
- else
- n++;
- }
- return n;
- }
-
- inline _SL_TYPE _RECTANGLE::GetHeight() const
- {
- _SL_TYPE n;
- if( nBottom == RECT_EMPTY )
- n = 0;
- else
- {
- n = nBottom - nTop;
- if( n < 0 )
- n--;
- else
- n++;
- }
- return n;
- }
-
- inline _SIZE _RECTANGLE::GetSize() const
- {
- return _SIZE( GetWidth(), GetHeight() );
- }
-
- inline BOOL _RECTANGLE::IsEmpty() const
- {
- return nRight == RECT_EMPTY || nBottom == RECT_EMPTY;
- }
-
- inline BOOL _RECTANGLE::operator == ( const _RECTANGLE& rRect ) const
- {
- if ( (nLeft == rRect.nLeft ) &&
- (nTop == rRect.nTop ) &&
- (nRight == rRect.nRight ) &&
- (nBottom == rRect.nBottom ) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _RECTANGLE::operator != ( const _RECTANGLE& rRect ) const
- {
- if ( (nLeft != rRect.nLeft ) ||
- (nTop != rRect.nTop ) ||
- (nRight != rRect.nRight ) ||
- (nBottom != rRect.nBottom ) )
- return TRUE;
- else
- return FALSE;
- }
-
- #undef _PAIR
- #undef _POINT
- #undef _SIZE
- #undef _RANGE
- #undef _SELECTION
- #undef _RECTANGLE
-
- #undef _PAIR_2
- #undef _POINT_2
- #undef _SIZE_2
- #undef _RANGE_2
- #undef _SELECTION_2
- #undef _RECTANGLE_2
-
- #undef _SL_TYPE
-
- #ifdef __private
- #undef private
- #undef __private
- #endif
-
- #ifdef __protected
- #undef protected
- #undef __protected
- #endif
-
- #ifndef private
- #define private public
- #define __private
- #endif
-
- #ifndef protected
- #define protected public
- #define __protected
- #endif
-
- #define _PAIR LPair
- #define _POINT LPoint
- #define _SIZE LSize
- #define _RANGE LRange
- #define _SELECTION LSelection
- #define _RECTANGLE LRectangle
-
- #define _PAIR_2 Pair
- #define _POINT_2 Point
- #define _SIZE_2 Size
- #define _RANGE_2 Range
- #define _SELECTION_2 Selection
- #define _RECTANGLE_2 Rectangle
-
- #define _SL_TYPE long
-
- #define LRANGE_MIN ((long)0x80000000L)
- #define LRANGE_MAX 0x7FFFFFFFL
-
- #define LSELECTION_MIN ((long)0x80000000L)
- #define LSELECTION_MAX 0x7FFFFFFFL
-
- inline _PAIR::_PAIR( _SL_TYPE _nA, _SL_TYPE _nB )
- {
- _PAIR::nA = _nA;
- _PAIR::nB = _nB;
- }
-
- inline _PAIR::_PAIR( const _PAIR_2& rPair )
- {
- nA = (_SL_TYPE)rPair.nA;
- nB = (_SL_TYPE)rPair.nB;
- }
-
- inline BOOL _PAIR::operator == ( const _PAIR& rPair ) const
- {
- if ( (nA == rPair.nA) && (nB == rPair.nB) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _PAIR::operator != ( const _PAIR& rPair ) const
- {
- if ( (nA != rPair.nA) || (nB != rPair.nB) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline _PAIR& _PAIR::operator = ( const _PAIR_2& rPair )
- {
- nA = (_SL_TYPE)rPair.nA;
- nB = (_SL_TYPE)rPair.nB;
- return *this;
- }
-
- inline _POINT::_POINT( _SL_TYPE nX, _SL_TYPE nY ) : _PAIR( nX, nY )
- {
- }
-
- inline _POINT::_POINT( const _POINT_2& rPoint ) : _PAIR( rPoint )
- {
- }
-
- inline _POINT& _POINT::operator += ( const _POINT& rPoint )
- {
- nA += rPoint.nA;
- nB += rPoint.nB;
- return *this;
- }
-
- inline _POINT& _POINT::operator -= ( const _POINT& rPoint )
- {
- nA -= rPoint.nA;
- nB -= rPoint.nB;
- return *this;
- }
-
- inline _POINT& _POINT::operator *= ( const _SL_TYPE nVal )
- {
- nA *= nVal;
- nB *= nVal;
- return *this;
- }
-
- inline _POINT& _POINT::operator /= ( const _SL_TYPE nVal )
- {
- nA /= nVal;
- nB /= nVal;
- return *this;
- }
-
- inline _POINT operator+( const _POINT &rVal1, const _POINT &rVal2 )
- {
- return _POINT( rVal1.nA+rVal2.nA, rVal1.nB+rVal2.nB );
- }
-
- inline _POINT operator-( const _POINT &rVal1, const _POINT &rVal2 )
- {
- return _POINT( rVal1.nA-rVal2.nA, rVal1.nB-rVal2.nB );
- }
-
- inline _POINT operator*( const _POINT &rVal1, const _SL_TYPE nVal2 )
- {
- return _POINT( rVal1.nA*nVal2, rVal1.nB*nVal2 );
- }
-
- inline _POINT operator/( const _POINT &rVal1, const _SL_TYPE nVal2 )
- {
- return _POINT( rVal1.nA/nVal2, rVal1.nB/nVal2 );
- }
-
- inline BOOL _POINT::IsAbove( const _POINT& rPoint ) const
- {
- if ( nB > rPoint.nB )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _POINT::IsBelow( const _POINT& rPoint ) const
- {
- if ( nB < rPoint.nB )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _POINT::IsLeft( const _POINT& rPoint ) const
- {
- if ( nA < rPoint.nA )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _POINT::IsRight( const _POINT& rPoint ) const
- {
- if ( nA > rPoint.nA )
- return TRUE;
- else
- return FALSE;
- }
-
- inline _SIZE::_SIZE( _SL_TYPE nWidth, _SL_TYPE nHeight ) :
- _PAIR( nWidth, nHeight )
- {
- }
-
- inline _SIZE::_SIZE( const _SIZE_2& rSize ) : _PAIR( rSize )
- {
- }
-
- inline _RANGE::_RANGE( _SL_TYPE nMin, _SL_TYPE nMax ) : _PAIR( nMin, nMax )
- {
- }
-
- inline _RANGE::_RANGE( const _RANGE_2& rRange ) : _PAIR( rRange )
- {
- }
-
- inline BOOL _RANGE::IsInside( _SL_TYPE nIs ) const
- {
- if ( (nA <= nIs) && (nIs <= nB ) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline void _RANGE::Justify()
- {
- if ( nA > nB )
- {
- _SL_TYPE nHelp = nA;
- nA = nB;
- nB = nHelp;
- }
- }
-
- inline _SELECTION::_SELECTION( _SL_TYPE nPos ) : _PAIR( nPos, nPos )
- {
- }
-
- inline _SELECTION::_SELECTION( _SL_TYPE nMin, _SL_TYPE nMax ) :
- _PAIR( nMin, nMax )
- {
- }
-
- inline _SELECTION::_SELECTION( const _SELECTION_2& rSelection ) :
- _PAIR( rSelection )
- {
- }
-
- inline BOOL _SELECTION::IsInside( _SL_TYPE nIs ) const
- {
- if ( (nA <= nIs) && (nIs < nB ) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline void _SELECTION::Justify()
- {
- if ( nA > nB )
- {
- _SL_TYPE nHelp = nA;
- nA = nB;
- nB = nHelp;
- }
- }
-
- inline _RECTANGLE::_RECTANGLE( const _POINT& rLT, const _POINT& rRB )
- {
- nLeft = rLT.X();
- nTop = rLT.Y();
- nRight = rRB.X();
- nBottom = rRB.Y();
- }
-
- inline _RECTANGLE::_RECTANGLE( _SL_TYPE _nLeft, _SL_TYPE _nTop,
- _SL_TYPE _nRight, _SL_TYPE _nBottom )
- {
- _RECTANGLE::nLeft = _nLeft;
- _RECTANGLE::nTop = _nTop;
- _RECTANGLE::nRight = _nRight;
- _RECTANGLE::nBottom = _nBottom;
- }
-
- inline _RECTANGLE::_RECTANGLE( const _POINT& rLT, const _SIZE& rSize )
- {
- nLeft = rLT.X();
- nTop = rLT.Y();
- nRight = rSize.Width() ? nLeft+rSize.Width()-1 : RECT_EMPTY;
- nBottom = rSize.Height() ? nTop+rSize.Height()-1 : RECT_EMPTY;
- }
-
- inline _RECTANGLE::_RECTANGLE( const _RECTANGLE_2& rRect )
- {
- nLeft = (_SL_TYPE)rRect.nLeft;
- nTop = (_SL_TYPE)rRect.nTop;
- nRight = (_SL_TYPE)rRect.nRight;
- nBottom = (_SL_TYPE)rRect.nBottom;
- }
-
- inline _RECTANGLE& _RECTANGLE::operator = ( const _RECTANGLE_2& rRect )
- {
- nLeft = (_SL_TYPE)rRect.nLeft;
- nTop = (_SL_TYPE)rRect.nTop;
- nRight = (_SL_TYPE)rRect.nRight;
- nBottom = (_SL_TYPE)rRect.nBottom;
- return *this;
- }
-
- inline _POINT _RECTANGLE::TopLeft() const
- {
- return _POINT( nLeft, nTop );
- }
-
- inline _POINT _RECTANGLE::TopRight() const
- {
- return _POINT( (nRight == RECT_EMPTY) ? nLeft : nRight,
- nTop );
- }
-
- inline _POINT _RECTANGLE::BottomLeft() const
- {
- return _POINT( nLeft,
- (nBottom == RECT_EMPTY) ? nTop : nBottom );
- }
-
- inline _POINT _RECTANGLE::BottomRight() const
- {
- return _POINT( (nRight == RECT_EMPTY) ? nLeft : nRight,
- (nBottom == RECT_EMPTY) ? nTop : nBottom );
- }
-
- inline _SL_TYPE _RECTANGLE::GetWidth() const
- {
- _SL_TYPE n;
- if( nRight == RECT_EMPTY )
- n = 0;
- else
- {
- n = nRight - nLeft;
- if( n < 0 )
- n--;
- else
- n++;
- }
- return n;
- }
-
- inline _SL_TYPE _RECTANGLE::GetHeight() const
- {
- _SL_TYPE n;
- if( nBottom == RECT_EMPTY )
- n = 0;
- else
- {
- n = nBottom - nTop;
- if( n < 0 )
- n--;
- else
- n++;
- }
- return n;
- }
-
- inline _SIZE _RECTANGLE::GetSize() const
- {
- return _SIZE( GetWidth(), GetHeight() );
- }
-
- inline BOOL _RECTANGLE::IsEmpty() const
- {
- return nRight == RECT_EMPTY || nBottom == RECT_EMPTY;
- }
-
- inline BOOL _RECTANGLE::operator == ( const _RECTANGLE& rRect ) const
- {
- if ( (nLeft == rRect.nLeft ) &&
- (nTop == rRect.nTop ) &&
- (nRight == rRect.nRight ) &&
- (nBottom == rRect.nBottom ) )
- return TRUE;
- else
- return FALSE;
- }
-
- inline BOOL _RECTANGLE::operator != ( const _RECTANGLE& rRect ) const
- {
- if ( (nLeft != rRect.nLeft ) ||
- (nTop != rRect.nTop ) ||
- (nRight != rRect.nRight ) ||
- (nBottom != rRect.nBottom ) )
- return TRUE;
- else
- return FALSE;
- }
-
- #undef _PAIR
- #undef _POINT
- #undef _SIZE
- #undef _RANGE
- #undef _SELECTION
- #undef _RECTANGLE
-
- #undef _PAIR_2
- #undef _POINT_2
- #undef _SIZE_2
- #undef _RANGE_2
- #undef _SELECTION_2
- #undef _RECTANGLE_2
-
- #undef _SL_TYPE
-
- #ifdef __private
- #undef private
- #undef __private
- #endif
-
- #ifdef __protected
- #undef protected
- #undef __protected
- #endif
- #ifndef _GEN_HXX
- #define _GEN_HXX
- #endif
-
- #ifndef _GEN_HXX
- #define _GEN_HXX
-
- #endif
-
- #ifndef _BIGINT_HXX
- #define _BIGINT_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- class BigInt
- {
- private:
- long nVal;
- unsigned short nNum[8];
- char nLen;
- char nMaxLen;
- USHORT bIsNeg : 1,
- bIsLong : 1;
-
- public:
- BigInt();
- BigInt( short nVal );
- BigInt( long nVal );
- BigInt( int nVal );
- BigInt( USHORT nVal );
- BigInt( const BigInt& rBigInt );
-
- operator short() const;
- operator long() const;
- operator int() const;
- operator USHORT() const;
-
- BOOL IsNeg() const;
- BOOL IsZero() const;
- BOOL IsOne() const;
- void Abs();
-
- BigInt& operator =( const BigInt& rVal );
- BigInt& operator +=( const BigInt& rVal );
- BigInt& operator -=( const BigInt& rVal );
- BigInt& operator *=( const BigInt& rVal );
- BigInt& operator /=( const BigInt& rVal );
- BigInt& operator %=( const BigInt& rVal );
-
- #ifdef __BORLANDC__
- friend BigInt operator +( const BigInt& rVal1, const BigInt& rVal2 );
- friend BigInt operator -( const BigInt& rVal1, const BigInt& rVal2 );
- friend BigInt operator *( const BigInt& rVal1, const BigInt& rVal2 );
- friend BigInt operator /( const BigInt& rVal1, const BigInt& rVal2 );
- friend BigInt operator %( const BigInt& rVal1, const BigInt& rVal2 );
-
- friend BOOL operator==( const BigInt& rVal1, const BigInt& rVal2 );
- friend BOOL operator!=( const BigInt& rVal1, const BigInt& rVal2 );
- friend BOOL operator< ( const BigInt& rVal1, const BigInt& rVal2 );
- friend BOOL operator> ( const BigInt& rVal1, const BigInt& rVal2 );
- friend BOOL operator<=( const BigInt& rVal1, const BigInt& rVal2 );
- friend BOOL operator>=( const BigInt& rVal1, const BigInt& rVal2 );
- #else
- friend inline BigInt operator +( const BigInt& rVal1, const BigInt& rVal2 );
- friend inline BigInt operator -( const BigInt& rVal1, const BigInt& rVal2 );
- friend inline BigInt operator *( const BigInt& rVal1, const BigInt& rVal2 );
- friend inline BigInt operator /( const BigInt& rVal1, const BigInt& rVal2 );
- friend inline BigInt operator %( const BigInt& rVal1, const BigInt& rVal2 );
-
- friend BOOL operator==( const BigInt& rVal1, const BigInt& rVal2 );
- friend inline BOOL operator!=( const BigInt& rVal1, const BigInt& rVal2 );
- friend BOOL operator< ( const BigInt& rVal1, const BigInt& rVal2 );
- friend BOOL operator> ( const BigInt& rVal1, const BigInt& rVal2 );
- friend inline BOOL operator<=( const BigInt& rVal1, const BigInt& rVal2 );
- friend inline BOOL operator>=( const BigInt& rVal1, const BigInt& rVal2 );
- #endif
- };
-
- inline BigInt::BigInt()
- {
- bIsLong = FALSE;
- nVal = 0;
- }
-
- inline BigInt::BigInt( short nValue )
- {
- bIsLong = FALSE;
- nVal = nValue;
- }
-
- inline BigInt::BigInt( long nValue )
- {
- bIsLong = FALSE;
- nVal = nValue;
- }
-
- inline BigInt::BigInt( int nValue )
- {
- bIsLong = FALSE;
- nVal = nValue;
- }
-
- inline BigInt::BigInt( USHORT nValue )
- {
- bIsLong = FALSE;
- nVal = nValue;
- }
-
- inline BigInt::operator short() const
- {
- if ( !bIsLong && (nVal == (long)(short)nVal) )
- return (short)nVal;
- else
- return 0;
- }
-
- inline BigInt::operator long() const
- {
- if ( !bIsLong )
- return nVal;
- else
- return 0;
- }
-
- inline BigInt::operator int() const
- {
- if ( !bIsLong && (nVal == (long)(int)nVal) )
- return (int)nVal;
- else
- return 0;
- }
-
- inline BigInt::operator USHORT() const
- {
- if ( !bIsLong && (nVal == (long)(USHORT)nVal) )
- return (USHORT)nVal;
- else
- return 0;
- }
-
- inline BOOL BigInt::IsNeg() const
- {
- if ( !bIsLong )
- return (nVal < 0) ? TRUE : FALSE;
- else
- return (bIsNeg) ? TRUE : FALSE;
- }
-
- inline BOOL BigInt::IsZero() const
- {
- if ( bIsLong )
- return FALSE;
- else
- return (nVal == 0) ? TRUE : FALSE;
- }
-
- inline BOOL BigInt::IsOne() const
- {
- if ( bIsLong )
- return FALSE;
- else
- return (nVal == 1) ? TRUE : FALSE;
- }
-
- inline void BigInt::Abs()
- {
- if ( bIsLong )
- bIsNeg = FALSE;
- else if ( nVal < 0 )
- nVal = -nVal;
- }
-
- inline BigInt operator+( const BigInt &rVal1, const BigInt &rVal2 )
- {
- BigInt aErg( rVal1 );
- aErg += rVal2;
- return aErg;
- }
-
- inline BigInt operator-( const BigInt &rVal1, const BigInt &rVal2 )
- {
- BigInt aErg( rVal1 );
- aErg -= rVal2;
- return aErg;
- }
-
- inline BigInt operator*( const BigInt &rVal1, const BigInt &rVal2 )
- {
- BigInt aErg( rVal1 );
- aErg *= rVal2;
- return aErg;
- }
-
- inline BigInt operator/( const BigInt &rVal1, const BigInt &rVal2 )
- {
- BigInt aErg( rVal1 );
- aErg /= rVal2;
- return aErg;
- }
-
- inline BigInt operator%( const BigInt &rVal1, const BigInt &rVal2 )
- {
- BigInt aErg( rVal1 );
- aErg %= rVal2;
- return aErg;
- }
-
- inline BOOL operator!=( const BigInt& rVal1, const BigInt& rVal2 )
- {
- if ( rVal1 == rVal2 )
- return FALSE;
- else
- return TRUE;
- }
-
- inline BOOL operator<=( const BigInt& rVal1, const BigInt& rVal2 )
- {
- if ( rVal1 > rVal2 )
- return FALSE;
- else
- return TRUE;
- }
-
- inline BOOL operator>=( const BigInt& rVal1, const BigInt& rVal2 )
- {
- if ( rVal1 < rVal2 )
- return FALSE;
- else
- return TRUE;
- }
-
- #endif
-
- #ifndef _FRACT_HXX
- #define _FRACT_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- class Fraction
- {
- private:
- long nNumerator;
- long nDenominator;
-
- public:
- Fraction() { nNumerator = 0; nDenominator = 1; }
- Fraction( const Fraction & rFrac );
- Fraction( long nNum, long nDen=1 );
- Fraction( double dVal );
-
- BOOL IsValid() const;
-
- long GetNumerator() const { return nNumerator; }
- long GetDenominator() const { return nDenominator; }
-
- operator long() const;
- operator double() const;
-
- Fraction& operator=( const Fraction& rfrFrac );
-
- Fraction& operator+=( const Fraction& rfrFrac );
- Fraction& operator-=( const Fraction& rfrFrac );
- Fraction& operator*=( const Fraction& rfrFrac );
- Fraction& operator/=( const Fraction& rfrFrac );
-
- #ifdef __BORLANDC__
- friend Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 );
- friend Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 );
- friend Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 );
- friend Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 );
-
- friend BOOL operator==( const Fraction& rVal1, const Fraction& rVal2 );
- friend BOOL operator!=( const Fraction& rVal1, const Fraction& rVal2 );
- friend BOOL operator< ( const Fraction& rVal1, const Fraction& rVal2 );
- friend BOOL operator> ( const Fraction& rVal1, const Fraction& rVal2 );
- friend BOOL operator<=( const Fraction& rVal1, const Fraction& rVal2 );
- friend BOOL operator>=( const Fraction& rVal1, const Fraction& rVal2 );
- #else
- friend inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 );
-
- friend BOOL operator==( const Fraction& rVal1, const Fraction& rVal2 );
- friend BOOL operator!=( const Fraction& rVal1, const Fraction& rVal2 );
- friend BOOL operator< ( const Fraction& rVal1, const Fraction& rVal2 );
- friend BOOL operator> ( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline BOOL operator<=( const Fraction& rVal1, const Fraction& rVal2 );
- friend inline BOOL operator>=( const Fraction& rVal1, const Fraction& rVal2 );
- #endif
- };
-
- inline Fraction::Fraction( const Fraction& rFrac )
- {
- nNumerator = rFrac.nNumerator;
- nDenominator = rFrac.nDenominator;
- }
-
- inline Fraction& Fraction::operator=( const Fraction& rFrac )
- {
- nNumerator = rFrac.nNumerator;
- nDenominator = rFrac.nDenominator;
- return *this;
- }
-
- inline BOOL Fraction::IsValid() const
- {
- if ( nDenominator > 0 )
- return TRUE;
- else
- return FALSE;
- }
-
- inline Fraction::operator long() const
- {
- if ( nDenominator > 0 )
- return (nNumerator / nDenominator);
- else
- return 0;
- }
-
- inline Fraction operator+( const Fraction& rVal1, const Fraction& rVal2 )
- {
- Fraction aErg( rVal1 );
- aErg += rVal2;
- return aErg;
- }
-
- inline Fraction operator-( const Fraction& rVal1, const Fraction& rVal2 )
- {
- Fraction aErg( rVal1 );
- aErg -= rVal2;
- return aErg;
- }
-
- inline Fraction operator*( const Fraction& rVal1, const Fraction& rVal2 )
- {
- Fraction aErg( rVal1 );
- aErg *= rVal2;
- return aErg;
- }
-
- inline Fraction operator/( const Fraction& rVal1, const Fraction& rVal2 )
- {
- Fraction aErg( rVal1 );
- aErg /= rVal2;
- return aErg;
- }
-
- inline BOOL operator <=( const Fraction& rVal1, const Fraction& rVal2 )
- {
- if ( rVal1 > rVal2 )
- return FALSE;
- else
- return TRUE;
- }
-
- inline BOOL operator >=( const Fraction& rVal1, const Fraction& rVal2 )
- {
- if ( rVal1 < rVal2 )
- return FALSE;
- else
- return TRUE;
- }
-
- #endif
-
- #ifndef _STRING_HXX
- #define _STRING_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- class ResId;
-
- struct StringData
- {
- USHORT nLen;
- USHORT nRefCount;
- char aStr[1];
- };
-
- #define STRING_NOTFOUND ((USHORT)0xFFFF)
- #define STRING_MATCH ((USHORT)0xFFFF)
- #define STRING_LEN ((USHORT)0xFFFF)
- #define STRING_MAXLEN ((USHORT)0xFFFF-sizeof(StringData))
-
- enum CharSet { CHARSET_DONTKNOW, CHARSET_ANSI, CHARSET_MAC,
- CHARSET_IBMPC_437, CHARSET_IBMPC_850, CHARSET_IBMPC_860,
- CHARSET_IBMPC_861, CHARSET_IBMPC_863, CHARSET_IBMPC_865,
- CHARSET_SYSTEM, CHARSET_SYMBOL,
- CHARSET_IBMPC = CHARSET_IBMPC_850 };
- enum StringCompare { COMPARE_EQUAL, COMPARE_LESS, COMPARE_GREATER };
- enum LineEnd { LINEEND_CR, LINEEND_LF, LINEEND_CRLF };
-
- CharSet GetSystemCharSet();
- LineEnd GetSystemLineEnd();
- short svstrnicmp( const char* pStr1, const char* pStr2, USHORT nLen );
-
- class String
- {
- void InitStringRes( const char* pCharStr, USHORT nLen );
-
- private:
- StringData* pData;
-
- public:
- String();
- String( const ResId& rResId );
- String( const String& rStr );
- String( const String& rStr, USHORT nPos, USHORT nLen );
- String( const char* pCharStr );
- String( const char* pCharStr, USHORT nLen );
- String( char c );
- String( int n );
- String( unsigned int n );
- String( short n );
- String( USHORT n );
- String( long n );
- String( ULONG n );
- ~String();
-
- operator const char*() const { return pData->aStr; }
- operator char() const { return pData->aStr[0]; }
- operator int() const;
- operator unsigned int() const;
- operator short() const;
- operator USHORT() const;
- operator long() const;
- operator ULONG() const;
-
- String& operator = ( const String& rStr );
- String& operator = ( const char* pCharStr );
-
- String& operator += ( const String& rStr );
- String& operator += ( const char* pCharStr );
- String& operator += ( char c );
- String& operator += ( int n );
- String& operator += ( unsigned int n );
- String& operator += ( short n );
- String& operator += ( USHORT n );
- String& operator += ( long n );
- String& operator += ( ULONG n );
-
- BOOL operator ! () const { return !pData->nLen; }
-
- char& operator [] ( USHORT nIndex );
- char operator [] ( USHORT nIndex ) const
- { return pData->aStr[nIndex]; }
-
- String operator() ( USHORT n1, USHORT n2 ) const
- { return Copy( n1, n2 ); }
- char& operator() ( USHORT n )
- { return String::operator[](n); }
-
- USHORT Len() const { return pData->nLen; }
-
- String& Insert( const String& rStr, USHORT nIndex = STRING_LEN );
- String& Insert( const String& rStr, USHORT nPos, USHORT nLen,
- USHORT nIndex = STRING_LEN );
- String& Insert( const char* pCharStr, USHORT nIndex = STRING_LEN );
- String& Insert( char c, USHORT nIndex = STRING_LEN );
- String& Replace( const String& rStr, USHORT nIndex = 0 );
- String& Erase( USHORT nIndex = 0, USHORT nCount = STRING_LEN );
- String Cut( USHORT nIndex = 0, USHORT nCount = STRING_LEN );
- String Copy( USHORT nIndex = 0, USHORT nCount = STRING_LEN ) const;
-
- String& Fill( USHORT nCount, char cFillChar = ' ' );
- String& Expand( USHORT nCount, char cExpandChar = ' ' );
- String& EraseLeadingChars( char c = ' ' );
- String& EraseTrailingChars( char c = ' ' );
- String& EraseAllChars( char c = ' ' );
- String& Reverse();
-
- String& Convert( CharSet eSource,
- CharSet eTarget = CHARSET_SYSTEM );
- static char Convert( char c, CharSet eSource,
- CharSet eTarget = CHARSET_SYSTEM );
- String& ConvertLineEnd();
- String& ConvertLineEnd( LineEnd eLineEnd );
-
- BOOL IsPrintable( CharSet eCharSet = CHARSET_SYSTEM ) const;
- static BOOL IsPrintable( char c, CharSet eCharSet = CHARSET_SYSTEM );
-
- String& SpaceToZero();
- String& ZeroToSpace();
-
- String& ToUpper();
- String& ToLower();
-
- String Upper() const;
- String Lower() const;
-
- BOOL IsUpper() const;
- BOOL IsLower() const;
- BOOL IsAlpha() const;
- BOOL IsNumeric() const;
- BOOL IsAlphaNumeric() const;
-
- StringCompare Compare( const String& rStr,
- USHORT nLen = STRING_LEN ) const;
- StringCompare Compare( const char* pCharStr,
- USHORT nLen = STRING_LEN ) const;
- StringCompare ICompare( const String& rStr,
- USHORT nLen = STRING_LEN ) const;
- StringCompare ICompare( const char* pCharStr,
- USHORT nLen = STRING_LEN ) const;
-
- USHORT Match( const String& rStr ) const;
- USHORT Match( const char* pCharStr ) const;
-
- USHORT Search( const String& rStr, USHORT nIndex = 0 ) const;
- USHORT Search( const char* pCharStr, USHORT nIndex = 0 ) const;
- USHORT Search( char c, USHORT nIndex = 0 ) const;
-
- USHORT GetTokenCount( char cTok = ';' ) const;
- String GetToken( USHORT nToken, char cTok = ';' ) const;
-
- char* AllocStrBuf( USHORT nLen );
- const char* GetStr() const { return pData->aStr; }
-
- #ifdef __BORLANDC__
- friend String operator+( const String& rStr1, const String& rStr2 );
- friend String operator+( const String& rStr, const char* pCharStr );
- friend String operator+( const char* pCharStr, const String& rStr );
- #else
- friend inline String operator+( const String& rStr1, const String& rStr2 );
- friend inline String operator+( const String& rStr, const char* pCharStr );
- friend inline String operator+( const char* pCharStr, const String& rStr );
- #endif
-
- friend BOOL operator == ( const String& rStr1, const String& rStr2 );
- friend BOOL operator == ( const String& rStr, const char* pCharStr );
- friend BOOL operator == ( const char* pCharStr, const String& rStr );
- friend BOOL operator != ( const String& rStr1, const String& rStr2 );
- friend BOOL operator != ( const String& rStr, const char* pCharStr );
- friend BOOL operator != ( const char* pCharStr, const String& rStr );
- friend BOOL operator < ( const String& rStr1, const String& rStr2 );
- friend BOOL operator < ( const String& rStr, const char* pCharStr );
- friend BOOL operator < ( const char* pCharStr, const String& rStr );
- friend BOOL operator > ( const String& rStr1, const String& rStr2 );
- friend BOOL operator > ( const String& rStr, const char* pCharStr );
- friend BOOL operator > ( const char* pCharStr, const String& rStr );
- friend BOOL operator <= ( const String& rStr1, const String& rStr2 );
- friend BOOL operator <= ( const String& rStr, const char* pCharStr );
- friend BOOL operator <= ( const char* pCharStr, const String& rStr );
- friend BOOL operator >= ( const String& rStr1, const String& rStr2 );
- friend BOOL operator >= ( const String& rStr, const char* pCharStr );
- friend BOOL operator >= ( const char* pCharStr, const String& rStr );
- };
-
- inline String operator + ( const String& rStr1, const String& rStr2 )
- {
- String aTmpStr( rStr1 );
- aTmpStr += rStr2;
- return aTmpStr;
- }
-
- inline String operator + ( const String& rStr, const char* pCharStr )
- {
- String aTmpStr( rStr );
- aTmpStr += pCharStr;
- return aTmpStr;
- }
-
- inline String operator + ( const char* pCharStr, const String& rStr )
- {
- String aTmpStr( pCharStr );
- aTmpStr += rStr;
- return aTmpStr;
- }
-
- #endif
-
- #ifndef _MTF_HXX
- #define _MTF_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _LINK_HXX
- #endif
-
- #ifndef _STRING_HXX
- #endif
-
- class MetaFile;
- class ActionList;
- class LabelList;
-
- class MetaAction
- {
- private:
- USHORT nRefCount;
- USHORT nActionType;
-
- public:
- MetaAction();
- MetaAction( USHORT nType );
- virtual ~MetaAction();
-
- virtual void Execute( void* );
-
- USHORT GetType() const { return nActionType; }
-
- void Duplicate() { nRefCount++; }
- void Delete() { nRefCount--; if ( !nRefCount ) delete this; }
- };
-
- #define METAFILE_END ((ULONG)0xFFFFFFFF)
- #define METAFILE_LABEL_NOTFOUND ((ULONG)0xFFFFFFFF)
-
- class MetaFile
- {
- private:
- Link aHookHdlLink;
- void* pRecordObject;
- ActionList* pActionList;
- LabelList* pLabelList;
- BOOL bPause;
- BOOL bRecord;
-
- protected:
- virtual void Linker( void*, BOOL );
- virtual long Hook();
-
- public:
- MetaFile();
- MetaFile( const MetaFile& rMtf );
- virtual ~MetaFile();
-
- void AddAction( MetaAction* pAction );
-
- void Clear();
-
- void Record( void* pObj );
- void Play( void* pObj, ULONG nPos = METAFILE_END );
- void Play( MetaFile& rMtf, ULONG nPos = METAFILE_END );
- void Pause( BOOL bPaused );
- void Stop();
-
- BOOL IsRecord() const { return bRecord; }
- BOOL IsPause() const { return bPause; }
-
- void WindStart();
- void WindEnd();
- void Wind( ULONG nAction );
- void WindPrev();
- void WindNext();
-
- const MetaAction* GetCurAction() const;
- const MetaAction* GetAction( ULONG nAction ) const;
- ULONG GetActionCount() const;
-
- BOOL InsertLabel( const String& rLabel, ULONG nActionPos );
- void RemoveLabel( const String& rLabel );
- ULONG GetActionPos( const String& rLabel );
- String GetLabel( ULONG nLabel );
- ULONG GetLabelCount() const;
-
- Link ChangeHookHdl( const Link& rLink );
- Link GetHookHdl() const { return aHookHdlLink; }
-
- MetaFile& operator=( const MetaFile& rMtf );
- };
-
- inline Link MetaFile::ChangeHookHdl( const Link& rLink )
- {
- Link aOldLink = aHookHdlLink;
- aHookHdlLink = rLink;
- return aOldLink;
- }
-
- #endif
-
- #ifndef _CONTNR_HXX
- #define _CONTNR_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- class CBlock;
-
- #define CONTAINER_MAXBLOCKSIZE ((USHORT)0x3FF0)
-
- #define CONTAINER_APPEND ((ULONG)0xFFFFFFFF)
- #define CONTAINER_ENTRY_NOTFOUND ((ULONG)0xFFFFFFFF)
-
- class Container
- {
- private:
- CBlock* pFirstBlock;
- CBlock* pLastBlock;
- CBlock* pCurBlock;
- USHORT nCurIndex;
-
- USHORT nBlockSize;
- USHORT nInitSize;
- USHORT nReSize;
-
- ULONG nCount;
-
- protected:
- void ImpInsert( void* p, CBlock* pBlock, USHORT nIndex );
- void* ImpRemove( CBlock* pBlock, USHORT nIndex );
- void* ImpGetObject( ULONG nIndex ) const;
- void** GetObjectPtr( ULONG nIndex );
-
- public:
- Container( USHORT nBlockSize,
- USHORT nInitSize,
- USHORT nReSize );
- Container( ULONG nSize );
- Container( const Container& rContainer );
- ~Container();
-
- void Insert( void* p );
- void Insert( void* p, ULONG nIndex );
- void Insert( void* pNew, void* pOld );
-
- void* Remove();
- void* Remove( ULONG nIndex );
- void* Remove( void* p );
-
- void* Replace( void* p );
- void* Replace( void* p, ULONG nIndex );
- void* Replace( void* pNew, void* pOld );
-
- ULONG ChangeSize( ULONG nNewSize );
- ULONG GetSize() const { return nCount; }
-
- ULONG Count() const { return nCount; }
- void Clear();
-
- void* GetCurObject() const;
- ULONG GetCurPos() const;
- void* GetObject( ULONG nIndex ) const;
- ULONG GetPos( const void* p ) const;
-
- void* Seek( ULONG nIndex );
- void* Seek( void* p );
- void* First();
- void* Last();
- void* Next();
- void* Prev();
-
- Container& operator =( const Container& rContainer );
-
- BOOL operator ==( const Container& rContainer ) const;
- BOOL operator !=( const Container& rContainer ) const;
- };
-
- #endif
-
- #ifndef _LIST_HXX
- #define _LIST_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _CONTNR_HXX
- #endif
-
- #define LIST_APPEND CONTAINER_APPEND
- #define LIST_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND
-
- class List : private Container
- {
- public:
- List( USHORT _nInitSize = 16, USHORT _nReSize = 16 ) :
- Container( 1024, _nInitSize, _nReSize ) {}
- List( USHORT _nBlockSize, USHORT _nInitSize, USHORT _nReSize ) :
- Container( _nBlockSize, _nInitSize, _nReSize ) {}
- List( const List& rList ) : Container( rList ) {}
-
- void Insert( void* p )
- { Container::Insert( p ); }
- void Insert( void* p, ULONG nIndex )
- { Container::Insert( p, nIndex ); }
- void Insert( void* pNew, void* pOld )
- { Container::Insert( pNew, pOld ); }
-
- void* Remove()
- { return Container::Remove(); }
- void* Remove( ULONG nIndex )
- { return Container::Remove( nIndex ); }
- void* Remove( void* p )
- { return Container::Remove( p ); }
-
- void* Replace( void* p )
- { return Container::Replace( p ); }
- void* Replace( void* p, ULONG nIndex )
- { return Container::Replace( p, nIndex ); }
- void* Replace( void* pNew, void* pOld )
- { return Container::Replace( pNew, pOld ); }
-
- void Clear() { Container::Clear(); }
- ULONG Count() const { return Container::Count(); }
-
- void* GetCurObject() const
- { return Container::GetCurObject(); }
- ULONG GetCurPos() const
- { return Container::GetCurPos(); }
- void* GetObject( ULONG nIndex ) const
- { return Container::GetObject( nIndex ); }
- ULONG GetPos( const void* p ) const
- { return Container::GetPos( p ); }
-
- void* Seek( ULONG nIndex ) { return Container::Seek( nIndex ); }
- void* Seek( void* p ) { return Container::Seek( p ); }
- void* First() { return Container::First(); }
- void* Last() { return Container::Last(); }
- void* Next() { return Container::Next(); }
- void* Prev() { return Container::Prev(); }
-
- List& operator =( const List& rList )
- { Container::operator =( rList ); return *this; }
-
- BOOL operator ==( const List& rList ) const
- { return Container::operator ==( rList ); }
- BOOL operator !=( const List& rList ) const
- { return Container::operator !=( rList ); }
- };
-
- #define DECLARE_LIST( ClassName, Type ) \
- class ClassName : private List \
- { \
- public: \
- ClassName( USHORT _nInitSize = 16, \
- USHORT _nReSize = 16 ) : \
- List( _nInitSize, _nReSize ) {} \
- ClassName( USHORT _nBlockSize, USHORT _nInitSize, \
- USHORT _nReSize ) : \
- List( _nBlockSize, _nInitSize, _nReSize ) {} \
- ClassName( const ClassName& rClassName ) : \
- List( rClassName ) {} \
- \
- void Insert( Type p, ULONG nIndex ) \
- { List::Insert( (void*)p, nIndex ); } \
- void Insert( Type p ) \
- { List::Insert( (void*)p ); } \
- void Insert( Type pNew, Type pOld ) \
- { List::Insert( (void*)pNew, (void*)pOld ); } \
- Type Remove() \
- { return (Type)List::Remove(); } \
- Type Remove( ULONG nIndex ) \
- { return (Type)List::Remove( nIndex ); } \
- Type Remove( Type p ) \
- { return (Type)List::Remove( (void*)p ); } \
- Type Replace( Type p ) \
- { return (Type)List::Replace( (void*)p ); } \
- Type Replace( Type p, ULONG nIndex ) \
- { return (Type)List::Replace( (void*)p, nIndex ); } \
- Type Replace( Type pNew, Type pOld ) \
- { return (Type)List::Replace( (void*)pNew, \
- (void*)pOld ); } \
- \
- void Clear() { List::Clear(); } \
- ULONG Count() const { return List::Count(); } \
- \
- Type GetCurObject() const \
- { return (Type)List::GetCurObject(); } \
- ULONG GetCurPos() const \
- { return List::GetCurPos(); } \
- Type GetObject( ULONG nIndex ) const \
- { return (Type)List::GetObject( nIndex ); } \
- ULONG GetPos( Type p ) const \
- { return List::GetPos( (void*)p ); } \
- \
- Type Seek( ULONG nIndex ) \
- { return (Type)List::Seek( nIndex ); } \
- Type Seek( void* p ) { return (Type)List::Seek( p ); } \
- Type First() { return (Type)List::First(); } \
- Type Last() { return (Type)List::Last(); } \
- Type Next() { return (Type)List::Next(); } \
- Type Prev() { return (Type)List::Prev(); } \
- \
- ClassName& operator =( const ClassName& rClassName ) \
- { List::operator =( rClassName ); return *this; } \
- \
- BOOL operator ==( const ClassName& rList ) const \
- { return List::operator ==( rList ); } \
- BOOL operator !=( const ClassName& rList ) const \
- { return List::operator !=( rList ); } \
- };
-
- #endif
-
- #ifndef _STACK_HXX
- #define _STACK_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _CONTNR_HXX
- #endif
-
- #define STACK_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND
-
- class Stack : private Container
- {
- public:
- Stack( USHORT _nInitSize = 16, USHORT _nReSize = 16 ) :
- Container( CONTAINER_MAXBLOCKSIZE, _nInitSize, _nReSize ) {}
- Stack( const Stack& rStack ) : Container( rStack ) {}
-
- void Push( void* p ) { Container::Insert( p, CONTAINER_APPEND ); }
- void* Pop() { return Container::Remove( Count()-1 ); }
- void* Top() const { return Container::GetObject( Count()-1 ); }
-
- void Clear() { Container::Clear(); }
- ULONG Count() const { return Container::Count(); }
-
- void* GetObject( ULONG nIndex ) const
- { return Container::GetObject( nIndex ); }
- ULONG GetPos( const void* p ) const
- { return Container::GetPos( p ); }
-
- Stack& operator =( const Stack& rStack )
- { Container::operator =( rStack ); return *this; }
-
- BOOL operator ==( const Stack& rStack ) const
- { return Container::operator ==( rStack ); }
- BOOL operator !=( const Stack& rStack ) const
- { return Container::operator !=( rStack ); }
- };
-
- #define DECLARE_STACK( ClassName, Type ) \
- class ClassName : private Stack \
- { \
- public: \
- ClassName( USHORT _nInitSize = 16, \
- USHORT _nReSize = 16 ) : \
- Stack( _nInitSize, _nReSize ) {} \
- ClassName( const ClassName& rClassName ) : \
- Stack( rClassName ) {} \
- \
- void Push( Type p ) { Stack::Push( (void*)p ); } \
- Type Pop() { return (Type)Stack::Pop(); } \
- Type Top() const { return (Type)Stack::Top(); } \
- \
- void Clear() { Stack::Clear(); } \
- ULONG Count() const { return Stack::Count(); } \
- \
- Type GetObject( ULONG nIndex ) const \
- { return (Type)Stack::GetObject( nIndex ); } \
- ULONG GetPos( Type p ) const \
- { return Stack::GetPos( (void*)p ); } \
- \
- ClassName& operator =( const ClassName& rClassName ) \
- { Stack::operator =( rClassName ); \
- return *this; } \
- \
- BOOL operator ==( const ClassName& rStack ) const \
- { return Stack::operator ==( rStack ); } \
- BOOL operator !=( const ClassName& rStack ) const \
- { return Stack::operator !=( rStack ); } \
- };
-
- #endif
-
- #ifndef _TABLE_HXX
- #define _TABLE_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _CONTNR_HXX
- #endif
-
- #define TABLE_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND
-
- class Table : private Container
- {
- private:
- ULONG nCount;
-
- ULONG ImpGetIndex( ULONG nKey, ULONG* pIndex = NULL ) const;
-
- public:
- Table( USHORT nInitSize = 16, USHORT nReSize = 16 );
- Table( const Table& rTable ) : Container( rTable )
- { nCount = rTable.nCount; }
-
- BOOL Insert( ULONG nKey, void* p );
- void* Remove( ULONG nKey );
- void* Replace( ULONG nKey, void* p );
- void* Get( ULONG nKey ) const;
-
- void Clear() { Container::Clear(); nCount = 0; }
- ULONG Count() const { return( nCount ); }
-
- void* GetCurObject() const;
- ULONG GetCurKey() const;
- ULONG GetKey( const void* p ) const;
- BOOL IsKeyValid( ULONG nKey ) const;
-
- void* Seek( ULONG nKey );
- void* Seek( void* p );
- void* First();
- void* Last();
- void* Next();
- void* Prev();
-
- Table& operator =( const Table& rTable );
-
- BOOL operator ==( const Table& rTable ) const
- { return Container::operator ==( rTable ); }
- BOOL operator !=( const Table& rTable ) const
- { return Container::operator !=( rTable ); }
- };
-
- #define DECLARE_TABLE( ClassName, Type ) \
- class ClassName : private Table \
- { \
- public: \
- ClassName( USHORT _nInitSize = 16, \
- USHORT _nReSize = 16 ) : \
- Table( _nInitSize, _nReSize ) {} \
- ClassName( const ClassName& rClassName ) : \
- Table( rClassName ) {} \
- \
- BOOL Insert( ULONG nKey, Type p ) \
- { return Table::Insert( nKey, (void*)p ); } \
- Type Remove( ULONG nKey ) \
- { return (Type)Table::Remove( nKey ); } \
- Type Replace( ULONG nKey, Type p ) \
- { return (Type)Table::Replace( nKey, (void*)p ); } \
- Type Get( ULONG nKey ) const \
- { return (Type)Table::Get( nKey ); } \
- \
- void Clear() { Table::Clear(); } \
- ULONG Count() const { return Table::Count(); } \
- \
- Type GetCurObject() const \
- { return (Type)Table::GetCurObject(); } \
- ULONG GetCurKey() const { return Table::GetCurKey(); } \
- ULONG GetKey( Type p ) const \
- { return Table::GetKey( (void*)p ); } \
- BOOL IsKeyValid( ULONG nKey ) const \
- { return Table::IsKeyValid( nKey ); } \
- \
- Type Seek( ULONG nKey ) \
- { return (Type)Table::Seek( nKey ); } \
- Type Seek( Type p ) \
- { return (Type)Table::Seek( (void*)p ); } \
- Type First() { return (Type)Table::First(); } \
- Type Last() { return (Type)Table::Last(); } \
- Type Next() { return (Type)Table::Next(); } \
- Type Prev() { return (Type)Table::Prev(); } \
- \
- ClassName& operator =( const ClassName& rClassName ) \
- { Table::operator =( rClassName ); \
- return *this; } \
- \
- BOOL operator ==( const ClassName& rTable ) const \
- { return Table::operator ==( rTable ); } \
- BOOL operator !=( const ClassName& rTable ) const \
- { return Table::operator !=( rTable ); } \
- };
-
- #endif
-
- #ifndef _QUEUE_HXX
- #define _QUEUE_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _CONTNR_HXX
- #endif
-
- #define QUEUE_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND
-
- class Queue : private Container
- {
- public:
- Queue( USHORT _nInitSize = 16, USHORT _nReSize = 16 ) :
- Container( _nReSize, _nInitSize, _nReSize ) {}
- Queue( const Queue& rQueue ) : Container( rQueue ) {}
-
- void Put( void* p ) { Container::Insert( p, CONTAINER_APPEND ); }
- void* Get() { return Container::Remove( (ULONG)0 ); }
-
- void Clear() { Container::Clear(); }
- ULONG Count() const { return Container::Count(); }
-
- void* GetObject( ULONG nIndex ) const
- { return Container::GetObject( nIndex ); }
- ULONG GetPos( const void* p ) const
- { return Container::GetPos( p ); }
-
- Queue& operator =( const Queue& rQueue )
- { Container::operator =( rQueue ); return *this; }
-
- BOOL operator ==( const Queue& rQueue ) const
- { return Container::operator ==( rQueue ); }
- BOOL operator !=( const Queue& rQueue ) const
- { return Container::operator !=( rQueue ); }
- };
-
- #define DECLARE_QUEUE( ClassName, Type ) \
- class ClassName : private Queue \
- { \
- public: \
- ClassName( USHORT _nInitSize = 16, \
- USHORT _nReSize = 16 ) : \
- Queue( _nInitSize, _nReSize ) {} \
- ClassName( const ClassName& rClassName ) : \
- Queue( rClassName ) {} \
- \
- void Put( Type p ) { Queue::Put( (void*)p ); } \
- Type Get() { return (Type)Queue::Get(); } \
- \
- void Clear() { Queue::Clear(); } \
- ULONG Count() const { return Queue::Count(); } \
- \
- Type GetObject( ULONG nIndex ) const \
- { return (Type)Queue::GetObject( nIndex ); } \
- ULONG GetPos( void* p ) const \
- { return Queue::GetPos( (void*)p ); } \
- \
- ClassName& operator =( const ClassName& rClassName ) \
- { Queue::operator =( rClassName ); \
- return *this; } \
- \
- BOOL operator ==( const Queue& rQueue ) const \
- { return Queue::operator ==( rQueue ); } \
- BOOL operator !=( const Queue& rQueue ) const \
- { return Queue::operator !=( rQueue ); } \
- };
-
- #endif
-
- #ifndef _DYNARY_HXX
- #define _DYNARY_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _CONTNR_HXX
- #endif
-
- class DynArray : private Container
- {
- public:
- DynArray( ULONG nSize = 16 ) : Container( nSize ) {}
- DynArray( const DynArray& rAry ) : Container( rAry ) {}
-
- void* Put( ULONG nIndex, void* p )
- { return Container::Replace( p, nIndex ); }
- void* Get( ULONG nIndex ) const
- { return Container::GetObject( nIndex ); }
-
- ULONG ChangeSize( ULONG nNewSize )
- { return Container::ChangeSize( nNewSize ); }
- ULONG GetSize() const
- { return Container::GetSize(); }
- void Clear() { Container::Clear(); }
-
- DynArray& operator =( const DynArray& rAry )
- { Container::operator =( rAry ); return *this; }
-
- BOOL operator ==( const DynArray& rAry ) const
- { return Container::operator ==( rAry ); }
- BOOL operator !=( const DynArray& rAry ) const
- { return Container::operator !=( rAry ); }
- };
-
- #define DECLARE_DYNARRAY( ClassName, Type ) \
- class ClassName : private DynArray \
- { \
- public: \
- ClassName( ULONG nSize = 16 ) : \
- DynArray( nSize ) {} \
- ClassName( const ClassName& rClassName ) : \
- DynArray( rClassName ) {} \
- \
- Type Put( ULONG nIndex, Type p ) \
- { return (Type)DynArray::Put( nIndex, (void*)p ); } \
- Type Get( ULONG nIndex ) const \
- { return (Type)DynArray::Get( nIndex ); } \
- \
- ULONG ChangeSize( ULONG nNewSize ) \
- { return DynArray::ChangeSize( nNewSize ); } \
- ULONG GetSize() const \
- { return DynArray::GetSize(); } \
- void Clear() { DynArray::Clear(); } \
- \
- ClassName& operator =( const ClassName& rClassName ) \
- { DynArray::operator =( rClassName ); \
- return *this; } \
- \
- BOOL operator ==( const ClassName& rAry ) const \
- { return DynArray::operator ==( rAry ); } \
- BOOL operator !=( const ClassName& rAry ) const \
- { return DynArray::operator !=( rAry ); } \
- };
-
- #endif
-
- #ifndef _UNQIDX_HXX
- #define _UNQIDX_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _CONTNR_HXX
- #endif
-
- #define UNIQUEINDEX_ENTRY_NOTFOUND CONTAINER_ENTRY_NOTFOUND
-
- class UniqueIndex : private Container
- {
- private:
- ULONG nReSize;
- ULONG nStartIndex;
- ULONG nUniqIndex;
- ULONG nCount;
-
- public:
- UniqueIndex( ULONG nStartIndex = 0,
- ULONG nInitSize = 16,
- ULONG nReSize = 16 );
- UniqueIndex( const UniqueIndex& rIdx );
-
- ULONG Insert( void* p );
- void* Remove( ULONG nIndex );
- void* Replace( ULONG nIndex, void* p );
- void* Get( ULONG nIndex ) const;
-
- void Clear();
- ULONG Count() const { return nCount; }
-
- void* GetCurObject() const;
- ULONG GetCurIndex() const;
- ULONG GetIndex( const void* p ) const;
- BOOL IsIndexValid( ULONG nIndex ) const;
-
- void* Seek( ULONG nIndex );
- void* Seek( void* p );
- void* First();
- void* Last();
- void* Next();
- void* Prev();
-
- UniqueIndex& operator =( const UniqueIndex& rIdx );
-
- BOOL operator ==( const UniqueIndex& rIdx ) const;
- BOOL operator !=( const UniqueIndex& rIdx ) const;
- };
-
- #define DECLARE_UNIQUEINDEX( ClassName, Type ) \
- class ClassName : private UniqueIndex \
- { \
- public: \
- ClassName( ULONG _nStartIndex = 0, \
- ULONG _nInitSize = 16, ULONG _nReSize = 16 ):\
- UniqueIndex( _nStartIndex, _nInitSize, _nReSize ) {}\
- ClassName( const ClassName& rClassName ) : \
- UniqueIndex( rClassName ) {} \
- \
- ULONG Insert( Type p ) \
- { return UniqueIndex::Insert( (void*)p ); } \
- Type Remove( ULONG nIndex ) \
- { return (Type)UniqueIndex::Remove( nIndex ); } \
- Type Replace( ULONG nIndex, Type p ) \
- { return (Type)UniqueIndex::Replace( nIndex, \
- (void*)p ); } \
- Type Get( ULONG nIndex ) const \
- { return (Type)UniqueIndex::Get( nIndex ); } \
- \
- void Clear() { UniqueIndex::Clear(); } \
- ULONG Count() const { return UniqueIndex::Count(); } \
- \
- Type GetCurObject() const \
- { return (Type)UniqueIndex::GetCurObject(); } \
- ULONG GetCurIndex() const \
- { return UniqueIndex::GetCurIndex(); } \
- ULONG GetIndex( Type p ) const \
- { return UniqueIndex::GetIndex( (void*)p ); } \
- BOOL IsIndexValid( ULONG nIndex ) const \
- { return UniqueIndex::IsIndexValid( nIndex ); } \
- \
- Type Seek( ULONG nKey ) \
- { return (Type)UniqueIndex::Seek( nKey ); } \
- Type Seek( Type p ) \
- { return (Type)UniqueIndex::Seek( (void*)p ); } \
- Type First() { return (Type)UniqueIndex::First(); } \
- Type Last() { return (Type)UniqueIndex::Last(); } \
- Type Next() { return (Type)UniqueIndex::Next(); } \
- Type Prev() { return (Type)UniqueIndex::Prev(); } \
- \
- ClassName& operator =( const ClassName& rClassName ) \
- { UniqueIndex::operator =( rClassName ); \
- return *this; } \
- \
- BOOL operator ==( const ClassName& rIdx ) const \
- { return UniqueIndex::operator ==( rIdx ); } \
- BOOL operator !=( const ClassName& rIdx ) const \
- { return UniqueIndex::operator !=( rIdx ); } \
- };
-
- #endif
-
- #ifndef _DEBUG_HXX
- #define _DEBUG_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifdef DBG_UTIL
-
- typedef void (*DbgPrintLine)( const char* pLine );
- typedef const char* (*DbgUsr)(const void* pThis );
-
- #define DBG_TEST (0xFFFFFFFF)
- #define DBG_TEST_XTOR (0x00000001)
- #define DBG_TEST_CHKTHIS (0x00000002)
- #define DBG_TEST_CHKFUNC (0x00000004)
- #define DBG_TEST_CHKEXIT (0x00000008)
- #define DBG_TEST_XTOR_REPORT (0x00000010)
- #define DBG_TEST_ASSERT_ERROR (0x00000020)
- #define DBG_TEST_ASSERT_WARNING (0x00000040)
- #define DBG_TEST_PROFILING (0x00000100)
- #define DBG_TEST_RESOURCE (0x00000200)
-
- #define DBG_MEM (0xFFFFFFFF)
- #define DBG_MEM_INIT (0x00000001)
- #define DBG_MEM_OVERWRITE (0x00000002)
- #define DBG_MEM_POINTER (0x00000004)
- #define DBG_MEM_READONLY (0x00000008)
- #define DBG_MEM_REPORT (0x00000010)
-
- #define DBG_OUT_NULL 0
- #define DBG_OUT_FILE 1
- #define DBG_OUT_MSGBOX 2
- #define DBG_OUT_WINDOW 3
- #define DBG_OUT_SHELL 4
-
- #define DBGGUI_RESTORE 0
- #define DBGGUI_MINIMIZE 1
- #define DBGGUI_MAXIMIZE 2
-
- struct DbgGUIData
- {
- USHORT nX;
- USHORT nY;
- USHORT nDX;
- USHORT nDY;
- USHORT nShowStatus;
- };
-
- struct DbgData
- {
- ULONG nTestFlags;
- ULONG nMemFlags;
- ULONG nNewDelete;
- ULONG nEntryExit;
- ULONG bOverwrite;
- ULONG nTraceOut;
- ULONG nWarningOut;
- ULONG nErrorOut;
- DbgGUIData aGUIData;
- char aDebugName[260];
- };
-
- struct DbgDataType
- {
- void* pData;
- char* pName;
- };
-
- #define DBG_FUNC_DEBUGEND 1
- #define DBG_FUNC_SETPRINTMSGBOX 2
- #define DBG_FUNC_SETPRINTWINDOW 3
- #define DBG_FUNC_SETPRINTSHELL 4
- #define DBG_FUNC_GETDATA 5
- #define DBG_FUNC_SAVEDATA 6
-
- void* DbgFunc( USHORT nAction, void* pData = NULL );
-
- inline void DbgDebugEnd()
- {
- DbgFunc( DBG_FUNC_DEBUGEND );
- }
-
- inline void DbgSetPrintMsgBox( DbgPrintLine pProc )
- {
- DbgFunc( DBG_FUNC_SETPRINTMSGBOX, pProc );
- }
-
- inline void DbgSetPrintWindow( DbgPrintLine pProc )
- {
- DbgFunc( DBG_FUNC_SETPRINTWINDOW, pProc );
- }
-
- inline void DbgSetPrintShell( DbgPrintLine pProc )
- {
- DbgFunc( DBG_FUNC_SETPRINTSHELL, pProc );
- }
-
- inline DbgData* DbgGetData()
- {
- return (DbgData*)DbgFunc( DBG_FUNC_GETDATA );
- }
-
- inline void DbgSaveData( const DbgData& rData )
- {
- DbgFunc( DBG_FUNC_SAVEDATA, (void*)&rData );
- }
-
- inline ULONG DbgIsAssertWarning()
- {
- return DbgGetData()->nTestFlags & DBG_TEST_ASSERT_WARNING;
- }
-
- inline ULONG DbgIsAssert()
- {
- return DbgGetData()->nTestFlags & DBG_TEST_ASSERT_ERROR;
- }
-
- inline ULONG DbgIsMemTest()
- {
- return DbgGetData()->nMemFlags;
- }
-
- inline ULONG DbgIsResource()
- {
- return DbgGetData()->nTestFlags & DBG_TEST_RESOURCE;
- }
-
- #define DBG_OUT_TRACE 1
- #define DBG_OUT_WARNING 2
- #define DBG_OUT_ERROR 3
-
- void DbgOut( const char* pMsg, USHORT nOutType = DBG_OUT_TRACE,
- const char* pFile = NULL, USHORT nLine = 0 );
-
- void DbgOutf( const char* pFStr, ... );
-
- inline void DbgTrace( const char* pMsg,
- const char* pFile = NULL, USHORT nLine = 0 )
- {
- DbgOut( pMsg, DBG_OUT_TRACE, pFile, nLine );
- }
-
- inline void DbgWarning( const char* pMsg,
- const char* pFile = NULL, USHORT nLine = 0 )
- {
- DbgOut( pMsg, DBG_OUT_WARNING, pFile, nLine );
- }
-
- inline void DbgError( const char* pMsg,
- const char* pFile = NULL, USHORT nLine = 0 )
- {
- DbgOut( pMsg, DBG_OUT_ERROR, pFile, nLine );
- }
-
- #define DBG_PROF_START 1
- #define DBG_PROF_STOP 2
- #define DBG_PROF_CONTINUE 3
- #define DBG_PROF_PAUSE 4
-
- void DbgProf( USHORT nAction, DbgDataType* );
-
- #define DBG_XTOR_CTOR 1
- #define DBG_XTOR_DTOR 2
- #define DBG_XTOR_CHKTHIS 3
- #define DBG_XTOR_CHKOBJ 4
- #define DBG_XTOR_DTOROBJ 0x8000
-
- void DbgXtor( DbgDataType* pDbgData,
- USHORT nAction, const void* pThis, DbgUsr fDbgUsr );
-
- class DbgXtorObj
- {
- private:
- DbgDataType* pDbgData;
- const void* pThis;
- DbgUsr fDbgUsr;
- USHORT nAction;
-
- public:
- DbgXtorObj( DbgDataType* pData,
- USHORT nAct, const void* pThs, DbgUsr fUsr )
- {
- DbgXtor( pData, nAct, pThs, fUsr );
- pDbgData = pData;
- nAction = nAct;
- pThis = pThs;
- fDbgUsr = fUsr;
- }
-
- ~DbgXtorObj()
- {
- DbgXtor( pDbgData, nAction | DBG_XTOR_DTOROBJ,
- pThis, fDbgUsr );
- }
- };
-
- #define DBG_PRAE( aName ) __DbgName_##aName
- #define DBG_NAME( aName ) DbgDataType DBG_PRAE( aName ) = { 0, #aName }
- #define DBG_NAMEEX( aName ) extern DbgDataType DBG_PRAE( aName )
-
- #if defined( W30 ) && (defined( __SC__ ) || defined( _MSC_VER ))
- #define DBG_DEFTEXT static const char _far _pText[]
- #define DBG_DEFFILE static const char _far _pFile[]
- #else
- #define DBG_DEFTEXT static const char* _pText
- #define DBG_DEFFILE static const char* _pFile
- #endif
-
- #define DBG_DEBUGEND() DbgDebugEnd()
-
- #define DBG_PROFSTART( aName ) \
- DbgProf( DBG_PROF_START, \
- &DBG_PRAE(aName ) )
-
- #define DBG_PROFSTOP( aName ) \
- DbgProf( DBG_PROF_STOP, \
- &DBG_PRAE(aName ) )
-
- #define DBG_PROFCONTINUE( aName ) \
- DbgProf( DBG_PROF_CONTINUE, \
- &DBG_PRAE(aName ) )
-
- #define DBG_PROFPAUSE( aName ) \
- DbgProf( DBG_PROF_PAUSE, \
- &DBG_PRAE(aName ) )
-
- #define DBG_CTOR( aName, fTest ) \
- DbgXtorObj aDbgXtorObj( &DBG_PRAE( aName ), \
- DBG_XTOR_CTOR, \
- (const void*)this, \
- fTest )
-
- #define DBG_DTOR( aName, fTest ) \
- DbgXtorObj aDbgXtorObj( &DBG_PRAE( aName ), \
- DBG_XTOR_DTOR, \
- (const void*)this, \
- fTest )
-
- #define DBG_CHKTHIS( aName, fTest ) \
- DbgXtorObj aDbgXtorObj( &DBG_PRAE( aName ), \
- DBG_XTOR_CHKTHIS, \
- (const void*)this, \
- fTest )
-
- #define DBG_CHKOBJ( pObj, aName, fTest ) \
- DbgXtor( &DBG_PRAE( aName ), DBG_XTOR_CHKOBJ, \
- (const void*)pObj, (DbgUsr)fTest )
-
- #define DBG_ASSERTWARNING( sCon, aWarning ) \
- { \
- if ( DbgIsAssertWarning() ) \
- { \
- if ( !( sCon ) ) \
- { \
- DBG_DEFTEXT = aWarning; \
- DBG_DEFFILE = __FILE__; \
- DbgWarning( _pText, \
- _pFile, __LINE__ ); \
- } \
- } \
- }
-
- #define DBG_ASSERT( sCon, aError ) \
- { \
- if ( DbgIsAssert() ) \
- { \
- if ( !( sCon ) ) \
- { \
- DBG_DEFTEXT = aError; \
- DBG_DEFFILE = __FILE__; \
- DbgError( _pText, \
- _pFile, __LINE__ ); \
- } \
- } \
- }
-
- #define DBG_TRACE( aTrace ) \
- { \
- DbgTrace( aTrace ); \
- }
-
- #define DBG_WARNING( aWarning ) \
- { \
- DbgWarning( aWarning ); \
- }
-
- #define DBG_ERROR( aError ) \
- { \
- DbgError( aError ); \
- }
-
- #define DBG_WARNINGFILE( aWarning ) \
- { \
- DbgWarning( aWarning, __FILE__, __LINE__ ); \
- }
-
- #define DBG_ERRORFILE( aError ) \
- { \
- DbgError( aError, __FILE__, __LINE__ ); \
- }
-
- #define DBG_INSTASSERT( bOn ) \
- { \
- if ( bOn ) \
- DbgGetData()->nTestFlags |= DBG_TEST_ASSERT_ERROR; \
- else \
- DbgGetData()->nTestFlags &= ~DBG_TEST_ASSERT_ERROR; \
- }
-
- #define DBG_INSTASSERTWARNING( bOn ) \
- { \
- if ( bOn ) \
- DbgGetData()->nTestFlags |= DBG_TEST_ASSERT_WARNING; \
- else \
- DbgGetData()->nTestFlags &= ~DBG_TEST_ASSERT_WARNING; \
- }
-
- #define DBG_INSTOUTTRACE( nOut ) \
- { \
- DbgGetData()->nTraceOut = nOut; \
- }
-
- #define DBG_INSTOUTWARNING( nOut ) \
- { \
- DbgGetData()->nWarningOut = nOut; \
- }
-
- #define DBG_INSTOUTERROR( nOut ) \
- { \
- DbgGetData()->nErrorOut = nOut; \
- }
-
- #else
-
- struct DbgData;
- struct DbgGUIData;
- struct DbgDataType;
-
- typedef void (*DbgPrintLine)( const char* pLine );
- typedef const char* (*DbgUsr)(const void* pThis );
-
- #define DBG_DEBUGEND()
-
- #define DBG_NAME( aName )
- #define DBG_NAMEEX( aName )
-
- #define DBG_PROFSTART( aName )
- #define DBG_PROFSTOP( aName )
- #define DBG_PROFCONTINUE( aName )
- #define DBG_PROFPAUSE( aName )
-
- #define DBG_CTOR( aName, fTest )
- #define DBG_DTOR( aName, fTest )
- #define DBG_CHKTHIS( aName, fTest )
- #define DBG_CHKOBJ( pObj, aName, fTest )
-
- #define DBG_ASSERTWARNING( sCon, aWarning )
- #define DBG_ASSERT( sCon, aError )
- #define DBG_TRACE( aTrace )
- #define DBG_WARNING( aWarning )
- #define DBG_ERROR( aError )
- #define DBG_WARNINGFILE( aWarning )
- #define DBG_ERRORFILE( aError )
-
- #define DBG_INSTASSERT( bOn )
- #define DBG_INSTASSERTWARNING( bOn )
-
- #define DBG_INSTOUTTRACE( nOut )
- #define DBG_INSTOUTWARNING( nOut )
- #define DBG_INSTOUTERROR( nOut )
-
- #endif
-
- #endif
-
- #ifndef _DATE_HXX
- #define _DATE_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- class ResId;
-
- enum DayOfWeek { MONDAY, TUESDAY, WEDNESDAY, THURSDAY,
- FRIDAY, SATURDAY, SUNDAY };
-
- class Date
- {
- private:
- ULONG nDate;
-
- public:
- Date();
- Date( const ResId & rResId );
- Date( ULONG _nDate ) { Date::nDate = _nDate; }
- Date( const Date& rDate )
- { nDate = rDate.nDate; }
- Date( USHORT nDay, USHORT nMonth, USHORT nYear )
- { nDate = ((ULONG)(nDay%100)) +
- (((ULONG)(nMonth%100))*100) +
- (((ULONG)nYear%10000)*10000); }
-
- ULONG ChangeDate( ULONG nNewDate )
- { ULONG nOldDate = nDate; nDate = nNewDate;
- return nOldDate; }
- ULONG GetDate() const { return nDate; }
-
- USHORT ChangeDay( USHORT nNewDay );
- USHORT ChangeMonth( USHORT nNewMonth );
- USHORT ChangeYear( USHORT nNewYear );
- USHORT GetDay() const { return (USHORT)(nDate % 100); }
- USHORT GetMonth() const { return (USHORT)((nDate / 100) % 100); }
- USHORT GetYear() const { return (USHORT)(nDate / 10000); }
-
- DayOfWeek GetDayOfWeek() const;
- USHORT GetDayOfYear() const;
- USHORT GetWeekOfYear() const;
-
- USHORT GetDaysInMonth() const;
- USHORT GetDaysInYear() const { return (IsLeapYear()) ? 366 : 365; }
- BOOL IsLeapYear() const;
- BOOL IsValid() const;
-
- BOOL IsBetween( const Date& rFrom, const Date& rTo ) const
- { return ((nDate >= rFrom.nDate) &&
- (nDate <= rTo.nDate)); }
-
- friend BOOL operator ==( const Date& rDate1, const Date& rDate2 )
- { return (rDate1.nDate == rDate2.nDate); }
- friend BOOL operator !=( const Date& rDate1, const Date& rDate2 )
- { return (rDate1.nDate != rDate2.nDate); }
- friend BOOL operator >( const Date& rDate1, const Date& rDate2 )
- { return (rDate1.nDate > rDate2.nDate); }
- friend BOOL operator <( const Date& rDate1, const Date& rDate2 )
- { return (rDate1.nDate < rDate2.nDate); }
- friend BOOL operator >=( const Date& rDate1, const Date& rDate2 )
- { return (rDate1.nDate >= rDate2.nDate); }
- friend BOOL operator <=( const Date& rDate1, const Date& rDate2 )
- { return (rDate1.nDate <= rDate2.nDate); }
-
- Date& operator =( const Date& rDate )
- { nDate = rDate.nDate; return *this; }
- Date& operator +=( ULONG nDays );
- Date& operator -=( ULONG nDays );
- Date& operator ++();
- Date& operator --();
- #ifndef SUN
- #ifndef MPW33
- Date operator ++( int );
- Date operator --( int );
- #endif
- #endif
-
- friend Date operator +( const Date& rDate, ULONG nDays );
- friend Date operator -( const Date& rDate, ULONG nDays );
- friend ULONG operator -( const Date& rDate1, const Date& rDate2 );
- };
-
- #endif
-
- #ifndef _TIME_HXX
- #define _TIME_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- class ResId;
-
- class Time
- {
- private:
- long nTime;
-
- public:
- Time();
- Time( const ResId & rResId );
- Time( long _nTime ) { Time::nTime = _nTime; }
- Time( const Time& rTime )
- { nTime = rTime.nTime; }
- Time( USHORT nHour, USHORT nMin,
- USHORT nSec = 0, USHORT n100Sec = 0 );
-
- long ChangeTime( long nNewTime )
- { long nOldTime = nTime; nTime = nNewTime;
- return nOldTime; }
- long GetTime() const { return nTime; }
-
- USHORT ChangeHour( USHORT nNewHour );
- USHORT ChangeMin( USHORT nNewMin );
- USHORT ChangeSec( USHORT nNewSec );
- USHORT Change100Sec( USHORT nNew100Sec );
- USHORT GetHour() const
- { ULONG nTempTime = (nTime >= 0) ? nTime : nTime*-1;
- return (USHORT)(nTempTime / 1000000); }
- USHORT GetMin() const
- { ULONG nTempTime = (nTime >= 0) ? nTime : nTime*-1;
- return (USHORT)((nTempTime / 10000) % 100); }
- USHORT GetSec() const
- { ULONG nTempTime = (nTime >= 0) ? nTime : nTime*-1;
- return (USHORT)((nTempTime / 100) % 100); }
- USHORT Get100Sec() const
- { ULONG nTempTime = (nTime >= 0) ? nTime : nTime*-1;
- return (USHORT)(nTempTime % 100); }
-
- BOOL IsBetween( const Time& rFrom, const Time& rTo ) const
- { return ((nTime >= rFrom.nTime) && (nTime <= rTo.nTime)); }
-
- friend BOOL operator ==( const Time& rTime1, const Time& rTime2 )
- { return (rTime1.nTime == rTime2.nTime); }
- friend BOOL operator !=( const Time& rTime1, const Time& rTime2 )
- { return (rTime1.nTime != rTime2.nTime); }
- friend BOOL operator >( const Time& rTime1, const Time& rTime2 )
- { return (rTime1.nTime > rTime2.nTime); }
- friend BOOL operator <( const Time& rTime1, const Time& rTime2 )
- { return (rTime1.nTime < rTime2.nTime); }
- friend BOOL operator >=( const Time& rTime1, const Time& rTime2 )
- { return (rTime1.nTime >= rTime2.nTime); }
- friend BOOL operator <=( const Time& rTime1, const Time& rTime2 )
- { return (rTime1.nTime <= rTime2.nTime); }
-
- Time& operator =( const Time& rTime )
- { nTime = rTime.nTime; return *this; }
- Time operator -() const
- { Time aTime; aTime.nTime = nTime*-1; return aTime; }
- Time& operator +=( const Time& rTime );
- Time& operator -=( const Time& rTime );
- friend Time operator +( const Time& rTime1, const Time& rTime2 );
- friend Time operator -( const Time& rTime1, const Time& rTime2 );
- };
-
- #endif
-
- #ifndef _DATETIME_HXX
- #define _DATETIME_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _DATE_HXX
- #endif
-
- #ifndef _TIME_HXX
- #endif
-
- class DateTime : public Date, public Time
- {
- public:
- DateTime() : Date(), Time() {}
- DateTime( const Date& rDate ) : Date( rDate ), Time() {}
- DateTime( const Time& rTime ) : Date(), Time( rTime ) {}
- DateTime( const Date& rDate, const Time& rTime ) :
- Date( rDate ), Time( rTime ) {}
-
- BOOL IsBetween( const DateTime& rFrom,
- const DateTime& rTo ) const;
-
- friend BOOL operator ==( const DateTime& rDateTime1,
- const DateTime& rDateTime2 )
- { return (((const Date&)rDateTime1) == ((const Date&)rDateTime2)) &&
- (((const Time&)rDateTime1) == ((const Time&)rDateTime2)); }
- friend BOOL operator !=( const DateTime& rDateTime1,
- const DateTime& rDateTime2 )
- { return (((const Date&)rDateTime1) != ((const Date&)rDateTime2)) ||
- (((const Time&)rDateTime1) != ((const Time&)rDateTime2)); }
- friend BOOL operator >( const DateTime& rDateTime1,
- const DateTime& rDateTime2 );
- friend BOOL operator <( const DateTime& rDateTime1,
- const DateTime& rDateTime2 );
- friend BOOL operator >=( const DateTime& rDateTime1,
- const DateTime& rDateTime2 );
- friend BOOL operator <=( const DateTime& rDateTime1,
- const DateTime& rDateTime2 );
- };
-
- #endif
-
- #ifndef _INTN_HXX
- #define _INTN_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _STRING_HXX
- #endif
-
- #ifndef _TIME_HXX
- #endif
-
- #ifndef _DATE_HXX
- #endif
-
- class ResId;
-
- enum LanguageType
- {
- LANGUAGE_DONTKNOW = 0x00FF,
- LANGUAGE_SYSTEM = 0x0000,
- LANGUAGE_ALBANIAN = 0x041c,
- LANGUAGE_ARABIC = 0x0401,
- LANGUAGE_BAHASA = 0x0421,
- LANGUAGE_BULGARIAN = 0x0402,
- LANGUAGE_CATALAN = 0x0403,
- LANGUAGE_CHINESE = 0x0004,
- LANGUAGE_CHINESE_TRADITIONAL = 0x0404,
- LANGUAGE_CHINESE_SIMPLIFIED = 0x0804,
- LANGUAGE_CZECH = 0x0405,
- LANGUAGE_DANISH = 0x0406,
- LANGUAGE_DUTCH = 0x0413,
- LANGUAGE_DUTCH_BELGIAN = 0x0813,
- LANGUAGE_ENGLISH = 0x0009,
- LANGUAGE_ENGLISH_US = 0x0409,
- LANGUAGE_ENGLISH_UK = 0x0809,
- LANGUAGE_ENGLISH_AUS = 0x0c09,
- LANGUAGE_ENGLISH_CAN = 0x1009,
- LANGUAGE_ENGLISH_NZ = 0x1409,
- LANGUAGE_ENGLISH_EIRE = 0x1809,
- LANGUAGE_FINNISH = 0x040b,
- LANGUAGE_FRENCH = 0x040c,
- LANGUAGE_FRENCH_BELGIAN = 0x080c,
- LANGUAGE_FRENCH_CANADIAN = 0x0c0c,
- LANGUAGE_FRENCH_SWISS = 0x100c,
- LANGUAGE_GERMAN = 0x0407,
- LANGUAGE_GERMAN_SWISS = 0x0807,
- LANGUAGE_GERMAN_AUSTRIAN = 0x1007,
- LANGUAGE_GREEK = 0x0408,
- LANGUAGE_HEBREW = 0x040d,
- LANGUAGE_HUNGARIAN = 0x040e,
- LANGUAGE_ICELANDIC = 0x040f,
- LANGUAGE_ITALIAN = 0x0410,
- LANGUAGE_ITALIAN_SWISS = 0x0810,
- LANGUAGE_JAPANESE = 0x0411,
- LANGUAGE_KOREAN = 0x0412,
- LANGUAGE_NORWEGIAN = 0x0014,
- LANGUAGE_NORWEGIAN_BOKMAL = 0x0414,
- LANGUAGE_NORWEGIAN_NYNORSK = 0x0814,
- LANGUAGE_POLISH = 0x0415,
- LANGUAGE_PORTUGUESE = 0x0816,
- LANGUAGE_PORTUGUESE_BRAZILIAN = 0x0416,
- LANGUAGE_RHAETO_ROMAN = 0x0417,
- LANGUAGE_ROMANIAN = 0x0418,
- LANGUAGE_RUSSIAN = 0x0419,
- LANGUAGE_SERBO_CROATIAN = 0x001a,
- LANGUAGE_SERBO_CROATIAN_CYRILLIC = 0x081a,
- LANGUAGE_SERBO_CROATIAN_LATIN = 0x041a,
- LANGUAGE_SLOVAK = 0x041b,
- LANGUAGE_SPANISH = 0x040a,
- LANGUAGE_SPANISH_MEXICAN = 0x080a,
- LANGUAGE_SPANISH_MODERN = 0x0c0a,
- LANGUAGE_SWEDISH = 0x041d,
- LANGUAGE_THAI = 0x041e,
- LANGUAGE_TURKISH = 0x041f,
- LANGUAGE_URDU = 0x0420,
- LANGUAGE_USER1 = 0x00E1,
- LANGUAGE_USER2 = 0x00E2,
- LANGUAGE_USER3 = 0x00E3,
- LANGUAGE_USER4 = 0x00E4,
- LANGUAGE_USER5 = 0x00E5,
- LANGUAGE_USER6 = 0x00E6,
- LANGUAGE_USER7 = 0x00E7,
- LANGUAGE_USER8 = 0x00E8,
- LANGUAGE_USER9 = 0x00E9
- };
-
- enum CountryType
- {
- COUNTRY_DONTKNOW = 0x00FF,
- COUNTRY_SYSTEM = 0x0000,
- COUNTRY_AUSTRALIA = 0x0401,
- COUNTRY_AUSTRIA = 0x0402,
- COUNTRY_BELGIUM = 0x0003,
- COUNTRY_BELGIUM_DUTCH = 0x0403,
- COUNTRY_BELGIUM_FRENCH = 0x0803,
- COUNTRY_BRAZIL = 0x0404,
- COUNTRY_CANADA = 0x0005,
- COUNTRY_CANADA_ENGLISH = 0x0405,
- COUNTRY_CANADA_FRENCH = 0x0805,
- COUNTRY_DENMARK = 0x0406,
- COUNTRY_FINLAND = 0x0407,
- COUNTRY_FRANCE = 0x0408,
- COUNTRY_GERMANY = 0x0409,
- COUNTRY_ICELAND = 0x040a,
- COUNTRY_IRELAND = 0x040b,
- COUNTRY_ITALY = 0x040c,
- COUNTRY_JAPAN = 0x040d,
- COUNTRY_MEXICO = 0x040e,
- COUNTRY_NETHERLANDS = 0x040f,
- COUNTRY_NEWZEALAND = 0x0410,
- COUNTRY_NORWAY = 0x0411,
- COUNTRY_PORTUGAL = 0x0412,
- COUNTRY_SOUTHKOREA = 0x0413,
- COUNTRY_SPAIN = 0x0414,
- COUNTRY_SWEDEN = 0x0415,
- COUNTRY_SWITZERLAND = 0x0016,
- COUNTRY_SWITZERLAND_FRENCH = 0x0416,
- COUNTRY_SWITZERLAND_GERMAN = 0x0816,
- COUNTRY_SWITZERLAND_ITALIAN = 0x0c16,
- COUNTRY_TAIWAN = 0x0417,
- COUNTRY_UNITEDKINGDOM = 0x0418,
- COUNTRY_UNITEDSTATES = 0x0419,
- COUNTRY_USER1 = 0x00E1,
- COUNTRY_USER2 = 0x00E2,
- COUNTRY_USER3 = 0x00E3,
- COUNTRY_USER4 = 0x00E4,
- COUNTRY_USER5 = 0x00E5,
- COUNTRY_USER6 = 0x00E6,
- COUNTRY_USER7 = 0x00E7,
- COUNTRY_USER8 = 0x00E8,
- COUNTRY_USER9 = 0x00E9
- };
-
- enum DateFormat { MDY, DMY, YMD };
- enum TimeFormat { HOUR_12, HOUR_24 };
- enum DayOfWeekFormat { DAYOFWEEK_NONE, DAYOFWEEK_SHORT, DAYOFWEEK_LONG };
- enum MonthFormat { MONTH_NORMAL, MONTH_ZERO, MONTH_SHORT, MONTH_LONG };
-
- typedef BOOL (*LanguageTestProc)( const String& rStr, CharSet eCharSet );
- typedef void (*LanguageUpLowProc)( String& rStr, CharSet eCharSet );
- typedef StringCompare (*LanguageCompareProc)( const String& rStr1, const String& rStr2,
- CharSet eCharSet );
-
- class LanguageTable
- {
- private:
- USHORT nRefCount;
- LanguageType eLanguage;
- LanguageUpLowProc pUpperProc;
- LanguageUpLowProc pLowerProc;
- LanguageTestProc pIsUpperProc;
- LanguageTestProc pIsLowerProc;
- LanguageTestProc pIsAlphaProc;
- LanguageTestProc pIsNumericProc;
- LanguageTestProc pIsAlphaNumericProc;
- LanguageCompareProc pCompareProc;
- String aDayText[7];
- String aAbbrevDayText[7];
- String aMonthText[12];
- String aAbbrevMonthText[12];
- String aOKButtonText;
- String aCancelButtonText;
- String aHelpButtonText;
-
- public:
- LanguageTable();
- LanguageTable( const LanguageTable& rTable );
- ~LanguageTable();
-
- void SetLanguage( LanguageType _eLanguage )
- { LanguageTable::eLanguage = _eLanguage; }
- LanguageType GetLanguage() const
- { return eLanguage; }
- void SetUpperProc( LanguageUpLowProc pProc )
- { LanguageTable::pUpperProc = pProc; }
- LanguageUpLowProc GetUpperProc() const
- { return pUpperProc; }
- void SetLowerProc( LanguageUpLowProc pProc )
- { LanguageTable::pLowerProc = pProc; }
- LanguageUpLowProc GetLowerProc() const
- { return pLowerProc; }
- void SetIsUpperProc( LanguageTestProc pProc )
- { LanguageTable::pIsUpperProc = pProc; }
- LanguageTestProc GetIsUpperProc() const
- { return pIsUpperProc; }
- void SetIsLowerProc( LanguageTestProc pProc )
- { LanguageTable::pIsLowerProc = pProc; }
- LanguageTestProc GetIsLowerProc() const
- { return pIsLowerProc; }
- void SetIsAlphaProc( LanguageTestProc pProc )
- { LanguageTable::pIsAlphaProc = pProc; }
- LanguageTestProc GetIsAlphaProc() const
- { return pIsAlphaProc; }
- void SetIsNumericProc( LanguageTestProc pProc )
- { LanguageTable::pIsNumericProc = pProc; }
- LanguageTestProc GetIsNumericProc() const
- { return pIsNumericProc; }
- void SetIsAlphaNumericProc( LanguageTestProc pProc )
- { LanguageTable::pIsAlphaNumericProc = pProc; }
- LanguageTestProc GetIsAlphaNumericProc() const
- { return pIsAlphaNumericProc; }
- void SetCompareProc( LanguageCompareProc pProc )
- { LanguageTable::pCompareProc = pProc; }
- LanguageCompareProc GetCompareProc() const
- { return pCompareProc; }
- void SetDayText( DayOfWeek eDay, const String& rText )
- { aDayText[(USHORT)eDay] = rText; }
- const String& GetDayText( DayOfWeek eDay ) const
- { return aDayText[(USHORT)eDay]; }
- void SetAbbrevDayText( DayOfWeek eDay, const String& rText )
- { aAbbrevDayText[(USHORT)eDay] = rText; }
- const String& GetAbbrevDayText( DayOfWeek eDay ) const
- { return aAbbrevDayText[(USHORT)eDay]; }
- void SetMonthText( USHORT nMonth, const String& rText )
- { aMonthText[nMonth-1] = rText; }
- const String& GetMonthText( USHORT nMonth ) const
- { return aMonthText[nMonth-1]; }
- void SetAbbrevMonthText( USHORT nMonth, const String& rText )
- { aAbbrevMonthText[nMonth-1] = rText; }
- const String& GetAbbrevMonthText( USHORT nMonth ) const
- { return aAbbrevMonthText[nMonth-1]; }
- void SetOKButtonText( const String& rText )
- { aOKButtonText = rText; }
- const String& GetOKButtonText() const
- { return aOKButtonText; }
- void SetCancelButtonText( const String& rText )
- { aCancelButtonText = rText; }
- const String& GetCancelButtonText() const
- { return aCancelButtonText; }
- void SetHelpButtonText( const String& rText )
- { aHelpButtonText = rText; }
- const String& GetHelpButtonText() const
- { return aHelpButtonText; }
-
- LanguageTable& operator=( const LanguageTable& rTable );
-
- BOOL operator==( const LanguageTable& rTable ) const;
- BOOL operator!=( const LanguageTable& rTable ) const;
- };
-
- class CountryTable
- {
- private:
- USHORT nRefCount;
- CountryType eCountry;
- DateFormat eDateFormat;
- char cDateSep;
- BOOL bDateDayLeadingZero;
- BOOL bDateMonthLeadingZero;
- BOOL bDateCentury;
- DateFormat eLongDateFormat;
- DayOfWeekFormat eLongDateDayOfWeekFormat;
- String aLongDateDayOfWeekSep;
- BOOL bLongDateDayLeadingZero;
- String aLongDateDaySep;
- MonthFormat eLongDateMonthFormat;
- String aLongDateMonthSep;
- BOOL bLongDateCentury;
- String aLongDateYearSep;
- TimeFormat eTimeFormat;
- char cTimeSep;
- char cTime100SecSep;
- BOOL bTimeLeadingZero;
- String aTimeAM;
- String aTimePM;
- char cNumThousandSep;
- BOOL bNumThousandSep;
- char cNumDecimalSep;
- BOOL bNumLeadingZero;
- USHORT nNumDigits;
- BOOL bNumTrailingZeros;
- USHORT nCurrPositiveFormat;
- USHORT nCurrNegativeFormat;
- String aCurrSymbol;
- USHORT nCurrDigits;
- char cCurrZeroChar;
- char cListSep;
-
- public:
- CountryTable();
- CountryTable( const CountryTable& rTable );
- ~CountryTable();
-
- void SetCountry( CountryType _eCountry )
- { CountryTable::eCountry = _eCountry; }
- CountryType GetCountry() const
- { return eCountry; }
- void SetDateFormat( DateFormat eFormat )
- { CountryTable::eDateFormat = eFormat; }
- DateFormat GetDateFormat() const
- { return eDateFormat; }
- void SetDateSep( char cSep )
- { CountryTable::cDateSep = cSep; }
- char GetDateSep() const
- { return cDateSep; }
- void SetDateDayLeadingZero( BOOL bLeading )
- { CountryTable::bDateDayLeadingZero = bLeading; }
- BOOL IsDateDayLeadingZero() const
- { return bDateDayLeadingZero; }
- void SetDateMonthLeadingZero( BOOL bLeading )
- { CountryTable::bDateMonthLeadingZero = bLeading; }
- BOOL IsDateMonthLeadingZero() const
- { return bDateMonthLeadingZero; }
- void SetDateCentury( BOOL bCentury )
- { CountryTable::bDateCentury = bCentury; }
- BOOL IsDateCentury() const
- { return bDateCentury; }
- void SetLongDateFormat( DateFormat eFormat )
- { CountryTable::eLongDateFormat = eFormat; }
- DateFormat GetLongDateFormat() const
- { return eLongDateFormat; }
- void SetLongDateDayOfWeekFormat( DayOfWeekFormat eFormat )
- { CountryTable::eLongDateDayOfWeekFormat = eFormat; }
- DayOfWeekFormat GetLongDateDayOfWeekFormat() const
- { return eLongDateDayOfWeekFormat; }
- void SetLongDateDayOfWeekSep( const String& rStr )
- { CountryTable::aLongDateDayOfWeekSep = rStr; }
- const String& GetLongDateDayOfWeekSep() const
- { return aLongDateDayOfWeekSep; }
- void SetLongDateDayLeadingZero( BOOL bLeading )
- { CountryTable::bLongDateDayLeadingZero = bLeading; }
- BOOL IsLongDateDayLeadingZero() const
- { return bLongDateDayLeadingZero; }
- void SetLongDateDaySep( const String& rStr )
- { CountryTable::aLongDateDaySep = rStr; }
- const String& GetLongDateDaySep() const
- { return aLongDateDaySep; }
- void SetLongDateMonthFormat( MonthFormat eFormat )
- { CountryTable::eLongDateMonthFormat = eFormat; }
- MonthFormat GetLongDateMonthFormat() const
- { return eLongDateMonthFormat; }
- void SetLongDateMonthSep( const String& rStr )
- { CountryTable::aLongDateMonthSep = rStr; }
- const String& GetLongDateMonthSep() const
- { return aLongDateMonthSep; }
- void SetLongDateCentury( BOOL bCentury )
- { CountryTable::bLongDateCentury = bCentury; }
- BOOL IsLongDateCentury() const
- { return bLongDateCentury; }
- void SetLongDateYearSep( const String& rStr )
- { CountryTable::aLongDateYearSep = rStr; }
- const String& GetLongDateYearSep() const
- { return aLongDateYearSep; }
- void SetTimeFormat( TimeFormat eFormat )
- { CountryTable::eTimeFormat = eFormat; }
- TimeFormat GetTimeFormat() const
- { return eTimeFormat; }
- void SetTimeSep( char cSep )
- { CountryTable::cTimeSep = cSep; }
- char GetTimeSep() const
- { return cTimeSep; }
- void SetTime100SecSep( char cSep )
- { CountryTable::cTime100SecSep = cSep; }
- char GetTime100SecSep() const
- { return cTime100SecSep; }
- void SetTimeLeadingZero( BOOL bLeading )
- { CountryTable::bTimeLeadingZero = bLeading; }
- BOOL IsTimeLeadingZero() const
- { return bTimeLeadingZero; }
- void SetTimeAM( const String& rStr )
- { CountryTable::aTimeAM = rStr; }
- const String& GetTimeAM() const
- { return aTimeAM; }
- void SetTimePM( const String& rStr )
- { CountryTable::aTimePM = rStr; }
- const String& GetTimePM() const
- { return aTimePM; }
- void SetNumThousandSep( char cSep )
- { CountryTable::cNumThousandSep = cSep; }
- char GetNumThousandSep() const
- { return cNumThousandSep; }
- void EnableNumThousandSep( BOOL bSep = TRUE )
- { CountryTable::bNumThousandSep = bSep; }
- BOOL IsNumThousandSep() const
- { return bNumThousandSep; }
- void SetNumDecimalSep( char cSep )
- { CountryTable::cNumDecimalSep = cSep; }
- char GetNumDecimalSep() const
- { return cNumDecimalSep; }
- void SetNumLeadingZero( BOOL bLeading )
- { CountryTable::bNumLeadingZero = bLeading; }
- BOOL IsNumLeadingZero() const
- { return bNumLeadingZero; }
- void SetNumDigits( USHORT nDigits )
- { CountryTable::nNumDigits = nDigits; }
- USHORT GetNumDigits() const
- { return nNumDigits; }
- void SetNumTrailingZeros( BOOL bTrailingZeros = TRUE )
- { CountryTable::bNumTrailingZeros = bTrailingZeros; }
- BOOL IsNumTrailingZeros() const
- { return bNumTrailingZeros; }
- void SetCurrPositiveFormat( USHORT nFormat )
- { CountryTable::nCurrPositiveFormat = nFormat; }
- USHORT GetCurrPositiveFormat() const
- { return nCurrPositiveFormat; }
- void SetCurrNegativeFormat( USHORT nFormat )
- { CountryTable::nCurrNegativeFormat = nFormat; }
- USHORT GetCurrNegativeFormat() const
- { return nCurrNegativeFormat; }
- void SetCurrSymbol( const String& rStr )
- { CountryTable::aCurrSymbol = rStr; }
- const String& GetCurrSymbol() const
- { return aCurrSymbol; }
- void SetCurrDigits( USHORT nDigits )
- { CountryTable::nCurrDigits = nDigits; }
- USHORT GetCurrDigits() const
- { return nCurrDigits; }
- void SetCurrZeroChar( char cZeroChar )
- { CountryTable::cCurrZeroChar = cZeroChar; }
- char GetCurrZeroChar() const
- { return cCurrZeroChar; }
- void SetListSep( char cSep )
- { CountryTable::cListSep = cSep; }
- char GetListSep() const
- { return cListSep; }
-
- CountryTable& operator=( const CountryTable& rTable );
-
- BOOL operator==( const CountryTable& rTable ) const;
- BOOL operator!=( const CountryTable& rTable ) const;
- };
-
- struct InternationalData
- {
- LanguageTable* pLanguage;
- CountryTable* pCountry;
- USHORT nRefCount;
- };
-
- #define INTERNATIONAL_SYSTEM_DEFAULT 0xFFFF
- void UpdateInternationalSystemTables();
- LanguageType GetSystemLanguage( USHORT nIndex = INTERNATIONAL_SYSTEM_DEFAULT );
- CountryType GetSystemCountry( USHORT nIndex = INTERNATIONAL_SYSTEM_DEFAULT );
-
- class International
- {
- void Init( LanguageType eLanguage, CountryType eCountry );
-
- private:
- InternationalData* pData;
-
- public:
- International();
- International( const ResId & rResId );
- International( const International& rIntn );
- International( CountryType eCountry,
- LanguageType eLanguage );
- ~International();
-
- LanguageType GetLanguage() const
- { return pData->pLanguage->GetLanguage(); }
- CountryType GetCountry() const
- { return pData->pCountry->GetCountry(); }
-
- String ChangeDayText( DayOfWeek eDay, const String& rStr );
- const String& GetDayText( DayOfWeek eDay ) const
- { return pData->pLanguage->GetDayText(eDay); }
- String ChangeAbbrevDayText( DayOfWeek eDay, const String& rStr );
- const String& GetAbbrevDayText( DayOfWeek eDay ) const
- { return pData->pLanguage->GetAbbrevDayText(eDay); }
- String ChangeMonthText( USHORT nMonth, const String& rStr );
- const String& GetMonthText( USHORT nMonth ) const
- { return pData->pLanguage->GetMonthText(nMonth); }
- String ChangeAbbrevMonthText( USHORT nMonth, const String& rStr );
- const String& GetAbbrevMonthText( USHORT nMonth ) const
- { return pData->pLanguage->GetAbbrevMonthText(nMonth); }
-
- String ChangeOKButtonText( const String& rStr );
- const String& GetOKButtonText() const
- { return pData->pLanguage->GetOKButtonText(); }
- String ChangeCancelButtonText( const String& rStr );
- const String& GetCancelButtonText() const
- { return pData->pLanguage->GetCancelButtonText(); }
- String ChangeHelpButtonText( const String& rStr );
- const String& GetHelpButtonText() const
- { return pData->pLanguage->GetHelpButtonText(); }
-
- void ToUpper( String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
- void ToLower( String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
-
- String Upper( const String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
- String Lower( const String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
-
- BOOL IsUpper( const String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
- BOOL IsLower( const String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
- BOOL IsAlpha( const String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
- BOOL IsNumeric( const String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
- BOOL IsAlphaNumeric( const String& rStr,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
-
- StringCompare Compare( const String& rStr1, const String& rStr2,
- CharSet eCharSet = CHARSET_SYSTEM ) const;
-
- DateFormat ChangeDateFormat( DateFormat eFormat );
- DateFormat GetDateFormat() const
- { return pData->pCountry->GetDateFormat(); }
- char ChangeDateSep( char cSep );
- char GetDateSep() const
- { return pData->pCountry->GetDateSep(); }
- BOOL ChangeDateDayLeadingZero( BOOL bLeading );
- BOOL IsDateDayLeadingZero() const
- { return pData->pCountry->IsDateDayLeadingZero(); }
- BOOL ChangeDateMonthLeadingZero( BOOL bLeading );
- BOOL IsDateMonthLeadingZero() const
- { return pData->pCountry->IsDateMonthLeadingZero(); }
- BOOL ChangeDateCentury( BOOL bCentury );
- BOOL IsDateCentury() const
- { return pData->pCountry->IsDateCentury(); }
- String GetDate( const Date& rDate ) const;
-
- DateFormat ChangeLongDateFormat( DateFormat eFormat );
- DateFormat GetLongDateFormat() const
- { return pData->pCountry->GetLongDateFormat(); }
- DayOfWeekFormat ChangeLongDateDayOfWeekFormat( DayOfWeekFormat eFormat );
- DayOfWeekFormat GetLongDateDayOfWeekFormat() const
- { return pData->pCountry->GetLongDateDayOfWeekFormat(); }
- String ChangeLongDateDayOfWeekSep( const String& rStr );
- const String& GetLongDateDayOfWeekSep() const
- { return pData->pCountry->GetLongDateDayOfWeekSep(); }
- BOOL ChangeLongDateDayLeadingZero( BOOL bLeading );
- BOOL IsLongDateDayLeadingZero() const
- { return pData->pCountry->IsLongDateDayLeadingZero(); }
- String ChangeLongDateDaySep( const String& rStr );
- const String& GetLongDateDaySep() const
- { return pData->pCountry->GetLongDateDaySep(); }
- MonthFormat ChangeLongDateMonthFormat( MonthFormat eFormat );
- MonthFormat GetLongDateMonthFormat() const
- { return pData->pCountry->GetLongDateMonthFormat(); }
- String ChangeLongDateMonthSep( const String& rStr );
- const String& GetLongDateMonthSep() const
- { return pData->pCountry->GetLongDateMonthSep(); }
- BOOL ChangeLongDateCentury( BOOL bCentury );
- BOOL IsLongDateCentury() const
- { return pData->pCountry->IsLongDateCentury(); }
- String ChangeLongDateYearSep( const String& rStr );
- const String& GetLongDateYearSep() const
- { return pData->pCountry->GetLongDateYearSep(); }
- String GetLongDate( const Date& rDate ) const;
-
- TimeFormat ChangeTimeFormat( TimeFormat eFormat );
- TimeFormat GetTimeFormat() const
- { return pData->pCountry->GetTimeFormat(); }
- char ChangeTimeSep( char cSep );
- char GetTimeSep() const
- { return pData->pCountry->GetTimeSep(); }
- char ChangeTime100SecSep( char cSep );
- char GetTime100SecSep() const
- { return pData->pCountry->GetTime100SecSep(); }
- BOOL ChangeTimeLeadingZero( BOOL bLeading );
- BOOL IsTimeLeadingZero() const
- { return pData->pCountry->IsTimeLeadingZero(); }
- String ChangeTimeAM( const String& rStr );
- const String& GetTimeAM() const
- { return pData->pCountry->GetTimeAM(); }
- String ChangeTimePM( const String& rStr );
- const String& GetTimePM() const
- { return pData->pCountry->GetTimePM(); }
- String GetDuration( const Time& rTime,
- BOOL bSec = TRUE, BOOL b100Sec = FALSE ) const;
- String GetTime( const Time& rTime,
- BOOL bSec = TRUE, BOOL b100Sec = FALSE ) const;
-
- char ChangeNumThousandSep( char cSep );
- char GetNumThousandSep() const
- { return pData->pCountry->GetNumThousandSep(); }
- void EnableNumThousandSep( BOOL bSep = TRUE );
- BOOL IsNumThousandSep() const
- { return pData->pCountry->IsNumThousandSep(); }
- char ChangeNumDecimalSep( char cSep );
- char GetNumDecimalSep() const
- { return pData->pCountry->GetNumDecimalSep(); }
- BOOL ChangeNumLeadingZero( BOOL bLeading );
- BOOL IsNumLeadingZero() const
- { return pData->pCountry->IsNumLeadingZero(); }
- USHORT ChangeNumDigits( USHORT nDigits );
- USHORT GetNumDigits() const
- { return pData->pCountry->GetNumDigits(); }
- BOOL ChangeNumTrailingZeros( BOOL bTrailingZeros = TRUE );
- BOOL IsNumTrailingZeros() const
- { return pData->pCountry->IsNumTrailingZeros(); }
- String GetNum( long nNumber, USHORT nDigits ) const;
- String GetNum( long nNumber ) const
- { return GetNum( nNumber, GetNumDigits() ); }
-
- USHORT ChangeCurrPositiveFormat( USHORT nFormat );
- USHORT GetCurrPositiveFormat() const
- { return pData->pCountry->GetCurrPositiveFormat(); }
- USHORT ChangeCurrNegativeFormat( USHORT nFormat );
- USHORT GetCurrNegativeFormat() const
- { return pData->pCountry->GetCurrNegativeFormat(); }
- String ChangeCurrSymbol( const String& rSymbol );
- const String& GetCurrSymbol() const
- { return pData->pCountry->GetCurrSymbol(); }
- USHORT ChangeCurrDigits( USHORT nDigits );
- USHORT GetCurrDigits() const
- { return pData->pCountry->GetCurrDigits(); }
- char ChangeCurrZeroChar( char cZeroChar );
- char GetCurrZeroChar() const
- { return pData->pCountry->GetCurrZeroChar(); }
- String GetCurr( long nNumber ) const;
-
- char GetListSep() const
- { return pData->pCountry->GetListSep(); }
-
- International& operator=( const International& rIntn );
-
- BOOL operator==( const International& rIntn ) const;
- BOOL operator!=( const International& rIntn ) const;
-
- static void RegisterLanguage( const LanguageTable& rTable );
- static BOOL IsLanguageAvailable( LanguageType eLanguage );
- static USHORT GetAvailableLanguagesCount();
- static LanguageType GetAvailableLanguage( USHORT nIndex );
- static void RegisterCountry( const CountryTable& rTable );
- static BOOL IsCountryAvailable( CountryType eCountry );
- static USHORT GetAvailableCountriesCount();
- static CountryType GetAvailableCountry( USHORT nIndex );
- };
-
- #endif
-
- #ifndef _WLDCRD_HXX
- #define _WLDCRD_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _STRING_HXX
- #endif
-
- class WildCard
- {
- private:
- String aWildString;
- char cSepSymbol;
- USHORT ImpMatch( const char *pWild, const char *pStr ) const;
-
- public:
- WildCard();
- WildCard( const String& rWildCards,
- const char cSeparator = '\0' );
-
- String operator ()() { return aWildString; }
-
- BOOL Matches( const String& rStr ) const;
-
- BOOL operator ==( const String& rString ) const
- { return Matches( rString ); }
- BOOL operator !=( const String& rString ) const
- { return !( Matches( rString ) ); }
-
- WildCard& operator =( const String& rString );
- WildCard& operator =( const WildCard& rWildCard );
- };
-
- inline WildCard::WildCard()
- {
- aWildString = String( '*' );
- cSepSymbol = '\0';
- }
-
- inline WildCard::WildCard( const String& rWildCard, const char cSeparator )
- {
- aWildString = rWildCard;
- cSepSymbol = cSeparator;
- }
-
- inline WildCard& WildCard::operator=( const String& rString )
- {
- aWildString = rString;
- return *this;
- }
-
- inline WildCard& WildCard::operator=( const WildCard& rWildCard )
- {
- aWildString = rWildCard.aWildString;
- cSepSymbol = rWildCard.cSepSymbol;
- return *this;
- }
-
- #endif
-
- #ifndef _FSYS_HXX
- #define _FSYS_HXX
-
- #ifndef _TOOLS_H
- #endif
-
- #ifndef _DATE_HXX
- #endif
- #ifndef _TIME_HXX
- #endif
- #ifndef _STRING_HXX
- #endif
- #ifndef _LINK_HXX
- #endif
- #ifndef _WLDCRD_HXX
- #endif
-
- class DirEntry;
- class DirEntryList;
- class FSysSortList;
- class FileStatList;
-
- #define FSYS_BUFSIZE 1024
-
- typedef int DirEntryKind;
- #define FSYS_KIND_UNKNOWN ((DirEntryKind) 0)
- #define FSYS_KIND_FILE ((DirEntryKind) 1)
- #define FSYS_KIND_DIR ((DirEntryKind) 2)
- #define FSYS_KIND_DEV ((DirEntryKind) 4)
- #define FSYS_KIND_BLOCK ((DirEntryKind) 8)
- #define FSYS_KIND_CHAR ((DirEntryKind) 16)
- #define FSYS_KIND_WILD ((DirEntryKind) 32)
- #define FSYS_KIND_REMOVEABLE ((DirEntryKind) 128)
- #define FSYS_KIND_FIXED ((DirEntryKind) 256)
- #define FSYS_KIND_REMOTE ((DirEntryKind) 512)
- #define FSYS_KIND_RAM ((DirEntryKind) 1024)
- #define FSYS_KIND_CDROM ((DirEntryKind) 2048)
- #define FSYS_KIND_ALL ((DirEntryKind) 4095)
-
- typedef int FSysSort;
- #define FSYS_SORT_NONE ((FSysSort) 0)
- #define FSYS_SORT_SIZE ((FSysSort) 1)
- #define FSYS_SORT_CREATED ((FSysSort) 2)
- #define FSYS_SORT_MODIFYED ((FSysSort) 4)
- #define FSYS_SORT_ACCESSED ((FSysSort) 8)
- #define FSYS_SORT_ASCENDING ((FSysSort) 16)
- #define FSYS_SORT_DESCENDING ((FSysSort) 32)
- #define FSYS_SORT_EXT ((FSysSort) 64)
- #define FSYS_SORT_NAME ((FSysSort) 128)
- #define FSYS_SORT_KIND ((FSysSort) 256)
- #define FSYS_SORT_CREATOR ((FSysSort) 512)
- #define FSYS_SORT_END ((FSysSort)1024)
-
- enum DirEntryFlag
- {
- FSYS_FLAG_NORMAL,
- FSYS_FLAG_VOLUME,
- FSYS_FLAG_ABSROOT,
- FSYS_FLAG_RELROOT,
- FSYS_FLAG_CURRENT = FSYS_FLAG_RELROOT,
- FSYS_FLAG_PARENT,
- FSYS_FLAG_INVALID
- };
-
- enum FSysError
- {
- FSYS_ERR_OK,
- FSYS_ERR_MISPLACEDCHAR,
- FSYS_ERR_INVALIDCHAR,
- FSYS_ERR_NOTEXISTS,
- FSYS_ERR_ALREADYEXISTS,
- FSYS_ERR_NOTADIRECTORY,
- FSYS_ERR_NOTAFILE,
- FSYS_ERR_INVALIDDEVICE,
- FSYS_ERR_ACCESSDENIED,
- FSYS_ERR_LOCKVIOLATION,
- FSYS_ERR_VOLUMEFULL,
- FSYS_ERR_NOENTRYASSIGNED,
- FSYS_ERR_ISWILDCARD,
- FSYS_ERR_NOTSUPPORTED,
- FSYS_ERR_UNKNOWN
- };
-
- enum FSysPathStyle
- {
- FSYS_STYLE_HOST,
- FSYS_STYLE_FAT,
- FSYS_STYLE_MSDOS = FSYS_STYLE_FAT,
- FSYS_STYLE_HPFS,
- FSYS_STYLE_OS2 = FSYS_STYLE_HPFS,
- FSYS_STYLE_NTFS,
- FSYS_STYLE_NWFS,
- FSYS_STYLE_SYSV,
- FSYS_STYLE_BSD,
- FSYS_STYLE_UNX = FSYS_STYLE_BSD,
- FSYS_STYLE_MAC,
- FSYS_STYLE_DETECT,
- FSYS_STYLE_UNKNOWN
- };
-
- #if defined(WIN) || defined(W30)
-
- String Gui2FSys( const String& rStr );
- String FSys2Gui( const String& rStr );
- #define GUI2FSYS(s) Gui2FSys( s )
- #define FSYS2GUI(s) FSys2Gui( s )
-
- #else
-
- #define GUI2FSYS(s) s
- #define FSYS2GUI(s) s
-
- #endif
-
- class FileStat
- {
- friend class Dir;
- friend void ImpInitFileStat( FileStat&, struct dirent* );
-
- private:
- FSysError nError;
- DirEntryKind nKindFlags;
- ULONG nSize;
- FSysPathStyle eStyle;
- String aCreator;
- String aType;
- Date aDateCreated;
- Time aTimeCreated;
- Date aDateModified;
- Time aTimeModified;
- Date aDateAccessed;
- Time aTimeAccessed;
-
- protected:
-
- FileStat( const void *pInfo,
- const void *pVolInfo );
- public:
- FileStat();
- FileStat( const DirEntry& rDirEntry );
-
- BOOL Update( const DirEntry& rDirEntry );
-
- FSysError GetError() const { return nError; }
- ULONG GetSize() const { return nSize; }
-
- DirEntryKind GetKind() const { return nKindFlags; }
- BOOL IsKind( DirEntryKind nKind ) const;
- FSysPathStyle GetStyle() const { return eStyle; }
-
- String GetType() const { return aType; }
- String GetCreator() const { return aCreator; }
-
- Date DateCreated() const { return aDateCreated; }
- Time TimeCreated() const { return aTimeCreated; }
- Date DateModified() const { return aDateModified; }
- Time TimeModified() const { return aTimeModified; }
- Date DateAccessed() const { return aDateAccessed; }
- Time TimeAccessed() const { return aTimeAccessed; }
- BOOL IsYounger( const FileStat& rIsOlder ) const;
- };
-
- inline BOOL FileStat::IsKind( DirEntryKind nKind ) const
- {
- BOOL bRet;
- if ( nError )
- bRet = nKind == FSYS_KIND_UNKNOWN;
- else
- bRet = ( nKind != FSYS_KIND_UNKNOWN ) &&
- ( ( nKindFlags & nKind ) == nKind );
- return bRet;
- }
-
- class DirEntry
- {
- friend class Dir;
- friend class FileStat;
- friend const char* ImpCheckDirEntry( const void* p );
-
- private:
- String aName;
- DirEntryFlag eFlag;
- DirEntry* pParent;
- FSysError eError;
-
- DirEntry( const String& rInitName,
- DirEntryFlag aDirFlag,
- FSysPathStyle eStyle );
- FSysError ImpParseName( const String& rIntiName,
- FSysPathStyle eParser );
- FSysError ImpParseOs2Name( const String& rPfad,
- FSysPathStyle eStyle );
- FSysError ImpParseUnixName( const String& rPfad,
- FSysPathStyle eStyle );
- FSysError ImpParseMacName( const String& rPfad );
- const DirEntry* ImpGetTopPtr() const;
- DirEntry* ImpGetTopPtr();
- DirEntry* ImpGetPreTopPtr();
- BOOL ImpToRel( String aStart );
-
- protected:
- void ImpTrim( FSysPathStyle eStyle );
- const String& ImpTheName() const;
- const DirEntryFlag ImpTheFlag() const { return eFlag; };
- DirEntry* ImpChangeParent( DirEntry* pNewParent );
-
- public:
- DirEntry( DirEntryFlag aDirFlag = FSYS_FLAG_CURRENT );
- DirEntry( const DirEntry& rEntry );
- DirEntry( const String& rInitName,
- FSysPathStyle eParser = FSYS_STYLE_HOST );
- ~DirEntry();
-
- BOOL IsValid() const { return eError == FSYS_ERR_OK; }
-
- String ChangeExtension( const String& rExt, char cSep = '.' );
- String GetExtension( char cSep = '.' ) const;
- String CutExtension( char cSep = '.' );
- String ChangeName( const String& rName, FSysPathStyle eFormatter = FSYS_STYLE_HOST );
- String GetName( FSysPathStyle eFormatter = FSYS_STYLE_HOST ) const;
- String CutName( FSysPathStyle eFormatter = FSYS_STYLE_HOST );
- String ChangeBase( const String& rBase, char cSep = '.' );
- String GetBase(char cSep = '.' ) const;
- DirEntry GetPath() const;
- DirEntry GetDevice() const;
- String GetVolume() const;
- String GetFull( FSysPathStyle eFormatter = FSYS_STYLE_HOST,
- BOOL bWithDelimiter = FALSE,
- USHORT nMaxChars = STRING_MAXLEN ) const;
- DirEntry TempName() const;
-
- BOOL IsAbs() const;
- BOOL ToAbs();
- BOOL Find( const String& rPfad );
- BOOL ToRel();
- BOOL ToRel( const DirEntry& rRefDir );
-
- BOOL SetCWD( BOOL bSloppy = FALSE );
- BOOL MakeDir( BOOL bSloppy = FALSE ) const;
- BOOL Exists() const;
- BOOL First();
- USHORT Level() const;
- FSysError CopyTo( const DirEntry& rDestDir,
- BOOL bFile = FALSE ) const;
- FSysError MoveTo( const DirEntry& rDestDir ) const;
- FSysError Kill() const;
-
- DirEntry& operator =( const DirEntry& rOrigDir );
- DirEntry operator +( const DirEntry& rSubDir ) const;
- DirEntry& operator +=( const DirEntry& rSubDir );
- BOOL operator ==( const DirEntry& rAnotherDir ) const;
- BOOL operator !=( const DirEntry& rAnotherDir ) const;
- const DirEntry& operator []( USHORT nParentLevel ) const;
-
- static String GetAccessDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST );
- static String GetSearchDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST );
- static BOOL IsCaseSensitive( FSysPathStyle eFormatter = FSYS_STYLE_HOST );
- };
-
- class FileCopier
- {
- private:
- DirEntry aSource;
- DirEntry aTarget;
- USHORT nBlockSize;
- ULONG nBytesTotal;
- ULONG nBytesCopied;
- Link aProgressLink;
-
- protected:
- virtual BOOL Progress();
-
- public:
- FileCopier();
- FileCopier( const DirEntry &rSource,
- const DirEntry &rTarget );
- FileCopier( const FileCopier &rCopier );
- ~FileCopier();
-
- FileCopier& operator = ( const FileCopier &rCopier );
-
- USHORT ChangeBlockSize( USHORT nBytes );
- USHORT GetBlockSize() const
- { return nBlockSize; }
-
- ULONG GetBytesTotal() const
- { return nBytesTotal; }
- ULONG GetBytesCopied() const
- { return nBytesCopied; }
-
- Link ChangeProgressHdl( const Link &rLink );
- const Link& GetProgressHdl() const
- { return aProgressLink; }
-
- void SetSource( const DirEntry &rSource )
- { aSource = rSource; }
- void SetTarget( const DirEntry &rTarget )
- { aTarget = rTarget; }
- const DirEntry& GetSource() const { return aSource; }
- const DirEntry& GetTarget() const { return aTarget; }
-
- FSysError Execute();
- };
-
- inline Link FileCopier::ChangeProgressHdl( const Link &rLink )
- {
- Link aOldLink = aProgressLink;
- aProgressLink = rLink;
- return aProgressLink;
- }
-
- inline USHORT FileCopier::ChangeBlockSize( USHORT nBytes )
- {
- USHORT nOldBlockSize = nBlockSize;
- nBlockSize = nBytes;
- return nOldBlockSize;
- }
-
- class Dir : public DirEntry
- {
- DirEntryList *pLst;
- FSysSortList *pSortLst;
- FileStatList *pStatLst;
- WildCard aNameMask;
- USHORT eAttrMask;
-
- private:
- Dir& operator=( const Dir& );
- #ifdef _DIR_CXX
- FSysError ImpSetSort( va_list pArgs, FSysSort nSort );
- void Construct( DirEntryKind nKind = FSYS_KIND_ALL );
- #endif
-
- protected:
- BOOL ImpInsertPointReached( const DirEntry& rIsSmaller,
- const FileStat& rNewStat,
- ULONG nCurPos,
- ULONG nSortIndex ) const;
- void ImpSortedInsert( const DirEntry *pNewEntry,
- const FileStat *pNewStat );
- public:
- Dir();
- Dir( const DirEntry& rDirEntry,
- DirEntryKind nKind = FSYS_KIND_ALL );
- Dir( const DirEntry& rDirEntry,
- DirEntryKind nKind,
- FSysSort nSort, ... );
- ~Dir();
-
- FSysError SetSort( FSysSort nSort, ... );
- BOOL Update();
- ULONG Count() const;
-
- Dir& operator +=( const Dir& rDir );
- DirEntry& operator []( USHORT nIndex ) const;
- };
-
- #endif
-
- #endif
-