00001 #ifndef DATE_H 00002 #define DATE_H 00003 00004 #include <stdlib.h> 00005 #include <iostream> 00006 #include <string> 00007 #include <map> 00008 00009 using namespace std; 00010 00011 class DateException 00012 { 00013 private: 00014 string info; 00015 public: 00016 DateException() : info("Date Exception") {} 00017 DateException(char message[]) { 00018 info = string("Date Exception"); 00019 info.append(message); 00020 } 00021 DateException(string &message) { 00022 info = string("Date Exception"); 00023 info.append(message); 00024 } 00025 friend ostream &operator<<(ostream &ous, const DateException &e) { 00026 ous << e.info; return ous; 00027 } 00028 }; 00029 00030 00031 class Date 00032 { 00033 public: 00034 Date(int m = 1, int d = 1, int y = 1998); 00035 void gbstr(char s[]); 00036 friend istream &operator>>(istream &ins, Date &da); 00037 //recognize the GenBank format only: 28-MAR-1994 00038 friend ostream &operator<<(ostream &ous, const Date &da); 00039 //output to the ACEDB format (DateType) 1963-07-11 00040 // 00041 static string parseGBDate(const string &str); 00042 static void setup(); 00043 00044 private: 00045 int smtoi(const char ms[]); //converts string month to int 00046 int month; 00047 int day; 00048 int year; 00049 static map<string, string> monthMap; 00050 }; 00051 00052 00053 #endif 00054
1.5.6