| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : NT_validNameParser.h // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Coded by Lothar Richter in November 2002 // |
|---|
| 7 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 8 | // http://www.arb-home.de/ // |
|---|
| 9 | // // |
|---|
| 10 | // =============================================================== // |
|---|
| 11 | |
|---|
| 12 | #ifndef NT_VALIDNAMEPARSER_H |
|---|
| 13 | #define NT_VALIDNAMEPARSER_H |
|---|
| 14 | |
|---|
| 15 | #ifndef ARB_FORWARD_LIST_H |
|---|
| 16 | #include <arb_forward_list.h> |
|---|
| 17 | #endif |
|---|
| 18 | #ifndef __STRING__ |
|---|
| 19 | #include <string> |
|---|
| 20 | #endif |
|---|
| 21 | #ifndef __VECTOR__ |
|---|
| 22 | #include <vector> |
|---|
| 23 | #endif |
|---|
| 24 | |
|---|
| 25 | namespace validNames { |
|---|
| 26 | |
|---|
| 27 | typedef arb_forward_list<std::string> LineSet; |
|---|
| 28 | typedef LineSet* LineSetPtr; |
|---|
| 29 | |
|---|
| 30 | typedef std::vector<std::string> TokL; |
|---|
| 31 | typedef TokL *TokLPtr; |
|---|
| 32 | |
|---|
| 33 | enum DESCT { |
|---|
| 34 | VALGEN, HETGEN, HOMGEN, RENGEN, CORGEN, |
|---|
| 35 | VALSPEC, HETSPEC, HOMSPEC, RENSPEC, CORSPEC, |
|---|
| 36 | NOTYPE, VAL, HET, HOM, REN, COR |
|---|
| 37 | }; |
|---|
| 38 | |
|---|
| 39 | class Desco { |
|---|
| 40 | private: |
|---|
| 41 | DESCT type; |
|---|
| 42 | bool isCorrected; |
|---|
| 43 | std::string firstgen; |
|---|
| 44 | std::string firstspec; |
|---|
| 45 | std::string firstsub; |
|---|
| 46 | std::string secondgen; |
|---|
| 47 | std::string secondspec; |
|---|
| 48 | std::string secondsub; |
|---|
| 49 | |
|---|
| 50 | public: |
|---|
| 51 | Desco(DESCT type_, bool isCorrected_, |
|---|
| 52 | std::string firstgen_, std::string firstspec_, std::string firstsub_, |
|---|
| 53 | std::string secondgen_, std::string secondspec_, std::string secondsub_) : |
|---|
| 54 | type(type_), |
|---|
| 55 | isCorrected(isCorrected_), |
|---|
| 56 | firstgen(firstgen_), |
|---|
| 57 | firstspec(firstspec_), |
|---|
| 58 | firstsub(firstsub_), |
|---|
| 59 | secondgen(secondgen_), |
|---|
| 60 | secondspec(secondspec_), |
|---|
| 61 | secondsub(secondsub_) |
|---|
| 62 | {} |
|---|
| 63 | |
|---|
| 64 | std::string getFirstName(); |
|---|
| 65 | std::string getSecondName(); |
|---|
| 66 | DESCT getType() const { return type; } |
|---|
| 67 | }; |
|---|
| 68 | |
|---|
| 69 | |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | LineSet* readFromFile(const char* infile, LineSet* listOfLines); |
|---|
| 73 | |
|---|
| 74 | TokLPtr tokenize(const std::string& description, TokLPtr tokenLP); |
|---|
| 75 | |
|---|
| 76 | Desco determineType(const std::string& descriptionString); |
|---|
| 77 | |
|---|
| 78 | bool isUpperCase(const std::string& input); |
|---|
| 79 | }; // end namespace |
|---|
| 80 | |
|---|
| 81 | #else |
|---|
| 82 | #error NT_validNameParser.h included twice |
|---|
| 83 | #endif // NT_VALIDNAMEPARSER_H |
|---|