ref.h

Go to the documentation of this file.
00001 //file: ref.h
00002 #ifndef REF_H
00003 #define REF_H
00004 #include <iostream>
00005 #include <string>
00006 #include <vector>
00007 #include "gberr.h"
00008 
00009 #ifndef LINE
00010 #define LINE 83
00011 #endif
00012 
00014 enum refType {normal, thesis, unpub, submit, inpres, patent, abnormal};
00015 
00016 class jinfo
00017 {
00018  public:
00019         jinfo();
00020         /* load info from Journal Line.  Return 1 for missing vol and page
00021          * return 0 if normal */
00022         int load(const string &jl) throw(gberr); 
00023         void getYear(const string &jj); //if no year info year will be nothing
00024 
00025         /* what type of journal is, abnormal? */
00026         refType type;
00027 
00028         string key() const; //make a unique key for paper
00029         void clear();
00030 
00031         friend class ref;
00032 
00033  private:
00034         string jo;  // name of the journal, such as Science, Nature, etc.
00035         string vol;
00036         string iss;
00037         string pgb;
00038         string pge;
00039         string yr;
00040         string affil; //affiliation, deparments, universities etc.
00041 };
00042 
00043 class ref
00044 {
00045  public:
00046         ref() : auth(), titl(), jnl(), med(), pubmed() { }
00047 
00048         /* simply read in from ins and ln without formating and processing
00049          * return 0 if normal; otherwise, error numbers 
00050          * 1 for missing vol and/or page */
00051         int read(istream &ins, string &ln);
00052         /* return 1 or higher if some error. return 0 if correct */
00053         int dump(ostream &seq, ostream &pap, ostream &aut);
00054         int writeProtein(ostream &seq, ostream &pap, ostream &aut);
00055         string key() const;  // make a key for paper
00056         string title() const { return titl; }
00057         
00058  private:
00059         void clear(); // needs to clear fields between succesive reads
00060         /*convert author string to vector<string> authorList */
00061         void au2list(); 
00062         string fullName(); //returns the full name of an author from JOURNAL if exist
00063         //at the same time remove the author from the JOURNAL record
00064         void rmSubmit();
00065 
00066         /* helper function only used inside this class */
00067         friend void rmAuthorPunc(string &s); //removes punctuations from author
00068         friend void rmJournalDot(string &s); //remove dots in journal names
00069 
00070    string auth; // AUTHOR required
00071         string titl; // TITLE
00072         string jnl;  // JOURNAL field
00073         string med;     // Medline key  Optional
00074         string pubmed;  // PUBMED key   Optional
00075         string rmk;  // REMARK Optional field in a reference
00076         jinfo parsedJ;  // parsed journal line: jnl
00077         vector<string> authorList;  // list of author names
00078 };
00079 
00080 #endif

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