00001 00002 // 00003 // This file is part of the MADELINE 2 program 00004 // written by Edward H. Trager, Ritu Khanna, and Adrian Marrs 00005 // Copyright (c) 2005 by the 00006 // Regents of the University of Michigan. 00007 // All Rights Reserved. 00008 // 00009 // The latest version of this program is available from: 00010 // 00011 // http://eyegene.ophthy.med.umich.edu/madeline/ 00012 // 00013 // Released under the GNU General Public License. 00014 // A copy of the GPL is included in the distribution 00015 // package of this software, or see: 00016 // 00017 // http://www.gnu.org/copyleft/ 00018 // 00019 // ... for licensing details. 00020 // 00022 // 00023 // 2009.05.11.ET 00024 // 00025 00026 // 00027 // RelationshipEnded.h 00028 // 00029 #ifndef RelationshipEnded_INCLUDED 00030 #define RelationshipEnded_INCLUDED 00031 00032 #include "String.h" 00033 #include "Boolean.h" 00034 #include <map> 00035 00036 #define BOOLEAN_RELATIONSHIP_ENDED "T" 00037 #define BOOLEAN_RELATIONSHIP_NOT_ENDED "F" 00038 00039 class RelationshipEnded : public String { 00040 00041 public: 00042 // What type of relationship end? 00043 enum TYPE{ DIVORCE, SEPARATION, RELATIONSHIP_ENDED_OTHER_TYPE, RELATIONSHIP_ENDED_MISSING_TYPE }; 00044 00045 private: 00046 00047 friend class RelationshipEndedMapLoader; 00048 // 00049 static std::map<std::string,std::string> _lookupTable; 00050 00051 // See TYPE enum below: 00052 static std::map<std::string,TYPE> _lookupTypeTable; 00053 00054 // Here is the "Boolean" attribute that the regular "String" 00055 // class lacks: this defaults to missing: 00056 Boolean _booleanValue; 00057 TYPE _type; 00058 00059 public: 00060 00061 // 00062 // Constructors: 00063 // 00064 RelationshipEnded() { _isMissing=true; } 00065 RelationshipEnded( const std::string value ){ set(value); } 00066 RelationshipEnded( const char* value ){ set(value); } 00067 00068 // 00069 // Set methods: 00070 // 00071 void set(const char *value); 00072 void set(const std::string value); 00073 00074 // 00075 // Get methods not present in base "String" class: 00076 // 00077 const bool getBoolean( void ) const; 00078 char getBooleanAsChar(void) const; 00079 const TYPE getType(void) const; 00080 00081 static void addRelationshipEndedBooleanMapping(std::string relationshipValue,std::string booleanMapping); 00082 static bool isa(std::string inString); 00083 00084 }; 00085 00086 // 00087 // RelationshipEnded Friend class that initializes the lookup table: 00088 // 00089 class RelationshipEndedMapLoader 00090 { 00091 public: 00092 static RelationshipEndedMapLoader relationshipEndedMapLoader; 00093 00094 RelationshipEndedMapLoader(){ 00095 RelationshipEnded::_lookupTable["d" ] = BOOLEAN_RELATIONSHIP_ENDED; // Divorced 00096 RelationshipEnded::_lookupTable["s" ] = BOOLEAN_RELATIONSHIP_ENDED; // Separated 00097 RelationshipEnded::_lookupTable["e" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00098 RelationshipEnded::_lookupTable["D" ] = BOOLEAN_RELATIONSHIP_ENDED; // Divorced 00099 RelationshipEnded::_lookupTable["S" ] = BOOLEAN_RELATIONSHIP_ENDED; // Separated 00100 RelationshipEnded::_lookupTable["E" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00101 RelationshipEnded::_lookupTable["y" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00102 RelationshipEnded::_lookupTable["Y" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00103 RelationshipEnded::_lookupTable["yes" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00104 RelationshipEnded::_lookupTable["Yes" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00105 RelationshipEnded::_lookupTable["YES" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00106 RelationshipEnded::_lookupTable["divorced" ] = BOOLEAN_RELATIONSHIP_ENDED; 00107 RelationshipEnded::_lookupTable["separated" ] = BOOLEAN_RELATIONSHIP_ENDED; 00108 RelationshipEnded::_lookupTable["ended" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00109 RelationshipEnded::_lookupTable["divorce" ] = BOOLEAN_RELATIONSHIP_ENDED; 00110 RelationshipEnded::_lookupTable["separation"] = BOOLEAN_RELATIONSHIP_ENDED; 00111 RelationshipEnded::_lookupTable["Divorced" ] = BOOLEAN_RELATIONSHIP_ENDED; 00112 RelationshipEnded::_lookupTable["Separated" ] = BOOLEAN_RELATIONSHIP_ENDED; 00113 RelationshipEnded::_lookupTable["Ended" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00114 RelationshipEnded::_lookupTable["Divorce" ] = BOOLEAN_RELATIONSHIP_ENDED; 00115 RelationshipEnded::_lookupTable["Separation"] = BOOLEAN_RELATIONSHIP_ENDED; 00116 RelationshipEnded::_lookupTable["DIVORCED" ] = BOOLEAN_RELATIONSHIP_ENDED; 00117 RelationshipEnded::_lookupTable["SEPARATED" ] = BOOLEAN_RELATIONSHIP_ENDED; 00118 RelationshipEnded::_lookupTable["ENDED" ] = BOOLEAN_RELATIONSHIP_ENDED; // Ended; reason unspecified 00119 RelationshipEnded::_lookupTable["DIVORCE" ] = BOOLEAN_RELATIONSHIP_ENDED; 00120 RelationshipEnded::_lookupTable["SEPARATION"] = BOOLEAN_RELATIONSHIP_ENDED; 00121 00122 RelationshipEnded::_lookupTypeTable["d" ] = RelationshipEnded::DIVORCE; // Divorced 00123 RelationshipEnded::_lookupTypeTable["s" ] = RelationshipEnded::SEPARATION; // Separated 00124 RelationshipEnded::_lookupTypeTable["e" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00125 RelationshipEnded::_lookupTypeTable["D" ] = RelationshipEnded::DIVORCE; // Divorced 00126 RelationshipEnded::_lookupTypeTable["S" ] = RelationshipEnded::SEPARATION; // Separated 00127 RelationshipEnded::_lookupTypeTable["E" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00128 RelationshipEnded::_lookupTypeTable["y" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00129 RelationshipEnded::_lookupTypeTable["Y" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00130 RelationshipEnded::_lookupTypeTable["yes" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00131 RelationshipEnded::_lookupTypeTable["Yes" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00132 RelationshipEnded::_lookupTypeTable["YES" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00133 RelationshipEnded::_lookupTypeTable["divorced" ] = RelationshipEnded::DIVORCE; 00134 RelationshipEnded::_lookupTypeTable["separated" ] = RelationshipEnded::SEPARATION; 00135 RelationshipEnded::_lookupTypeTable["ended" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00136 RelationshipEnded::_lookupTypeTable["divorce" ] = RelationshipEnded::DIVORCE; 00137 RelationshipEnded::_lookupTypeTable["separation"] = RelationshipEnded::SEPARATION; 00138 RelationshipEnded::_lookupTypeTable["Divorced" ] = RelationshipEnded::DIVORCE; 00139 RelationshipEnded::_lookupTypeTable["Separated" ] = RelationshipEnded::SEPARATION; 00140 RelationshipEnded::_lookupTypeTable["Ended" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00141 RelationshipEnded::_lookupTypeTable["Divorce" ] = RelationshipEnded::DIVORCE; 00142 RelationshipEnded::_lookupTypeTable["Separation"] = RelationshipEnded::SEPARATION; 00143 RelationshipEnded::_lookupTypeTable["DIVORCED" ] = RelationshipEnded::DIVORCE; 00144 RelationshipEnded::_lookupTypeTable["SEPARATED" ] = RelationshipEnded::SEPARATION; 00145 RelationshipEnded::_lookupTypeTable["ENDED" ] = RelationshipEnded::RELATIONSHIP_ENDED_OTHER_TYPE; // Ended; reason unspecified 00146 RelationshipEnded::_lookupTypeTable["DIVORCE" ] = RelationshipEnded::DIVORCE; 00147 RelationshipEnded::_lookupTypeTable["SEPARATION"] = RelationshipEnded::SEPARATION; 00148 } 00149 }; 00150 00151 std::ostream& operator<<(std::ostream& s,const RelationshipEnded& n); 00152 00153 #endif