LTP GCOV extension - code coverage report
Current view: directory - ogr/ogrsf_frmts/ili/iom - iom_p.h
Test: gdal_filtered.info
Date: 2010-07-12 Instrumented lines: 45
Code covered: 2.2 % Executed lines: 1

       1                 : /**********************************************************************
       2                 :  * $Id: iom_p.h 17910 2009-10-27 02:07:33Z chaitanya $
       3                 :  *
       4                 :  * Project:  iom - The INTERLIS Object Model
       5                 :  * Purpose:  For more information, please see <http://iom.sourceforge.net>
       6                 :  * Author:   Claude Eisenhut
       7                 :  *
       8                 :  **********************************************************************
       9                 :  * Copyright (c) 2007, Claude Eisenhut
      10                 :  *
      11                 :  * Permission is hereby granted, free of charge, to any person obtaining a
      12                 :  * copy of this software and associated documentation files (the "Software"),
      13                 :  * to deal in the Software without restriction, including without limitation
      14                 :  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
      15                 :  * and/or sell copies of the Software, and to permit persons to whom the
      16                 :  * Software is furnished to do so, subject to the following conditions:
      17                 :  * 
      18                 :  * The above copyright notice and this permission notice shall be included
      19                 :  * in all copies or substantial portions of the Software.
      20                 :  * 
      21                 :  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      22                 :  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      23                 :  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
      24                 :  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      25                 :  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
      26                 :  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
      27                 :  * DEALINGS IN THE SOFTWARE.
      28                 :  ****************************************************************************/
      29                 : 
      30                 : 
      31                 : #ifndef IOM_IOM_P_H
      32                 : #define IOM_IOM_P_H
      33                 : 
      34                 : /** @file
      35                 :  * private IOM header.
      36                 :  */
      37                 : 
      38                 : #ifdef _MSC_VER
      39                 : // disable warning C4786: symbol greater than 255 character,
      40                 : #pragma warning(disable: 4786)
      41                 : #endif
      42                 : 
      43                 : #include <iostream>
      44                 : #include <vector>
      45                 : #include <stack>
      46                 : #include <map>
      47                 : #include <xercesc/sax/Locator.hpp>
      48                 : #include <xercesc/sax2/Attributes.hpp>
      49                 : #include <xercesc/sax2/SAX2XMLReader.hpp>
      50                 : #include <xercesc/sax2/DefaultHandler.hpp>
      51                 : #include <xercesc/framework/XMLBuffer.hpp>
      52                 : #include <xercesc/framework/XMLFormatter.hpp>
      53                 : #include <xercesc/framework/XMLPScanToken.hpp>
      54                 : #include <xercesc/framework/LocalFileFormatTarget.hpp>
      55                 : #include <xercesc/util/XMLString.hpp>
      56                 : #include <xercesc/util/StringPool.hpp>
      57                 : #include <xercesc/util/TransService.hpp>
      58                 : #include <iom/iom.h>
      59                 : #ifdef _MSC_VER
      60                 : #include <crtdbg.h>
      61                 : // signed/unsigned mismatch
      62                 : #pragma warning(default: 4018)
      63                 : #endif
      64                 : 
      65                 : #ifdef _DEBUG
      66                 :    //#define dbgnew   new( _CLIENT_BLOCK, __FILE__, __LINE__)
      67                 :    #define dbgnew   new
      68                 : #else
      69                 :    #define dbgnew   new
      70                 : #endif // _DEBUG
      71                 : 
      72                 : #ifdef _MSC_VER
      73                 : #define IOM_PATH_MAX _MAX_PATH
      74                 : #else
      75                 : #define IOM_PATH_MAX PATH_MAX
      76                 : #endif
      77                 : 
      78                 : XERCES_CPP_NAMESPACE_USE
      79                 : 
      80                 : 
      81                 : class XmlWrtAttr {
      82                 : private:
      83                 :   const XMLCh *name;
      84                 :   const XMLCh *value;
      85                 :   bool  oidAttr;
      86                 : public:
      87                 :   const XMLCh *getName();
      88                 :   const XMLCh *getValue();
      89                 :   bool isOid();
      90                 :   XmlWrtAttr(const XMLCh *name,const XMLCh *value);
      91                 :   XmlWrtAttr(const XMLCh *name,const XMLCh *value,bool isOid);
      92                 : };
      93                 : 
      94                 : class XmlWriter {
      95                 : private:
      96                 :   XMLFormatter *out;
      97                 :   XMLFormatTarget* destination;
      98                 : public:
      99                 :   ~XmlWriter();
     100                 :   XmlWriter();
     101                 :   void open(const char *filename);
     102                 :   void startElement(int tagid,XmlWrtAttr attrv[],int attrc);
     103                 :   void endElement(int tagid);
     104                 :   void endElement();
     105                 :   void characters(const XMLCh *const chars);
     106                 :   void close();
     107                 :   void printNewLine();
     108                 :   void printIndent(int level);
     109                 : private:
     110                 :   std::stack<int> stack;
     111                 : };
     112                 : 
     113                 : class IomIterator { 
     114                 : private: 
     115                 :   struct iom_iterator *pointee;
     116                 : public:
     117                 :   IomIterator(){pointee=0;}
     118                 :   IomIterator(struct iom_iterator *pointee1);
     119                 :   IomIterator(const IomIterator& src);
     120                 :   IomIterator& operator=(const IomIterator& src);
     121                 :   ~IomIterator();
     122                 :   struct iom_iterator& operator*() const
     123                 :   {
     124                 :     return *pointee;
     125                 :   }
     126               0 :   struct iom_iterator* operator->() const
     127                 :   {
     128               0 :     return pointee;
     129                 :   }
     130                 :   bool isNull(){return pointee==0;}
     131                 : };
     132                 : 
     133                 : class IomFile { 
     134                 : private: 
     135                 :   struct iom_file *pointee;
     136                 : public:
     137               0 :   IomFile(){pointee=0;}
     138                 :   IomFile(struct iom_file *pointee1);
     139                 :   IomFile(const IomFile& src);
     140                 :   IomFile& operator=(const IomFile& src);
     141                 :   ~IomFile();
     142                 :   struct iom_file& operator*() const
     143                 :   {
     144                 :     return *pointee;
     145                 :   }
     146               0 :   struct iom_file* operator->() const
     147                 :   {
     148               0 :     return pointee;
     149                 :   }
     150                 :   bool isNull(){return pointee==0;}
     151                 : };
     152                 : class IomBasket { 
     153                 : private: 
     154                 :   struct iom_basket *pointee;
     155                 : public:
     156             448 :   IomBasket(){pointee=0;}
     157                 :   IomBasket(struct iom_basket *pointee1);
     158                 :   IomBasket(const IomBasket& src);
     159                 :   IomBasket& operator=(const IomBasket& src);
     160                 :   ~IomBasket();
     161               0 :   struct iom_basket& operator*() const
     162                 :   {
     163               0 :     return *pointee;
     164                 :   }
     165               0 :   struct iom_basket* operator->() const
     166                 :   {
     167               0 :     return pointee;
     168                 :   }
     169               0 :   bool isNull(){return pointee==0;}
     170                 : };
     171                 : 
     172                 : class IomObject { 
     173                 : protected: 
     174                 :   struct iom_object *pointee;
     175                 : public:
     176               0 :   IomObject(){pointee=0;}
     177                 :   IomObject(struct iom_object *pointee1);
     178                 :   IomObject(const IomObject& src);
     179                 :   IomObject& operator=(const IomObject& src);
     180                 :   ~IomObject();
     181               0 :   struct iom_object& operator*() const
     182                 :   {
     183               0 :     return *pointee;
     184                 :   }
     185               0 :   struct iom_object* operator->() const
     186                 :   {
     187               0 :     return pointee;
     188                 :   }
     189               0 :   bool isNull(){return pointee==0;}
     190                 : };
     191                 : 
     192                 : struct iom_file {
     193                 : private:
     194                 :     XMLPScanToken token;
     195                 :     SAX2XMLReader* parser;
     196                 :     class ParserHandler* handler;
     197                 :     // table of baskets
     198                 :     std::vector<IomBasket> basketv;
     199                 : public:
     200                 :     void addBasket(IomBasket basket);
     201                 :     IomBasket getBasket(const XMLCh *oid);
     202                 : private:
     203                 :     const char *filename;
     204                 : public:
     205                 :     ~iom_file();
     206                 :     iom_file();
     207                 :     int readHeader(const char *model);
     208                 :     int readBasket(IomFile file);
     209                 :     int readLoop(const char *filename);
     210                 :     void setFilename(const char *filename);
     211                 :     int save();
     212                 : private:
     213                 :     int useCount;
     214                 : public:
     215               0 :     struct iom_file *getRef(){useCount++;return this;}
     216               0 :     int freeRef(){useCount--;return useCount;}
     217                 : 
     218                 : 
     219                 : private:
     220                 :     IomBasket ilibasket;
     221                 : 
     222                 : public:
     223                 :     void setModel(IomBasket model);
     224                 :     IomBasket getModel();
     225                 : 
     226                 : private:
     227                 :     XMLCh *headversion_w;
     228                 :     char *headversion_c;
     229                 : public:
     230                 :     void setHeadSecVersion(const XMLCh *version);
     231                 :     const char *getHeadSecVersion_c();
     232                 :     const XMLCh *getHeadSecVersion();
     233                 : 
     234                 : private:
     235                 :     XMLCh *headsender_w;
     236                 :     char *headsender_c;
     237                 : public:
     238                 :     void setHeadSecSender(const XMLCh *sender);
     239                 :     const char *getHeadSecSender_c();
     240                 :     const XMLCh *getHeadSecSender();
     241                 : 
     242                 : private:
     243                 :     XMLCh *headcomment_w;
     244                 :     char *headcomment_c;
     245                 : public:
     246                 :     void setHeadSecComment(const XMLCh *comment);
     247                 :     const char *getHeadSecComment_c();
     248                 :     const XMLCh *getHeadSecComment();
     249                 : private:
     250                 :     void writePolyline(XmlWriter &out, IomObject &obj,bool hasLineAttr);
     251                 :     void writeSurface(XmlWriter &out, IomObject &obj);
     252                 :     void writeAttrs(XmlWriter &out, IomObject &obj);
     253                 :     void writeAttr(XmlWriter &out, IomObject &obj,int attr);
     254                 : private:
     255                 :     // map<int classTag,vector<pair<int pos,int attrName>>>
     256                 :     typedef std::vector< std::pair<int,int> > attrv_type;
     257                 :     typedef std::map<int,attrv_type> tagv_type;
     258                 :     tagv_type tagList;    
     259                 :     void buildTagList();
     260                 :     int getQualifiedTypeName(IomObject &aclass);
     261                 : 
     262                 : private:
     263                 : public:
     264                 :     friend struct iom_iterator;
     265                 : };
     266                 : 
     267                 : 
     268                 : struct iom_basket {
     269                 :     struct iom_file *file; // use weak pointer to avoid a circular reference in the smart pointers
     270                 : private:
     271                 :     int tag;
     272                 :     char *tag_c;
     273                 : public:
     274                 :     void setTag(int tag);
     275                 :     const char *getTag_c();
     276                 :     int getTag();
     277                 : private:
     278                 :     int xmlLine;
     279                 :     int xmlCol;
     280                 : public:
     281                 :     void setXMLLineNumber(int line);
     282                 :     int getXMLLineNumber();
     283                 :     void setXMLColumnNumber(int col);
     284                 :     int getXMLColumnNumber();
     285                 : 
     286                 : private:
     287                 :     int consistency;
     288                 : public:
     289                 :     void setConsistency(int cons);
     290                 :     int getConsistency();
     291                 : 
     292                 : private:
     293                 :     int kind;
     294                 : public:
     295                 :     void setKind(int kind);
     296                 :     int getKind();
     297                 : 
     298                 : private:
     299                 :     XMLCh *oid_w;
     300                 :     char *oid_c;
     301                 : public:
     302                 :     void setOid(const XMLCh *oid);
     303                 :     const char *getOid_c();
     304                 :     const XMLCh *getOid();
     305                 : private:
     306                 :     XMLCh *startstate_w;
     307                 :     char *startstate_c;
     308                 : public:
     309                 :     void setStartState(const XMLCh *startstate);
     310                 :     const char *getStartState_c();
     311                 :     const XMLCh *getStartState();
     312                 : private:
     313                 :     XMLCh *endstate_w;
     314                 :     char *endstate_c;
     315                 : public:
     316                 :     void setEndState(const XMLCh *endstate);
     317                 :     const char *getEndState_c();
     318                 :     const XMLCh *getEndState();
     319                 : private:
     320                 :     XMLCh *topics_w;
     321                 :     char *topics_c;
     322                 : public:
     323                 :     void setTopics(const XMLCh *topics);
     324                 :     const char *getTopics_c();
     325                 :     const XMLCh *getTopics();
     326                 : public:
     327                 :     iom_basket();
     328                 :     ~iom_basket();
     329                 : private:
     330                 :     int useCount;
     331                 : public:
     332               0 :     struct iom_basket *getRef(){useCount++;return this;}
     333               0 :     int freeRef(){useCount--;return useCount;}
     334                 : private:
     335                 :     std::vector<IomObject> objectv;
     336                 : public:
     337                 :     void addObject(IomObject object);
     338                 :     IomObject getObject(const XMLCh *oid);
     339                 : 
     340                 :     friend struct iom_iterator;
     341                 : };
     342                 : 
     343               0 : class iom_value {
     344                 : private:
     345                 :   const XMLCh *str;
     346                 :   IomObject obj;
     347                 :   iom_value(); 
     348                 : public:
     349                 :   iom_value(IomObject value); 
     350                 :   iom_value(const XMLCh *value); 
     351                 :   const XMLCh *getStr();
     352                 :   IomObject getObj();
     353                 : };
     354                 : 
     355                 : struct iom_object {
     356                 : private:
     357                 :   int useCount;
     358                 : public:
     359               0 :   struct iom_object *getRef(){useCount++;return this;}
     360               0 :   int freeRef(){useCount--;return useCount;}
     361                 : private:
     362                 :   struct iom_basket *basket; // use weak pointer to avoid a circular reference in the smart pointers
     363                 : public:
     364                 :   void setBasket(IomBasket basket);
     365                 : public:
     366                 :     //iom_object();
     367                 :     iom_object();
     368                 :     virtual ~iom_object();
     369                 : 
     370                 : private:
     371                 :     int consistency;
     372                 : public:
     373                 :     void setConsistency(int cons);
     374                 :     int getConsistency();
     375                 : 
     376                 : private:
     377                 :     int operation;
     378                 : public:
     379                 :     void setOperation(int op);
     380                 :     int getOperation();
     381                 : 
     382                 : private:
     383                 :     int tag;
     384                 :     char *tag_c;
     385                 : public:
     386                 :     void setTag(int tag);
     387                 :     const char *getTag_c();
     388                 :     int getTag();
     389                 : 
     390                 : private:
     391                 :   int xmlLine;
     392                 :   int xmlCol;
     393                 : public:
     394                 :     void setXMLLineNumber(int line);
     395                 :     int getXMLLineNumber();
     396                 :     void setXMLColumnNumber(int col);
     397                 :     int getXMLColumnNumber();
     398                 : 
     399                 : private:
     400                 :     XMLCh *oid_w;
     401                 :     char *oid_c;
     402                 : public:
     403                 :     void setOid(const XMLCh *oid);
     404                 :     const XMLCh *getOid();
     405                 :     const char *getOid_c();
     406                 : 
     407                 : private:
     408                 :     XMLCh *bid_w;
     409                 :     char *bid_c;
     410                 : public:
     411                 :     void setBid(const XMLCh *bid);
     412                 :     const char *getBid_c();
     413                 :     const XMLCh* getBid();
     414                 : 
     415                 : private:
     416                 :     XMLCh *refOid_w;
     417                 :     char *refOid_c;
     418                 : public:
     419                 :     void setRefOid(const XMLCh *oid);
     420                 :     const XMLCh *getRefOid();
     421                 :     const char *getRefOid_c();
     422                 : private:
     423                 :     XMLCh *refBid_w;
     424                 :     char *refBid_c;
     425                 : public:
     426                 :     void setRefBid(const XMLCh *bid);
     427                 :     const XMLCh *getRefBid();
     428                 :     const char *getRefBid_c();
     429                 : 
     430                 : private:
     431                 :     unsigned int refOrderPos;
     432                 : public:
     433                 :     unsigned int getRefOrderPos();
     434                 :     void setRefOrderPos(unsigned int value);
     435                 : 
     436                 : private:
     437                 :     // ArrayList<(String attrName,int index)>
     438                 :     typedef std::pair<int,int> xmlele_type;
     439                 :     typedef std::vector<xmlele_type> xmleleidxv_type;
     440                 :     xmleleidxv_type xmleleidxv;
     441                 : public:
     442                 :     int getXmleleCount();
     443                 :     int getXmleleAttrName(int index);
     444                 :     int getXmleleValueIdx(int index);
     445                 : 
     446                 : 
     447                 : private:
     448                 :     // HashMap<String attrName,ArrayList<String|IliObject>>
     449                 :     typedef std::vector<class iom_value> valuev_type;
     450                 :     typedef std::map<int,valuev_type> attrValuev_type;
     451                 :     attrValuev_type attrValuev;   
     452                 : public:
     453                 :     void dumpAttrs();
     454                 :     void parser_addAttrValue(int attrName,IomObject value);
     455                 :     void parser_addAttrValue(int attrName,const XMLCh *value);
     456                 :     //void setAttrValue(int attrName,IomObject value);
     457                 :     int getAttrCount();
     458                 :     int getAttrName(int index);
     459                 :     int getAttrValueCount(int attrName);
     460                 :     void setAttrUndefined(int attrName);
     461                 :     const XMLCh *getAttrValue(int attrName);
     462                 :     void setAttrValue(int attrName,const XMLCh *value);
     463                 :     const XMLCh *getAttrPrim(int attrName,int index);
     464                 :     IomObject getAttrObj(int attrName,int index);
     465                 :     void setAttrObj(int attrName,int index,IomObject value);
     466                 :     void insertAttrObj(int attrName,int index,IomObject value);
     467                 :     void addAttrObj(int attrName,IomObject value);
     468                 :     void removeAttrObj(int attrName,int index);
     469                 : };
     470                 : 
     471                 : struct iom_iterator {
     472                 :     enum { eBASKET,eOBJECT } type;
     473                 :     ~iom_iterator();
     474                 : private:
     475                 :     int useCount;
     476                 : public:
     477               0 :     struct iom_iterator *getRef(){useCount++;return this;}
     478               0 :     int freeRef(){useCount--;return useCount;}
     479                 : private:
     480                 :     IomFile basketv;
     481                 :     std::vector<IomBasket>::size_type basketi;
     482                 : public:
     483                 :     iom_iterator(IomFile file);
     484                 :     IomBasket next_basket();
     485                 : private:
     486                 :     IomBasket objectv;
     487                 :     std::vector<IomObject>::size_type objecti;
     488                 : public:
     489                 :     iom_iterator(IomBasket basket);
     490                 :     IomObject next_object();
     491                 : };
     492                 : 
     493                 : class Element {
     494                 : public:
     495                 :   IomObject object;
     496                 :   int propertyName;
     497                 :   Element(); 
     498                 :   Element(const Element& src);
     499                 :   Element& operator=(const Element& src);
     500                 :   ~Element();
     501                 : 
     502                 : private:
     503                 :   XMLCh *oid;
     504                 : public:
     505                 :   const XMLCh *getOid();
     506                 :   void setOid(const XMLCh *oid);
     507                 : 
     508                 : private:
     509                 :   XMLCh *bid;
     510                 : public:
     511                 :   const XMLCh *getBid();
     512                 :   void setBid(const XMLCh *bid);
     513                 : 
     514                 : private:
     515                 :   unsigned int orderPos;
     516                 : public:
     517                 :   unsigned int getOrderPos();
     518                 :   void setOrderPos(unsigned int value);
     519                 : };
     520                 : 
     521                 : 
     522                 : class ParserHandler : 
     523                 : public DefaultHandler
     524                 : {
     525                 : 
     526                 : public :
     527                 :     ParserHandler(IOM_FILE file,const char* model);
     528                 :     ~ParserHandler();
     529                 : 
     530                 : private:
     531                 :   // table of element and attribute names
     532                 :   static XMLStringPool *namev;
     533                 : public:
     534                 :   static void at_iom_end();
     535                 : 
     536                 : public:
     537                 :   static int getTagId(const char *name);
     538                 :   static int getTagId(const XMLCh *const name);
     539                 :   static const XMLCh *const getTagName(int tagid);
     540                 : 
     541                 : public:
     542                 :   // SAX handler
     543                 : #if XERCES_VERSION_MAJOR >= 3
     544                 :   void  characters (const XMLCh *const chars, const XMLSize_t length); // xerces 3
     545                 :   // void  ignorableWhitespace (const XMLCh *const chars, const XMLSize_t length); // xerces 3
     546                 : #else
     547                 :   void  characters (const XMLCh *const chars, const unsigned int length); // xerces 2
     548                 :   // void  ignorableWhitespace (const XMLCh *const chars, const unsigned int length); // xerces 2
     549                 : #endif
     550                 :   // void  startDocument ();
     551                 :   // void  endDocument ();
     552                 :   void  startElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs);
     553                 :   void  endElement (const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname);
     554                 :   // void  processingInstruction (const XMLCh *const target, const XMLCh *const data); 
     555                 :   void  setDocumentLocator (const Locator *const locator);
     556                 :   // void  startPrefixMapping (const XMLCh *const prefix, const XMLCh *const uri);
     557                 :   // void  endPrefixMapping (const XMLCh *const prefix);
     558                 :   // void  skippedEntity (const XMLCh *const name);
     559                 :         void startEntity (const XMLCh *const name);
     560                 :  
     561                 : 
     562                 :     void warning(const SAXParseException& exc);
     563                 :     void error(const SAXParseException& exc);
     564                 :     void fatalError(const SAXParseException& exc);
     565                 : 
     566                 : private:
     567                 :   const Locator *locator;
     568                 : 
     569                 : private:
     570                 :   struct iom_file *file;
     571                 :   char *model;
     572                 :   int skip;
     573                 :   int level;
     574                 :   int state;
     575                 :   XMLBuffer propertyValue;
     576                 :   IomBasket dataContainer; 
     577                 :   IomObject object;
     578                 :         int m_nEntityCounter;
     579                 :   std::stack<class Element> objStack;
     580                 :   std::stack<int> stateStack;
     581                 :   void pushReturnState(int returnState);
     582                 :   void popReturnState();
     583                 :   void changeReturnState(int returnState);
     584                 : 
     585                 : private:
     586                 :     enum e_states {
     587                 :       BEFORE_TRANSFER=1,
     588                 :       BEFORE_DATASECTION=2,
     589                 :       BEFORE_BASKET=3,
     590                 :       BEFORE_OBJECT=4,
     591                 :       // StructValue
     592                 :       ST_BEFORE_PROPERTY=5,
     593                 :       ST_AFTER_STRUCTVALUE=6,
     594                 :       ST_BEFORE_EMBASSOC=7,
     595                 :       ST_BEFORE_CHARACTERS=8,
     596                 :       ST_AFTER_COORD=9,
     597                 :       ST_AFTER_POLYLINE=10,
     598                 :       ST_AFTER_SURFACE=11,
     599                 :       // CoordValue
     600                 :       CV_COORD=20,
     601                 :       CV_C1=21,
     602                 :       CV_AFTER_C1=22,
     603                 :       CV_C2=23,
     604                 :       CV_AFTER_C2=24,
     605                 :       CV_C3=25,
     606                 :       CV_AFTER_C3=26,
     607                 :       // PolylineValue
     608                 :       PV_POLYLINE=40,
     609                 :       PV_LINEATTR=41,
     610                 :       PV_AFTER_LINEATTRSTRUCT=42,
     611                 :       PV_AFTER_LINEATTR=43,
     612                 :       PV_CLIPPED=44,
     613                 :       PV_AFTER_CLIPPED=45,
     614                 :       // SegmentSequence
     615                 :       SS_AFTER_COORD=60,
     616                 :       // SurfaceValue
     617                 :       SV_SURFACE=80,
     618                 :       SV_CLIPPED=81,
     619                 :       SV_AFTER_CLIPPED=82,
     620                 :       // Boundaries
     621                 :       BD_BOUNDARY=100,
     622                 :       BD_AFTER_POLYLINE=101,
     623                 :       BD_AFTER_BOUNDARY=102,
     624                 :       // HeaderSection
     625                 :       START_HEADERSECTION=200
     626                 :     };
     627                 : };
     628                 : 
     629                 : 
     630                 : class tags {
     631                 : public:
     632                 :   static int get_COORD();
     633                 :   static int get_ARC();
     634                 :   static int get_C1();
     635                 :   static int get_C2();
     636                 :   static int get_C3();
     637                 :   static int get_A1();
     638                 :   static int get_A2();
     639                 :   static int get_iom04_metamodel_AssociationDef();
     640                 :   static int get_R();
     641                 :   static int get_lineattr();
     642                 :   static int get_TRANSFER();
     643                 :   static int get_iom04_metamodel_Table();
     644                 :   static int get_DATASECTION();
     645                 :   static int get_HEADERSECTION();
     646                 :   static int get_ALIAS();
     647                 :   static int get_COMMENT();
     648                 :   static int get_CLIPPED();
     649                 :   static int get_LINEATTR();
     650                 :   static int get_SEGMENTS();
     651                 :   static int get_segment();
     652                 :   static int get_SURFACE();
     653                 :   static int get_surface();
     654                 :   static int get_boundary();
     655                 :   static int get_BOUNDARY();
     656                 :   static int get_polyline();
     657                 :   static int get_POLYLINE();
     658                 :   static int get_sequence();
     659                 :   static int get_MULTISURFACE();
     660                 :   static int get_iom04_metamodel_ViewableAttributesAndRoles();
     661                 :   static int get_viewable();
     662                 :   static int get_attributesAndRoles();
     663                 :   static int get_container();
     664                 :   static int get_iom04_metamodel_TransferDescription();
     665                 :   static int get_name();
     666                 :   static void clear();
     667                 : private:
     668                 :   static int COORD;
     669                 :   static int ARC;
     670                 :   static int C1;
     671                 :   static int C2;
     672                 :   static int C3;
     673                 :   static int A1;
     674                 :   static int A2;
     675                 :   static int iom04_metamodel_AssociationDef;
     676                 :   static int R;
     677                 :   static int lineattr;
     678                 :   static int TRANSFER;
     679                 :   static int iom04_metamodel_Table;
     680                 :   static int DATASECTION;
     681                 :   static int HEADERSECTION;
     682                 :   static int ALIAS;
     683                 :   static int COMMENT;
     684                 :   static int CLIPPED;
     685                 :   static int LINEATTR;
     686                 :   static int SEGMENTS;
     687                 :   static int segment;
     688                 :   static int SURFACE;
     689                 :   static int surface;
     690                 :   static int boundary;
     691                 :   static int BOUNDARY;
     692                 :   static int polyline;
     693                 :   static int POLYLINE;
     694                 :   static int sequence;
     695                 :   static int MULTISURFACE;
     696                 :   static int iom04_metamodel_ViewableAttributesAndRoles;
     697                 :   static int viewable;
     698                 :   static int attributesAndRoles;
     699                 :   static int container;
     700                 :   static int iom04_metamodel_TransferDescription;
     701                 :   static int name;
     702                 : };
     703                 : class ustrings {
     704                 : public:
     705                 :   static const XMLCh*  get_xmlns();
     706                 :   static const XMLCh*  get_NS_INTERLIS22();
     707                 :   static const XMLCh*  get_BID();
     708                 :   static const XMLCh*  get_TOPICS();
     709                 :   static const XMLCh*  get_KIND();
     710                 :   static const XMLCh*  get_STARTSTATE();
     711                 :   static const XMLCh*  get_ENDSTATE();
     712                 :   static const XMLCh*  get_TID();
     713                 :   static const XMLCh*  get_OPERATION();
     714                 :   static const XMLCh*  get_INSERT();
     715                 :   static const XMLCh*  get_UPDATE();
     716                 :   static const XMLCh*  get_DELETE();
     717                 :   static const XMLCh*  get_REF();
     718                 :   static const XMLCh*  get_EXTREF();
     719                 :   static const XMLCh*  get_ORDER_POS();
     720                 :   static const XMLCh*  get_CONSISTENCY();
     721                 :   static const XMLCh*  get_COMPLETE();
     722                 :   static const XMLCh*  get_INCOMPLETE();
     723                 :   static const XMLCh*  get_INCONSISTENT();
     724                 :   static const XMLCh*  get_ADAPTED();
     725                 :   static const XMLCh*  get_SENDER();
     726                 :   static const XMLCh*  get_VERSION();
     727                 :   static const XMLCh*  get_INITIAL();
     728                 : 
     729                 : };
     730                 : 
     731                 : char *iom_toUTF8(const XMLCh *src);
     732                 : XMLCh *iom_fromUTF8(const char *src);
     733                 : 
     734                 : // ---------------------------------------------------------------------------
     735                 : //  This is a simple class that lets us do easy (though not terribly efficient)
     736                 : //  trancoding of XMLCh data to local code page for display.
     737                 : // ---------------------------------------------------------------------------
     738                 : class StrX
     739                 : {
     740                 : public :
     741                 :     // -----------------------------------------------------------------------
     742                 :     //  Constructors and Destructor
     743                 :     // -----------------------------------------------------------------------
     744               0 :     StrX(const XMLCh* const toTranscode)
     745                 :     {
     746                 :         // Call the private transcoding method
     747               0 :         fLocalForm = XMLString::transcode(toTranscode);
     748               0 :     }
     749                 : 
     750               0 :     ~StrX()
     751                 :     {
     752               0 :         XMLString::release(&fLocalForm);
     753               0 :     }
     754                 : 
     755                 :     // -----------------------------------------------------------------------
     756                 :     //  Getter methods
     757                 :     // -----------------------------------------------------------------------
     758               0 :     const char* localForm() const
     759                 :     {
     760               0 :         return fLocalForm;
     761                 :     }
     762                 : 
     763                 : private :
     764                 :     // -----------------------------------------------------------------------
     765                 :     //  Private data members
     766                 :     //
     767                 :     //  fLocalForm
     768                 :     //      This is the local code page form of the string.
     769                 :     // -----------------------------------------------------------------------
     770                 :     char*   fLocalForm;
     771                 : };
     772                 : 
     773               0 : inline std::ostream& operator<<(std::ostream& target, const StrX& toDump)
     774                 : {
     775               0 :     target << toDump.localForm();
     776               0 :     return target;
     777                 : }
     778                 : 
     779                 : // ---------------------------------------------------------------------------
     780                 : //  This is a simple class that lets us do easy (though not terribly efficient)
     781                 : //  trancoding of char* data to XMLCh data.
     782                 : // ---------------------------------------------------------------------------
     783                 : class XStr
     784                 : {
     785                 : public :
     786                 :     // -----------------------------------------------------------------------
     787                 :     //  Constructors and Destructor
     788                 :     // -----------------------------------------------------------------------
     789               0 :     XStr(const char* const toTranscode)
     790                 :     {
     791                 :         // Call the private transcoding method
     792               0 :         fUnicodeForm = XMLString::transcode(toTranscode);
     793               0 :     }
     794                 : 
     795               0 :     ~XStr()
     796                 :     {
     797               0 :         XMLString::release(&fUnicodeForm);
     798               0 :     }
     799                 : 
     800                 : 
     801                 :     // -----------------------------------------------------------------------
     802                 :     //  Getter methods
     803                 :     // -----------------------------------------------------------------------
     804               0 :     const XMLCh* unicodeForm() const
     805                 :     {
     806               0 :         return fUnicodeForm;
     807                 :     }
     808                 : 
     809                 : private :
     810                 :     // -----------------------------------------------------------------------
     811                 :     //  Private data members
     812                 :     //
     813                 :     //  fUnicodeForm
     814                 :     //      This is the Unicode XMLCh format of the string.
     815                 :     // -----------------------------------------------------------------------
     816                 :     XMLCh*   fUnicodeForm;
     817                 : };
     818                 : 
     819                 : #define X(str) XStr(str).unicodeForm()
     820                 : 
     821                 : /** namespace of error handler.
     822                 : */
     823                 : class ErrorUtility {
     824                 : public:
     825                 :   static IomBasket errs;
     826                 :   static int errc;
     827                 :   static XMLCh itoabuf[40];
     828                 :   static IOM_ERRLISTENER listener;
     829                 :   static void at_iom_end();
     830                 :   static void notifyerr(IomObject obj);
     831                 :   static void init();
     832                 : };
     833                 : 
     834                 : 
     835                 : #endif

Generated by: LTP GCOV extension version 1.5