home *** CD-ROM | disk | FTP | other *** search
- /* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Copyright (C) 1996, by Watcom. All rights reserved. %
- % No part of this software may be reproduced or used in any form %
- % or by any means - graphic, electronic or mechanical, including %
- % photocopying, recording, taping or information storage and %
- % retrieval systems - except with the written permission of %
- % Watcom. %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
- Date By Reason
- ---- -- ------
- 27 May 96 Alan Shi Created (Ported from VX-REXX)
-
- */
-
- #ifndef SFORMAT_HPP_INCLUDED
- #define SFORMAT_HPP_INCLUDED
-
- #define VALID_ROUTINE 0
- #define INVALID_ROUTINE 40
- #define MAXYEAR 3000
-
- enum {
- DECIMAL_SUB = 0,
- THOUSANDS_SUB,
- TIMESEP_SUB,
- DATESEP_SUB,
- NUM_COUNTRY,
- };
-
-
- // Some of these fields were originally WUChars instead of WULongs.
- // This was changed because there is some code that assigns these values
- // to variables that were declared as WULongs (because these variables
- // sometimes held sentiel values outside the range of a WUChar).
-
- typedef struct dateInf {
- WULong month;
- WULong year;
- WULong daynum;
- WULong day;
- WBool dayset;
- WBool daynumset;
- WBool yearset;
- WBool monthset;
- } dateInfo;
-
- typedef dateInfo * pdateInfo;
-
- typedef struct timeInf {
- WULong hours;
- WULong minutes;
- WULong seconds;
- WULong millths;
- WBool millthsset;
- WBool secondsset;
- WBool minutesset;
- WBool hoursset;
- } timeInfo;
-
- typedef timeInfo * ptimeInfo;
-
- typedef struct numInf {
- WChar *number;
- WLong exponent;
- WBool negative;
- } numInfo;
-
- typedef numInfo * pnumInfo;
-
- class SFormat {
- public:
- static WString SFormat::FormatString( WString input, WString mask,
- WBool useCurDate = FALSE,
- WDateOrder dOrder = WDateOrderUSA );
- private:
- static WChar *SFormat::Format( WChar *input, WChar *mask,
- WBool usecurrentdate, WULong inptype );
-
- static WULong SFormat::DaysThisYear( WULong year, WULong month,
- WULong daynum );
-
- static void SFormat::InvBaseDate( WULong daynumber, pdateInfo dinfo );
-
- static WULong SFormat::BaseDate( WULong year, WULong month,
- WULong daynum );
-
- static WBool SFormat::DayCheck( pdateInfo dinfo );
-
- static WBool SFormat::FormatInDateInfo( pdateInfo dinfo, WChar *input,
- WBool usecurrentdate,
- WULong inptype );
-
- static WChar *SFormat::FormatOutDateInfo( pdateInfo dinfo,
- WChar *mask );
-
- static WChar *SFormat::FormatDate( WChar *input, WChar *mask,
- WBool usecurrentdate,
- WULong inptype );
-
- static WBool SFormat::FormatInTimeInfo( ptimeInfo tinfo,
- WChar *input,
- WBool usecurrentdate );
-
- static WChar * SFormat::FormatOutTimeInfo( ptimeInfo tinfo,
- WChar *mask );
-
- static WChar *SFormat::FormatTime( WChar *input, WChar *mask,
- WBool usecurrentdate );
-
- static WBool SFormat::FormatInNumberInfo( pnumInfo ninfo,
- WChar *input );
-
- static WULong SFormat::FormatOutNumber( WChar **output, WChar *mask,
- pnumInfo ninfo );
-
- static WChar *SFormat::FormatOutNumberInfo( pnumInfo ninfo,
- WChar *mask );
-
- static WChar *SFormat::FormatNumber( WChar *input, WChar *mask );
-
- static WChar *SFormat::FormatOutString( WChar *input, WChar *mask );
-
- };
-
- #endif
-
-