00001 #ifndef BDBTIMEINPUT_HH 00002 #define BDBTIMEINPUT_HH 00003 00004 //-------------------------------------------------------------------------- 00005 // 00006 // $Id: BdbTimeInput.hh,v 1.1 2003/02/26 09:18:48 gpdf Exp $ 00007 // 00008 // Environment: 00009 // This software was developed for the BaBar collaboration. If you 00010 // use all or part of it, please give an appropriate acknowledgement. 00011 // 00012 // Copyright Information: 00013 // Copyright (C) 2003 California Institute of Technology 00014 // 00015 //------------------------------------------------------------------------ 00016 00017 //----------------- 00018 // C/C++ Headers -- 00019 //----------------- 00020 #include <time.h> 00021 00022 //---------------------- 00023 // Base Class Headers -- 00024 //---------------------- 00025 00026 //------------------------------- 00027 // Collaborating Class Headers -- 00028 //------------------------------- 00029 00030 //------------------------------------ 00031 // Collaborating Class Declarations -- 00032 //------------------------------------ 00033 00034 // --------------------- 00035 // -- Class Interface -- 00036 // --------------------- 00037 00038 00039 /** 00040 * This is a helper class used in the implementation of BdbTime. 00041 * It is not intended to be supported as a public interface. 00042 * 00043 * This software was developed for the BaBar collaboration. If you 00044 * use all or part of it, please give an appropriate acknowledgement. 00045 * 00046 * Copyright (C) 2003 California Institute of Technology 00047 * 00048 * @version $Id: BdbTimeInput.hh,v 1.1 2003/02/26 09:18:48 gpdf Exp $ 00049 * 00050 * @author Gregory Dubois-Felsmann (originator) 00051 */ 00052 00053 class BdbTimeInput { 00054 00055 //-------------------- 00056 // Declarations -- 00057 //-------------------- 00058 00059 // Typedefs, consts, and enums 00060 00061 public: 00062 00063 // Error codes match those of Unix98's getdate(). 00064 enum Status { Success = 0, NoMatch = 7, BadValue = 8 }; 00065 00066 //-------------------- 00067 // Instance Members -- 00068 //-------------------- 00069 00070 public: 00071 00072 // Constructors 00073 00074 // Destructor 00075 00076 // Operators 00077 00078 // Selectors (const) 00079 00080 // Modifiers 00081 00082 protected: 00083 00084 // Helper functions 00085 00086 private: 00087 00088 // Friends 00089 00090 // Data members 00091 00092 // Disable copy construction and assignment. 00093 BdbTimeInput( const BdbTimeInput& ); 00094 BdbTimeInput& operator=( const BdbTimeInput& ); 00095 00096 //------------------ 00097 // Static Members -- 00098 //------------------ 00099 00100 public: 00101 00102 static BdbTimeInput::Status parseTime( const char* string, 00103 struct tm& result ); 00104 00105 static BdbTimeInput::Status parseDate( const char* string, 00106 struct tm& result ); 00107 00108 static BdbTimeInput::Status parseString( const char* string, 00109 const char* const formats[], 00110 struct tm& result, 00111 bool debug ); 00112 00113 static void setDebugging( bool debug ); 00114 00115 private: 00116 00117 // Data members 00118 00119 // Default table of time-only formats 00120 static const char* defaultTimeFormats_[]; 00121 00122 // Active table of time-only formats 00123 static const char* const * timeFormats_; 00124 00125 // Default table of date-only formats 00126 static const char* defaultDateFormats_[]; 00127 00128 // Active table of date-only formats 00129 static const char* const * dateFormats_; 00130 00131 // Debugging flag 00132 static bool debug_; 00133 }; 00134 00135 #endif // BDBTIMEINPUT_HH
1.3-rc3