00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
#ifndef OMF_XMIREADER12_HPP
00026 
#define OMF_XMIREADER12_HPP
00027 
00028 
00029 
#include <string>
00030 
#include <list>
00031 
#include <map>
00032 
00033 
00034 
#include <libxml/tree.h>
00035 
00036 
namespace OMF
00037 {
00038   
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     
00065     
void xmi();
00066     
void namespaces();
00067     
void version();
00068 
00069     
00070     
void header();
00071 
00072     
00073     
void differences();
00074 
00075     
00076     
void extensions();
00077 
00078     
00079     
void content();
00080 
00081     
00082     
void objectAsElement();
00083     
void elementStart();
00084     
void elementName();
00085     
void elementId();
00086     
void elementAttributes();
00087     
void refValueAttrib();
00088     
void dataValueAttrib();
00089 
00090     
00091     
void objectContents();
00092     
void contentElement();
00093     
void itemHeader();
00094     
void itemContent();
00095     
void dataValue();
00096     
void primitiveValue();
00097     
void structureValue();
00098 
00099     
00100     
void classAttributes();
00101 
00102     
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