00001 #ifndef REFERENCE_H
00002 #define REFERENCE_H
00003
00004
00005
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;
00037 string remark;
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;
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;
00079 };
00080
00081
00082
00083
00084
00085 class Journal : public Refwithty {
00086 public:
00087
00088
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;
00100
00101 void toAce(ostream &pap) const;
00102
00103 protected:
00104
00105
00106 int pubmed;
00107 int medline;
00108
00109
00110
00111 string name;
00112 string volume;
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
00126
00127
00128
00129
00130
00131
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;
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
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;
00185 string makeKey() const;
00186
00187
00188 private:
00189 string consrtm;
00190 string addr;
00191 string date;
00192 };
00193
00194
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
00209
00210 private:
00211 void parsejl(const string &jl);
00212 string date;
00213 string number;
00214 string owner;
00215 string addr;
00216 string title;
00217 };
00218
00219 #endif