Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members

XmiReader_1_2.hpp

Go to the documentation of this file.
00001 /* 00002 * Copyright (C) 2004 Andrew Sutton 00003 * 00004 * This library is free software; you can redistribute it and/or 00005 * modify it under the terms of the GNU Lesser General Public 00006 * License as published by the Free Software Foundation; either 00007 * version 2.1 of the License, or (at your option) any later version. 00008 * 00009 * This library is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00012 * Lesser General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU Lesser General Public 00015 * License along with this library; if not, write to: 00016 * 00017 * The Free Software Foundation, Inc. 00018 * 59 Temple Place, Suite 330 00019 * Boston, MA 02111-1307 USA 00020 * 00021 * Contact: 00022 * Andrew Sutton asutton@cs.kent.edu 00023 */ 00024 00025 #ifndef OMF_XMIREADER12_HPP 00026 #define OMF_XMIREADER12_HPP 00027 00028 // std includes 00029 #include <string> 00030 #include <list> 00031 #include <map> 00032 00033 // libxml includes 00034 #include <libxml/tree.h> 00035 00036 namespace OMF 00037 { 00038 // forward declarations 00039 class Model; 00040 class ModelObject; 00041 class Property; 00042 class Association; 00043 00050 class XmiReader_1_2 00051 { 00052 public: 00053 XmiReader_1_2(); 00054 ~XmiReader_1_2(); 00055 00057 void document(Model *model, xmlDocPtr doc); 00058 00059 private: 00060 void createObject(); 00061 void createLink(Property *prop, ModelObject *first, ModelObject *second); 00062 void resolveDeferred(); 00063 00064 // 2 00065 void xmi(); 00066 void namespaces(); 00067 void version(); 00068 00069 // 3 00070 void header(); 00071 00072 // 4 00073 void differences(); 00074 00075 // 5 00076 void extensions(); 00077 00078 // 6 00079 void content(); 00080 00081 // 7 00082 void objectAsElement(); 00083 void elementStart(); 00084 void elementName(); 00085 void elementId(); 00086 void elementAttributes(); 00087 void refValueAttrib(); 00088 void dataValueAttrib(); 00089 00090 // 8 00091 void objectContents(); 00092 void contentElement(); 00093 void itemHeader(); 00094 void itemContent(); 00095 void dataValue(); 00096 void primitiveValue(); 00097 void structureValue(); 00098 00099 // 9 00100 void classAttributes(); 00101 00102 // 10 00103 void otherLinks(); 00104 00105 private: 00109 struct Context 00110 { 00111 Context() : 00112 end(false), 00113 previous(0), 00114 node(0), 00115 child(0), 00116 attr(0), 00117 object(0), 00118 prop(0), 00119 uri(), 00120 metaclass(), 00121 feature(), 00122 id(), 00123 idref(), 00124 label(), 00125 uuid() 00126 {} 00127 00128 bool end; 00129 Context *previous; 00130 xmlNodePtr node; 00131 xmlNodePtr child; 00132 xmlAttrPtr attr; 00133 ModelObject *object; 00134 Property *prop; 00135 00136 std::string uri; 00137 std::string metaclass; 00138 std::string feature; 00139 std::string id; 00140 std::string idref; 00141 std::string label; 00142 std::string uuid; 00143 }; 00144 00151 struct Deferred 00152 { 00153 Deferred() : 00154 id(), 00155 prop(0), 00156 object(0) 00157 {} 00158 00159 std::string id; 00160 Property *prop; 00161 ModelObject *object; 00162 }; 00163 00164 typedef std::list<Deferred *> DeferredList; 00165 typedef std::map<std::string, xmlNsPtr> PrefixMap; 00166 00167 xmlDocPtr _doc; 00168 xmlNodePtr _root; 00169 PrefixMap _prefix; 00170 DeferredList _deferred; 00171 Context *_current; 00172 Model *_model; 00173 }; 00174 } 00175 00176 #endif

Generated on Fri Sep 10 13:07:33 2004 for OpenModelingFramework by doxygen 1.3.8