vref.h

Go to the documentation of this file.
00001 #ifndef REFERENCE_H
00002 #define REFERENCE_H
00003 
00004 /* file: vref.h
00005  * This file will replace the old ref.h gradually*/
00006 
00007 #include <string>
00008 #include <vector>
00009 #include <iostream>
00010 #include "gberr.h"
00011 #include <map>
00012 
00013 using namespace std;
00014 
00020 class Ref {
00021         public:
00022                 Ref(const Ref& ref) { authors=ref.authors; remark=ref.remark; }
00023                 Ref(const string &austr);
00024                 Ref& operator=(const Ref& ref);
00025                 virtual void writeAce(ostream &ous, ostream &pap) const;
00026                 virtual string makeKey() const {}
00027                 void addRemark(const string &rm) { remark = rm; }
00028                 virtual void toAce(ostream &ou) const;
00029 
00030                 static void setCounter(int k) { counter = k; }
00031                 static int nextCounter() { return counter++; }
00032                 static void loadKey(const string &inf);
00033                 static void dumpKey(const string &ouf);
00034 
00035         protected:
00036                 vector<string> authors; // common to nearly all Ref
00037                 string remark;          // an optional field
00038 
00044                 static int counter;  
00045                 static map<string, int> paperkey;
00046 };
00047 
00050 class Refwithty : public Ref { 
00051         public:
00052                 Refwithty(const Refwithty &ref) : Ref(ref) { title=ref.title; year=ref.year; }
00053                 Refwithty& operator=(const Refwithty &ref);
00054                 Refwithty(const string &austr, const string &tit, int yr) : Ref(austr), title(tit), year(yr) { }
00055                 Refwithty(const string &austr, const string &tit) : Ref(austr), year(0), title(tit) { }
00056                 void toAce(ostream &ou) const;
00058                 string makeKey() const;
00059 
00060         protected:
00061                 string title;
00062                 int year;   // some may not have year
00063 };
00064 
00067 class Inpress : public Refwithty {
00068         public:
00069                 Inpress(const string &austr, const string &tit, const string &jn) : Refwithty(austr, tit), name(jn) { }
00070                 Inpress(const string &austr, const string &tit, const string &jn, int yr)  : Refwithty(austr, tit, yr), name(jn) { }
00071                 void toAce(ostream &ou) const;
00072                 string makeKey() const { return Refwithty::makeKey() + name; }
00073                 void setPubmed(int pm) { pubmed = pm; }
00074                 int getPubmed() const { return pubmed; }
00075 
00076         private:
00077                 string name;
00078                 int pubmed;   // some In Press has this one
00079 };
00080 
00081 /* standard journal 
00082  * The constructor of this class will do some of the parsing job.
00083  * It will take the JOURNAL string as an additional parameter.
00084  * */
00085 class Journal : public Refwithty {
00086         public:
00087                 // the remaining member must be intialized with a parser function
00088                 // call
00089                 Journal(const string &austr, const string &tit) : Refwithty(austr, tit) {}
00090                 Journal(const string &austr, const string &tit, int yr) : Refwithty(austr, tit, yr) {}
00091 
00093                 Journal(const string &austr, const string &tit, const string &jl); 
00095                 void setMedline(int med) { medline = med; }
00096                 void setPubmed(int pub) { pubmed = pub; }
00097                 Journal(const Journal &ref);
00098                 Journal& operator=(const Journal &ref);
00099                 string makeKey() const;  // expensive operation cache the result
00100                 /* writes the paper object only */
00101                 void toAce(ostream &pap) const;
00102 
00103         protected:
00104                 // parse normal journal
00105                 //virtual void parse(const string &jl);
00106                 int pubmed;  // long enough, avoid conversion
00107                 int medline; // storage v.s. conversion
00108                 //string remark;
00109 
00110                 // journal specific information
00111                 string name;  // journal name
00112                 string volume;  // holds Date if jname == Submitted
00113                 string issue;   
00114                 string page_begin;
00115                 string page_end;
00116 };
00117 
00118 class Online : public Journal
00119 {
00120         public:
00121                 Online(const string &austr, const string &tit) : Journal(austr, tit) {}
00122                 Online(const string &austr, const string &tit, const string &jn,
00123                                 const string &vol, const string &pb, const string &pe, int yr) 
00124                                 : Journal(austr, tit, yr) { name=jn; volume=vol; page_begin=pb; page_end=pe; }
00125                 //void toAce(ostream &ou) const;
00126                 //string makeKey() const;
00127                 //void clear();
00128 
00129         //private:
00130                 //void parse(const string &jl);
00131                 //string name, volume, pageBegin, pageEnd;
00132 };
00133 
00139 class Book : public Refwithty {
00140         public:
00142                 Book(const string &austr, const string &tit, const string &jl);
00143                 void toAce(ostream &ou) const;
00144                 string makeKey() const;
00145 
00146         private:
00147                 string volume;
00148                 string page_begin, page_end;
00149                 string name;
00150                 string publisher;        // some don't have publisher info
00151                 vector<string> editors;
00152 };
00153 
00154 class Thesis : public Refwithty
00155 {
00156         public:
00157                 Thesis(const string &austr, const string &tit, const string &univ, int yr) : Refwithty(austr, tit, yr), university(univ) { }
00158                 void toAce(ostream &ou) const;
00159                 string makeKey() const;
00160                 //void clear() { Refwithty::clear(); university.clear(); }
00161 
00162         private: 
00163                 string university;
00164 };
00165 
00169 class Unpublished : public Refwithty
00170 {
00171         public:
00172                 Unpublished(const string &austr, const string &tit, int yr=0) : Refwithty(austr, tit, yr) {}
00173                 string makekey() const { return "unpub" + Refwithty::makeKey(); }
00174 };
00175 
00177 
00178 class Submission : public Ref
00179 {
00180         public:
00181                 Submission(string austr, string dd) : Ref(austr), date(dd) { }
00182                 Submission(string austr, string dd, string ad);
00183                 void setConsrtm(const string &cs) { consrtm = cs; }
00184                 void toAce(ostream &ou) const;  // write an ace object
00185                 string makeKey() const;
00186                 //void clear();
00187 
00188         private:
00189                 string consrtm;
00190                 string addr;   // some don't have address
00191                 string date;   // date in string format
00192 };
00193 
00194 // some Patents do not have title
00195 class Patent : public Ref
00196 {
00197         public:
00198                 Patent(const string &austr, const string &num, const string &d, const string &ow) : Ref(austr), date(d), number(num), owner(ow) { }
00199                 Patent(const string &austr, const string &tit, const string &jl) 
00200                         : Ref(austr), title(tit) { parsejl(jl); }
00201 
00203                 Patent(const string &austr, const string &jl)
00204                         : Ref(austr) { parsejl(jl); }
00205 
00206                 void toAce(ostream &ou) const;
00207                 string makeKey() const { return "Pat_" + number; }
00208                 //void clear();
00209 
00210         private:
00211                 void parsejl(const string &jl);
00212                 string date;  // date string
00213                 string number;  // patent unique number
00214                 string owner;   // company or institute or university
00215                 string addr;    // address of owner, some patent don't have this one
00216                 string title;   // optional 
00217 };
00218 
00219 #endif

Generated on Wed Aug 10 11:56:58 2011 for Softwares from Orpara by  doxygen 1.5.6