Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

lkdatetimereader.h

00001 /* liblookdb: lkdatetimereader.h - Parses date/time strings 
00002     Copyright (C) 1998-2001 LOOK Systems
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Lesser General Public
00006     License as published by the Free Software Foundation; either
00007     version 2.1 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Lesser General Public License for more details.
00013 
00014     You should have received a copy of the GNU Lesser General Public
00015     License along with this library; if not, write to the Free Software
00016     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 */
00018 #ifndef LIBLOOKDB_LKDATETIMEREADER_H
00019 #define LIBLOOKDB_LKDATETIMEREADER_H
00020 
00021 // $Id: lkdatetimereader.h,v 1.5 2001/07/05 16:11:21 clive Exp $
00022 
00023 #include "lookdbutils.h"
00024 #include "lkstring.h"
00025 #include "lkdatetime.h"
00026 #include "lookstringlist.h"
00027 #include "looklonglist.h"
00028 
00029 namespace look {
00030 
00032 
00066 class LOOKDBUTILITIES_DLL LookDateTimeReader
00067 {
00068 public:
00069 
00071         enum DatePartOrder
00072         {
00073                 AnyPreferDMY = 1, 
00074                 AnyPreferMDY,     
00075                 DMY,              
00076                 MDY,              
00077                 YMD               
00078         };
00079 
00081         enum DateTimeOrder
00082         {
00083                 AnyPreferDT = 1, 
00084                 AnyPreferTD,     
00085                 DT,              
00086                 TD               
00087         };
00088 
00089         static bool ReadDate( const LookString& theString,
00090                 LookDate& theDate, DatePartOrder partOrder = AnyPreferDMY );
00091         static bool ReadTime( const LookString& theString,
00092                 LookTime& theTime );
00093         static bool ReadDateTime( const LookString& theString,
00094                 LookDateTime& theDateTime, DateTimeOrder dtOrder = AnyPreferDT,
00095                 DatePartOrder partOrder = AnyPreferDMY );
00096 
00097 protected:
00098 
00099         static bool FindYearPart( const LookString& theString,
00100                 bool& yearIsAtBegin );
00101 
00102         static void SplitToParts( LookStringList& theParts,
00103                 const LookString& theString );
00104 
00105         static LookString GetAlphaOnly( LookString theString );
00106 
00107         static bool FindMonthString( LookStringList& theParts,
00108                 int& monthIndex );
00109 
00110         static bool IsNumeric( const LookString& theString );
00111 
00112         static void CombineSplitStrings( 
00113                 const LookStringList& theParts, long theSplitPos,
00114                 LookString& beforeString, LookString& afterString );
00115 
00116         static void GuessDTOrder( const LookString& theString,
00117                 DateTimeOrder& dtOrder );
00118 
00119         static void SplitToPartsFindSeps( LookStringList& theParts,
00120                 LongValList& theDateSepPositions,
00121                 LongValList& theTimeSepPositions,
00122                 const LookString& theString );
00123 
00124         static void CheckForSepsAndAddIfValid( 
00125                 LookString theString,
00126                 LookStringList& theParts,
00127                 LongValList& theDateSepPositions,
00128                 LongValList& theTimeSepPositions );
00129 };
00130 
00131 
00132 } // end of "look" namespace
00133 #endif 

Generated at Thu Jan 17 12:53:06 2002 for liblookdb by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001