← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/itemfactory into lp:zorba

 

Rodolfo Ochoa has proposed merging lp:~zorba-coders/zorba/itemfactory into lp:zorba.

Requested reviews:
  Cezar Andrei (cezar-andrei)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/itemfactory/+merge/79181

Item Factory class added for SWIG API, many methods included, need to be tested on linux.
-- 
https://code.launchpad.net/~zorba-coders/zorba/itemfactory/+merge/79181
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'swig/CMakeLists.txt'
--- swig/CMakeLists.txt	2011-09-09 16:33:19 +0000
+++ swig/CMakeLists.txt	2011-10-12 21:04:05 +0000
@@ -26,6 +26,7 @@
   SET (SWIG_MODULE_zorba_api_EXTRA_DEPS ${SWIG_FILES})
   SET (SWIG_MODULE_libzorba_api_EXTRA_DEPS ${SWIG_FILES})
 
+  
   # on apple and cmake 2.8, the generated swig libraries are prefixed with "lib"
   SET (ZORBA_SWIG_LIB_PREFIX)
   IF (APPLE AND CMAKE_MINOR_VERSION GREATER 6)

=== added file 'swig/ItemFactory.h'
--- swig/ItemFactory.h	1970-01-01 00:00:00 +0000
+++ swig/ItemFactory.h	2011-10-12 21:04:05 +0000
@@ -0,0 +1,69 @@
+// Interface
+
+class ItemFactory
+{
+
+  private:
+    zorba::ItemFactory* theItemFactory;
+  public:
+    ItemFactory(): theItemFactory(0) {}
+    ItemFactory(zorba::ItemFactory* aItemFactory) : theItemFactory(aItemFactory) {}
+    ItemFactory(const ItemFactory& aItemFactory) : theItemFactory(aItemFactory.theItemFactory) {}
+
+    Item 	createAnyURI (const std::string &aURI);
+    Item 	createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, Item aTypedValue);
+    Item 	createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, std::vector< Item > aTypedValue);
+    Item 	createBase64Binary (const char *aBinData, size_t aLength);
+    Item 	createBase64Binary (std::istream &aStream);
+    Item 	createBase64Binary (const unsigned char *aBinData, size_t aLength);
+    Item 	createBoolean (bool aValue);
+    Item 	createByte (char aByte);
+    Item 	createDate (const std::string &aDate);
+    Item 	createDate (short aYear, short aMonth, short aDay);
+    Item 	createDateTime (const std::string &aDateTimeValue);
+    Item 	createDateTime (short aYear, short aMonth, short aDay, short aHour, short aMinute, double aSecond, short aTimeZone_hours);
+    Item 	createDecimal (const std::string &aValue);
+    Item 	createDecimalFromDouble (double aValue);
+    Item 	createDecimalFromLong (unsigned long aValue);
+    Item 	createDouble (const std::string &aValue);
+    Item 	createDouble (double aValue);
+    Item 	createDuration (const std::string &aValue);
+    Item 	createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds);
+    //Item 	createElementNode (Item &aParent, Item aNodeName, Item aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings);
+    Item 	createFloat (const std::string &aValue);
+    Item 	createFloat (float aValue);
+    Item 	createGDay (const std::string &aValue);
+    Item 	createGDay (short aDay);
+    Item 	createGMonth (const std::string &aValue);
+    Item 	createGMonth (short aMonth);
+    Item 	createGMonthDay (const std::string &aValue);
+    Item 	createGMonthDay (short aMonth, short aDay);
+    Item 	createGYear (short aYear);
+    Item 	createGYear (const std::string &aValue);
+    Item 	createGYearMonth (const std::string &aValue);
+    Item 	createGYearMonth (short aYear, short aMonth);
+    Item 	createHexBinary (const char *aHexData, size_t aSize);
+    Item 	createInt (int aInt);
+    Item 	createInteger (const std::string &aInteger);
+    Item 	createInteger (long long aInteger);
+    Item 	createLong (long long aLong);
+    Item 	createNCName (const std::string &aValue);
+    Item 	createNegativeInteger (long long aValue);
+    Item 	createNonNegativeInteger (unsigned long long aValue);
+    Item 	createNonPositiveInteger (long long aValue);
+    Item 	createPositiveInteger (unsigned long long aValue);
+    Item 	createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname);
+    Item 	createQName (const std::string &aNamespace, const std::string &aLocalname);
+    Item 	createQName (const std::string &aQNameString);
+    Item 	createShort (short aShort);
+    //Item 	createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false);
+    Item 	createString (const std::string &aString);
+    Item 	createTextNode (Item parent, std::string content);
+    Item 	createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours);
+    Item 	createTime (short aHour, short aMinute, double aSecond);
+    Item 	createTime (const std::string &aValue);
+    Item 	createUnsignedByte (const unsigned char aValue);
+    Item 	createUnsignedInt (unsigned int aValue);
+    Item 	createUnsignedLong (unsigned long long aValue);
+    Item 	createUnsignedShort (unsigned short aValue);
+}; // class ItemFactory

=== added file 'swig/ItemFactory.i'
--- swig/ItemFactory.i	1970-01-01 00:00:00 +0000
+++ swig/ItemFactory.i	2011-10-12 21:04:05 +0000
@@ -0,0 +1,192 @@
+
+%{  // start Implementation
+
+
+ 
+  Item 	ItemFactory::createAnyURI (const std::string &aURI){
+    return Item(theItemFactory->createAnyURI(aURI));
+  }
+  
+  Item 	ItemFactory::createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, Item aTypedValue){
+    return Item( theItemFactory->createAttributeNode( aParent.theItem, aNodeName.theItem, aTypeName.theItem, aTypedValue.theItem ));
+  }
+  
+  Item 	ItemFactory::createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, std::vector< Item > aTypedValue){
+
+    std::vector< zorba::Item > typedValue;
+    typedValue.reserve(aTypedValue.size());
+    std::vector< Item >::iterator iter;
+    for(iter = aTypedValue.begin(); iter != aTypedValue.end(); iter++) {
+      typedValue.push_back((*iter).theItem);
+    }
+    return Item( theItemFactory->createAttributeNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, typedValue ));
+  }
+  
+  Item 	ItemFactory::createBase64Binary (const char *aBinData, size_t aLength){
+    return Item( theItemFactory->createBase64Binary(aBinData, aLength));
+  }
+  Item 	ItemFactory::createBase64Binary (std::istream &aStream){
+    return Item( theItemFactory->createBase64Binary(aStream));
+  }
+  Item 	ItemFactory::createBase64Binary (const unsigned char *aBinData, size_t aLength){
+    return Item( theItemFactory->createBase64Binary(aBinData, aLength));
+  }
+  Item 	ItemFactory::createBoolean (bool aValue){
+    return Item( theItemFactory->createBoolean(aValue));
+  }
+  Item 	ItemFactory::createByte (char aByte){
+    return Item( theItemFactory->createByte(aByte));
+  }
+  Item 	ItemFactory::createDate (const std::string &aDate){
+    return Item( theItemFactory->createDate(aDate));
+  }
+  Item 	ItemFactory::createDate (short aYear, short aMonth, short aDay){
+    return Item( theItemFactory->createDate (aYear, aMonth, aDay));
+  }
+  Item 	ItemFactory::createDateTime (const std::string &aDateTimeValue){
+    return Item( theItemFactory->createDateTime (aDateTimeValue));
+  }
+  Item 	ItemFactory::createDateTime (short aYear, short aMonth, short aDay, short aHour, short aMinute, double aSecond, short aTimeZone_hours){
+    return Item( theItemFactory->createDateTime (aYear, aMonth, aDay, aHour, aMinute, aSecond, aTimeZone_hours));
+  }
+  Item 	ItemFactory::createDecimal (const std::string &aValue){
+    return Item( theItemFactory->createDecimal (aValue));
+  }
+  Item 	ItemFactory::createDecimalFromDouble (double aValue){
+    return Item( theItemFactory->createDecimalFromDouble (aValue));
+  }
+  Item 	ItemFactory::createDecimalFromLong (unsigned long aValue){
+    return Item( theItemFactory->createDecimalFromLong (aValue));
+  }
+  Item 	ItemFactory::createDouble (const std::string &aValue){
+    return Item( theItemFactory->createDouble (aValue));
+  }
+  Item 	ItemFactory::createDouble (double aValue){
+    return Item( theItemFactory->createDouble (aValue));
+  }
+  Item 	ItemFactory::createDuration (const std::string &aValue){
+    return Item( theItemFactory->createDuration (aValue));
+  }
+  Item 	ItemFactory::createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds){
+    return Item( theItemFactory->createDuration (aYear, aMonths, aDays, aHours, aMinutes, aSeconds));
+  }
+  /*
+  Item 	ItemFactory::createElementNode (Item &aParent, Item aNodeName, Item aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings){
+    return Item( theItemFactory->createElementNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, aHasTypedValue, aHasEmptyValue, aNsBindings));
+  }
+  */
+  Item 	ItemFactory::createFloat (const std::string &aValue){
+    return Item( theItemFactory->createFloat (aValue));
+  }
+  Item 	ItemFactory::createFloat (float aValue){
+    return Item( theItemFactory->createFloat (aValue));
+  }
+  Item 	ItemFactory::createGDay (const std::string &aValue){
+    return Item( theItemFactory->createGDay (aValue));
+  }
+  Item 	ItemFactory::createGDay (short aDay){
+    return Item( theItemFactory->createGDay (aDay));
+  }
+  Item 	ItemFactory::createGMonth (const std::string &aValue){
+    return Item( theItemFactory->createGMonth (aValue));
+  }
+  Item 	ItemFactory::createGMonth (short aMonth){
+    return Item( theItemFactory->createGMonth (aMonth));
+  }
+  Item 	ItemFactory::createGMonthDay (const std::string &aValue){
+    return Item( theItemFactory->createGMonthDay (aValue));
+  }
+  Item 	ItemFactory::createGMonthDay (short aMonth, short aDay){
+    return Item( theItemFactory->createGMonthDay (aMonth, aDay));
+  }
+  Item 	ItemFactory::createGYear (short aYear){
+    return Item( theItemFactory->createGYear (aYear));
+  }
+  Item 	ItemFactory::createGYear (const std::string &aValue){
+    return Item( theItemFactory->createGYear (aValue));
+  }
+  Item 	ItemFactory::createGYearMonth (const std::string &aValue){
+    return Item( theItemFactory->createGYearMonth (aValue));
+  }
+  Item 	ItemFactory::createGYearMonth (short aYear, short aMonth){
+    return Item( theItemFactory->createGYearMonth (aYear, aMonth));
+  }
+  Item 	ItemFactory::createHexBinary (const char *aHexData, size_t aSize){
+    return Item( theItemFactory->createHexBinary (aHexData, aSize));
+  }
+  Item 	ItemFactory::createInt (int aInt){
+    return Item( theItemFactory->createInt (aInt));
+  }
+  Item 	ItemFactory::createInteger (const std::string &aInteger){
+    return Item( theItemFactory->createInteger (aInteger));
+  }
+  Item 	ItemFactory::createInteger (long long aInteger){
+    return Item( theItemFactory->createInteger (aInteger));
+  }
+  Item 	ItemFactory::createLong (long long aLong){
+    return Item( theItemFactory->createLong (aLong));
+  }
+  Item 	ItemFactory::createNCName (const std::string &aValue){
+    return Item( theItemFactory->createNCName (aValue));
+  }
+  Item 	ItemFactory::createNegativeInteger (long long aValue){
+    return Item( theItemFactory->createNegativeInteger (aValue));
+  }
+  Item 	ItemFactory::createNonNegativeInteger (unsigned long long aValue){
+    return Item( theItemFactory->createNonNegativeInteger (aValue));
+  }
+  Item 	ItemFactory::createNonPositiveInteger (long long aValue){
+    return Item( theItemFactory->createNonPositiveInteger (aValue));
+  }
+  Item 	ItemFactory::createPositiveInteger (unsigned long long aValue){
+    return Item( theItemFactory->createPositiveInteger (aValue));
+  }
+  Item 	ItemFactory::createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname){
+    return Item( theItemFactory->createQName (aNamespace, aPrefix, aLocalname));
+  }
+  Item 	ItemFactory::createQName (const std::string &aNamespace, const std::string &aLocalname){
+    return Item( theItemFactory->createQName (aNamespace, aLocalname));
+  }
+  Item 	ItemFactory::createQName (const std::string &aQNameString){
+    return Item( theItemFactory->createQName (aQNameString));
+  }
+  Item 	ItemFactory::createShort (short aShort){
+    return Item( theItemFactory->createShort (aShort));
+  }
+  /*
+  Item 	ItemFactory::createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false){
+    return Item( theItemFactory->createStreamableString (std::istream &stream, StreamReleaser streamReleaser, seekable));
+  }
+  */
+  Item 	ItemFactory::createString (const std::string &aString){
+    return Item( theItemFactory->createString (aString));
+  }
+  Item 	ItemFactory::createTextNode (Item parent, std::string content){
+    return Item( theItemFactory->createTextNode (parent.theItem, content));
+  }
+  Item 	ItemFactory::createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours){
+    return Item( theItemFactory->createTime (aHour, aMinute, aSecond, aTimeZone_hours));
+  }
+  Item 	ItemFactory::createTime (short aHour, short aMinute, double aSecond){
+    return Item( theItemFactory->createTime (aHour, aMinute, aSecond));
+  }
+  Item 	ItemFactory::createTime (const std::string &aValue){
+    return Item( theItemFactory->createTime (aValue));
+  }
+  Item 	ItemFactory::createUnsignedByte (const unsigned char aValue){
+    return Item( theItemFactory->createUnsignedByte (aValue));
+  }
+  Item 	ItemFactory::createUnsignedInt (unsigned int aValue){
+    return Item( theItemFactory->createUnsignedInt (aValue));
+  }
+  Item 	ItemFactory::createUnsignedLong (unsigned long long aValue){
+    return Item( theItemFactory->createUnsignedLong (aValue));
+  }
+  Item 	ItemFactory::createUnsignedShort (unsigned short aValue){
+    return Item( theItemFactory->createUnsignedShort (aValue));
+  }
+
+
+%}  // end Implementation
+
+%include "ItemFactory.h"
\ No newline at end of file

=== added file 'swig/StaticContext.h'
--- swig/StaticContext.h	1970-01-01 00:00:00 +0000
+++ swig/StaticContext.h	2011-10-12 21:04:05 +0000
@@ -0,0 +1,69 @@
+#include <zorba/static_context_consts.h>
+
+class StaticContext 
+{
+friend class Zorba;
+friend class XQuery;
+
+private:
+  zorba::StaticContext_t theStaticContext;
+public:
+  StaticContext();
+  StaticContext(const StaticContext& aStaticContext);
+  StaticContext::StaticContext(zorba::StaticContext_t aStaticContext);
+  
+  virtual void addColation(const std::string& aURI); 
+  virtual bool addNamespace(const std::string& aPrefix,
+                            const std::string& aURI);
+  void addReference() const;
+  virtual bool containsFunction(const std::string &aFnNameUri, 
+                                const std::string &aFnNameLocal, 
+                                int arity) const;
+
+  virtual StaticContext createChildContext() const;
+  virtual void declareOption(const Item &aQName, 
+                             const std::string &aOptionVal);
+  virtual void disableFunction(const Item &aQName, int arity);
+
+  virtual void free ();
+  virtual std::string getBaseURI () const;
+  virtual zorba::boundary_space_mode_t getBoundarySpacePolicy () const;
+
+  virtual zorba::construction_mode_t getConstructionMode () const;
+  virtual void getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const;
+  virtual std::string getDefaultCollation () const;
+  virtual std::string getDefaultElementAndTypeNamespace () const;
+  virtual std::string getDefaultFunctionNamespace () const;
+  virtual zorba::order_empty_mode_t getDefaultOrderForEmptySequences () const;
+
+  virtual std::string getNamespaceURIByPrefix(const std::string &aPrefix) const;
+  virtual bool getOption(const Item &aQName, std::string &aOptionValue) const;
+  virtual zorba::ordering_mode_t getOrderingMode() const;
+  long getRefCount() const;
+  virtual zorba::validation_mode_t getRevalidationMode();
+  virtual zorba::xpath1_0compatib_mode_t getXPath1_0CompatibMode () const;
+  virtual void loadProlog (const std::string & aProlog, 
+                           const CompilerHints &hints);
+
+  void removeReference ();
+  virtual void resetTraceStream ();
+  virtual bool setBaseURI (const std::string &aBaseURI);
+  virtual bool setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode);
+
+  virtual bool setConstructionMode (zorba::construction_mode_t aMode);
+
+  virtual bool setCopyNamespacesMode (zorba::preserve_mode_t aPreserve, 
+                                      zorba::inherit_mode_t aInherit);
+  virtual void setDefaultCollation (const std::string &aURI);
+  virtual bool setDefaultElementAndTypeNamespace (const std::string &aURI);
+  virtual bool setDefaultFunctionNamespace (const std::string &aURI);
+  virtual bool setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode);
+
+  virtual bool setOrderingMode (zorba::ordering_mode_t aMode);
+  virtual void setRevalidationMode (zorba::validation_mode_t aMode);
+
+  virtual bool setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode);
+
+  void destroy();
+}; // class StaticContext
+

=== modified file 'swig/StaticContext.i'
--- swig/StaticContext.i	2011-06-29 20:05:38 +0000
+++ swig/StaticContext.i	2011-10-12 21:04:05 +0000
@@ -20,149 +20,144 @@
 #include <zorba/static_context_consts.h>
 
 
-class StaticContext 
-{
-  friend class Zorba;
+StaticContext::StaticContext() {}
 
-private:
-  zorba::StaticContext_t theStaticContext;
-public:
-  StaticContext() {}
-  StaticContext(const StaticContext& aStaticContext) : 
+StaticContext::StaticContext(const StaticContext& aStaticContext) : 
     theStaticContext(aStaticContext.theStaticContext) {}
-  StaticContext(zorba::StaticContext_t aStaticContext) : 
+    
+StaticContext::StaticContext(zorba::StaticContext_t aStaticContext) : 
     theStaticContext(aStaticContext) {}
 
-  virtual void addColation(const std::string& aURI)
+void StaticContext::addColation(const std::string& aURI)
   { theStaticContext->addCollation(aURI); }
 
-  virtual bool addNamespace(const std::string& aPrefix, 
+bool StaticContext::addNamespace(const std::string& aPrefix, 
                             const std::string& aURI)
   { return theStaticContext->addNamespace(aPrefix, aURI); }
 
-  void addReference() const
+void StaticContext::addReference() const
   { theStaticContext->addReference(); }
   
-  virtual bool containsFunction(const std::string &aFnNameUri, 
+bool StaticContext::containsFunction(const std::string &aFnNameUri, 
                                 const std::string &aFnNameLocal, 
                                 int arity) const 
   { return theStaticContext->containsFunction(aFnNameUri, aFnNameLocal,
                                               arity); }
 
-  virtual StaticContext	createChildContext() const
+StaticContext	StaticContext::createChildContext() const
   { return StaticContext(theStaticContext->createChildContext()); }
   
-  virtual void 	declareOption (const Item &aQName, 
+void 	StaticContext::declareOption (const Item &aQName, 
                                const std::string &aOptionVal)
   { return theStaticContext->declareOption(aQName.theItem, aOptionVal); }
 
-  virtual void 	disableFunction (const Item &aQName, int arity)
+void 	StaticContext::disableFunction (const Item &aQName, int arity)
   { theStaticContext->disableFunction( aQName.theItem, arity); }
 
-  virtual void 	free ()
+void 	StaticContext::free ()
   { theStaticContext->free(); }
 
-  virtual std::string getBaseURI () const
+std::string StaticContext::getBaseURI () const
   { return std::string(theStaticContext->getBaseURI().c_str()); }
 
-  virtual zorba::boundary_space_mode_t getBoundarySpacePolicy() const
+zorba::boundary_space_mode_t StaticContext::getBoundarySpacePolicy() const
   { return theStaticContext->getBoundarySpacePolicy(); }
 
-  virtual zorba::construction_mode_t getConstructionMode () const 
+zorba::construction_mode_t StaticContext::getConstructionMode () const 
   { return theStaticContext->getConstructionMode(); }		
 
-  virtual void 	getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const
+void 	StaticContext::getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const
   { return theStaticContext->getCopyNamespacesMode(aPreserve, aInherit); }		
 
-  virtual std::string getDefaultCollation () const 
+std::string StaticContext::getDefaultCollation () const 
   { return std::string(theStaticContext->getDefaultCollation().c_str()); }
 
-  virtual std::string getDefaultElementAndTypeNamespace () const 
+std::string StaticContext::getDefaultElementAndTypeNamespace () const 
   { 
     return std::string(theStaticContext->getDefaultElementAndTypeNamespace().
                        c_str()); 
   }
 
-  virtual std::string getDefaultFunctionNamespace () const 
+std::string StaticContext::getDefaultFunctionNamespace () const 
   { 
     return std::string(theStaticContext->getDefaultFunctionNamespace().c_str());
   }
 
-  virtual zorba::order_empty_mode_t getDefaultOrderForEmptySequences() const
+zorba::order_empty_mode_t StaticContext::getDefaultOrderForEmptySequences() const
   { return theStaticContext->getDefaultOrderForEmptySequences(); }
 
-  virtual std::string getNamespaceURIByPrefix(const std::string &aPrefix) const
+std::string StaticContext::getNamespaceURIByPrefix(const std::string &aPrefix) const
   {
     return std::string(theStaticContext->getNamespaceURIByPrefix(aPrefix).
                        c_str());
   }
 
-  virtual bool getOption(const Item &aQName, std::string &aOptionValue) const
+bool StaticContext::getOption(const Item &aQName, std::string &aOptionValue) const
   { 
     zorba::String optVal = zorba::String(aOptionValue.c_str());
     return theStaticContext->getOption(aQName.theItem, optVal); 
   }
 
-  virtual zorba::ordering_mode_t getOrderingMode () const
+zorba::ordering_mode_t StaticContext::getOrderingMode () const
   { return theStaticContext->getOrderingMode(); }
 
-  long getRefCount () const
+long StaticContext::getRefCount () const
   { return theStaticContext->getRefCount(); }
 
-  virtual zorba::validation_mode_t getRevalidationMode ()
+zorba::validation_mode_t StaticContext::getRevalidationMode ()
   { return theStaticContext->getRevalidationMode(); }
 
-  virtual zorba::xpath1_0compatib_mode_t getXPath1_0CompatibMode () const
+zorba::xpath1_0compatib_mode_t StaticContext::getXPath1_0CompatibMode () const
   { return theStaticContext->getXPath1_0CompatibMode(); } 
 
-  virtual void loadProlog (const std::string & aProlog, 
+void StaticContext::loadProlog (const std::string & aProlog, 
                            const CompilerHints &hints)
   { theStaticContext->loadProlog( aProlog, hints.theCompilerHints); }
 
-  void removeReference ()
+void StaticContext::removeReference ()
   { theStaticContext->removeReference(); }
 
-  virtual void resetTraceStream ()
+void StaticContext::resetTraceStream ()
   { theStaticContext->resetTraceStream(); }
 
-  virtual bool setBaseURI (const std::string &aBaseURI)
+bool StaticContext::setBaseURI (const std::string &aBaseURI)
   { return theStaticContext->setBaseURI(aBaseURI); }
 
-  virtual bool setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode)
+bool StaticContext::setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode)
   { return theStaticContext->setBoundarySpacePolicy(aMode); } 
 
-  virtual bool setConstructionMode (zorba::construction_mode_t aMode)
+bool StaticContext::setConstructionMode (zorba::construction_mode_t aMode)
   { return theStaticContext->setConstructionMode(aMode); } 
 
-  virtual bool setCopyNamespacesMode (zorba::preserve_mode_t aPreserve, 
+bool StaticContext::setCopyNamespacesMode (zorba::preserve_mode_t aPreserve, 
     zorba::inherit_mode_t aInherit)
   { return theStaticContext->setCopyNamespacesMode(aPreserve, aInherit); }   
 
-  virtual void setDefaultCollation (const std::string &aURI)
+void StaticContext::setDefaultCollation (const std::string &aURI)
   { theStaticContext->setDefaultCollation(aURI); }
 
-  virtual bool setDefaultElementAndTypeNamespace (const std::string &aURI)
+bool StaticContext::setDefaultElementAndTypeNamespace (const std::string &aURI)
   { return theStaticContext->setDefaultElementAndTypeNamespace(aURI); }
 
-  virtual bool setDefaultFunctionNamespace (const std::string &aURI)
+bool StaticContext::setDefaultFunctionNamespace (const std::string &aURI)
   { return theStaticContext->setDefaultFunctionNamespace(aURI); }
 
-  virtual bool setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode)
+bool StaticContext::setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode)
   { return theStaticContext->setDefaultOrderForEmptySequences(aMode); } 
 
-  virtual bool setOrderingMode (zorba::ordering_mode_t aMode)
+bool StaticContext::setOrderingMode (zorba::ordering_mode_t aMode)
   { return theStaticContext->setOrderingMode(aMode); } 
 
-  virtual void setRevalidationMode (zorba::validation_mode_t aMode)
+void StaticContext::setRevalidationMode (zorba::validation_mode_t aMode)
   { return theStaticContext->setRevalidationMode(aMode); } 
 
-  virtual bool setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode)
+bool StaticContext::setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode)
   { return theStaticContext->setXPath1_0CompatibMode(aMode); }
 
-  void destroy() 
+void StaticContext::destroy() 
   { theStaticContext = 0; }
    
-}; // class StaticContext
+ // class StaticContext
 
 
 
@@ -209,63 +204,4 @@
 %rename(VALIDATE_LAX) validate_lax;
 %rename(VALIDATE_STRICT) validate_strict;
 
-#include <zorba/static_context_consts.h>
-
-
-class StaticContext 
-{
- public:
-  virtual void addColation(const std::string& aURI);  
-  virtual bool addNamespace(const std::string& aPrefix, 
-                            const std::string& aURI);
-  void addReference() const;
-  virtual bool containsFunction(const std::string &aFnNameUri, 
-                                const std::string &aFnNameLocal, 
-                                int arity) const;
-
-  virtual StaticContext createChildContext() const;
-  virtual void declareOption(const Item &aQName, 
-                             const std::string &aOptionVal);
-  virtual void disableFunction(const Item &aQName, int arity);
-
-  virtual void free ();
-  virtual std::string getBaseURI () const;
-  virtual zorba::boundary_space_mode_t getBoundarySpacePolicy () const;
-
-  virtual zorba::construction_mode_t getConstructionMode () const;
-  virtual void getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const;
-  virtual std::string getDefaultCollation () const;
-  virtual std::string getDefaultElementAndTypeNamespace () const;
-  virtual std::string getDefaultFunctionNamespace () const;
-  virtual zorba::order_empty_mode_t getDefaultOrderForEmptySequences () const;
-
-  virtual std::string getNamespaceURIByPrefix(const std::string &aPrefix) const;
-  virtual bool getOption(const Item &aQName, std::string &aOptionValue) const;
-  virtual zorba::ordering_mode_t getOrderingMode() const;
-  long getRefCount() const;
-  virtual zorba::validation_mode_t getRevalidationMode();
-  virtual zorba::xpath1_0compatib_mode_t getXPath1_0CompatibMode () const;
-  virtual void loadProlog (const std::string &, 
-                           const Zorba_CompilerHints_t &hints);
-
-  void removeReference ();
-  virtual void resetTraceStream ();
-  virtual bool setBaseURI (const std::string &aBaseURI);
-  virtual bool setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode);
-
-  virtual bool setConstructionMode (zorba::construction_mode_t aMode);
-
-  virtual bool setCopyNamespacesMode (zorba::preserve_mode_t aPreserve, 
-                                      zorba::inherit_mode_t aInherit);
-  virtual void setDefaultCollation (const std::string &aURI);
-  virtual bool setDefaultElementAndTypeNamespace (const std::string &aURI);
-  virtual bool setDefaultFunctionNamespace (const std::string &aURI);
-  virtual bool setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode);
-
-  virtual bool setOrderingMode (zorba::ordering_mode_t aMode);
-  virtual void setRevalidationMode (zorba::validation_mode_t aMode);
-
-  virtual bool setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode);
-
-  void destroy();
-}; // class StaticContext
+%include "StaticContext.h"

=== modified file 'swig/XQuery.i'
--- swig/XQuery.i	2011-07-20 01:40:52 +0000
+++ swig/XQuery.i	2011-10-12 21:04:05 +0000
@@ -1,333 +1,347 @@
-/*
- * Copyright 2006-2008 The FLWOR Foundation.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-%{  // start Implementation
-
-class Iterator 
-{
-protected:
-  friend class DynamicContext;
-  zorba::Iterator_t theIterator;
-  zorba::Item theItem;
-  bool theConsumed;
-
-public:
-  Iterator() {}
-  Iterator(const Iterator& anIterator)
-    : theIterator(anIterator.theIterator),
-      theItem(anIterator.theItem),
-      theConsumed(false)
-  {}
-
-  Iterator(zorba::Iterator_t anIterator)
-    : theIterator(anIterator),
-      theConsumed(false)
-  {}
-
-  Iterator(zorba::Item& aItem)
-    : theIterator(0),
-      theItem(aItem),
-      theConsumed(false)
-  {}
-
-  void open()
-  {
-    if (theIterator)
-      theIterator->open();
-    theConsumed = false;
-  }
-
-  bool next(Item& aItem);
-
-  void close()
-  {
-    if (theIterator)
-      theIterator->close();
-    theConsumed = true;
-  }
-
-  void destroy()
-  {
-    theIterator = 0;
-  }
-
-}; // class Iterator
-
-
-class Item 
-{
-  friend class Iterator;
-  friend class StaticContext;
-  friend class DocumentManager; 
-  friend class SingletonIterator;
-  friend class DynamicContext;
-
-private:
-  zorba::Item theItem;
-
-public:
-  Item() {}
-  Item(const Item& aItem) : theItem(aItem.theItem) {}
-  Item(const zorba::Item& aZItem) : theItem(aZItem) {}
-
-  static Item createEmptyItem() 
-  { return Item(); }
-
-  std::string getStringValue() const 
-  { return std::string(theItem.getStringValue().c_str()); }
-  
-  std::string serialize() const 
-  {
-    std::stringstream lStream; 
-    Zorba_SerializerOptions_t lOptions; 
-    zorba::Serializer_t lSerializer = zorba::Serializer::createSerializer(lOptions); 
-    zorba::SingletonItemSequence lSequence(theItem); 
-    lSerializer->serialize(&lSequence, lStream); 
-    return lStream.str();
-  }
-  
-  Iterator getAtomizationValue () const
-  { return Iterator(theItem.getAtomizationValue()); }
-  
-  Iterator getAttributes () const
-  { return Iterator(theItem.getAttributes()); }
-  
-  bool getBooleanValue () const
-  { return theItem.getBooleanValue(); }
-
-  Iterator getChildren () const
-  { return Iterator(theItem.getChildren()); }
-
-  Item getEBV () const
-  { return Item(theItem.getEBV()); }
-
-  int getIntValue () const
-  { return theItem.getIntValue(); }
-  
-  std::string getLocalName () const
-  { return std::string(theItem.getLocalName().c_str()); }
-
-  std::string getNamespace () const
-  { return std::string(theItem.getNamespace().c_str()); }
-
-  bool getNodeName (Item &aNodeName) const
-  { return theItem.getNodeName( aNodeName.theItem ); }
-
-  std::string getPrefix () const
-  { return std::string(theItem.getPrefix().c_str()); }
-
-  Item getType () const
-  { return Item( theItem.getType() ); }
-
-  unsigned int getUnsignedIntValue () const
-  { return theItem.getUnsignedIntValue(); }
-
-  bool isAtomic () const
-  { return theItem.isAtomic(); }
-
-  bool isNaN () const
-  { return theItem.isNaN(); }
-
-  bool isNode () const
-  { return theItem.isNode(); }
-
-  bool isNull () const
-  { return theItem.isNull(); }
-
-  bool isPosOrNegInf () const
-  { return theItem.isPosOrNegInf(); }
-  
-  int getNodeKind () const
-  { return theItem.getNodeKind(); }
-
-}; // class Item
-
-class DynamicContext
-{
-private:
-  zorba::DynamicContext* theContext;
-
-public:
-  DynamicContext()
-    : theContext(0)
-  {
-  }
-
-  DynamicContext(const DynamicContext& aCtx)
-    : theContext(aCtx.theContext)
-  {
-  }
-
-  DynamicContext(zorba::DynamicContext* aCtx)
-    : theContext(aCtx)
-  {
-  }
-
-  void
-  setVariable(
-    const std::string& aNamespace,
-    const std::string& aLocalname,
-    Iterator aIter)
-  {
-    theContext->setVariable(aNamespace, aLocalname, aIter.theIterator);
-  }
-
-  void
-  setContextItem(Item aItem)
-  {
-    theContext->setContextItem(aItem.theItem);
-  }
-};
-
-class XQuery 
-{
-private:
-  zorba::XQuery_t theQuery;
-
-public:
-  XQuery() {}
-  XQuery(const XQuery& aXQuery) : theQuery(aXQuery.theQuery) {}
-  XQuery(zorba::XQuery_t aQuery) : theQuery(aQuery) {}
-
-  std::string execute()
-  {
-    std::stringstream lStream;
-    lStream << theQuery;
-    return lStream.str();
-  }
-
-  std::string printPlanAsXML()
-  {
-    std::ostringstream lStream;
-    theQuery->printPlan(lStream);
-    return lStream.str();
-  }
-
-  std::string printPlanAsDOT()
-  {
-    std::ostringstream lStream;
-    theQuery->printPlan(lStream, true);
-    return lStream.str();
-  }
-
-  DynamicContext
-  getDynamicContext()
-  {
-    return DynamicContext(theQuery->getDynamicContext());
-  }
-
-#ifdef SWIGPYTHON
-  void executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy)
-  { theQuery->executeSAX(contentHandlerProxy); }
-#endif
-
-  void destroy() { theQuery = 0; }
-  Iterator iterator() { return Iterator(theQuery->iterator()); }
-}; // class XQuery
-
-
-// remaining method definitions from Iterator
-bool
-Iterator::next(Item& aItem)
-{
-  if (theIterator)
-  {
-    return theIterator->next(aItem.theItem);
-  }
-  else
-  {
-    if (!theConsumed)
-    {
-      aItem = theItem;
-      return true;
-    }
-    else
-    {
-      return false;
-    }
-  }
-}
-
-
-%}  // end   Implementation
-
-
-// Interfaces
-
-class DynamicContext
-{
-public:
-  void
-  setVariable(
-    const std::string& aNamespace,
-    const std::string& aLocalname,
-    Iterator);
-
-  void
-  setContextItem(Item);
-};
-
-class Item 
-{
-public: 
-  static Item createEmptyItem();
-  std::string getStringValue() const;
-  std::string serialize() const;
-  Iterator getAtomizationValue () const;
-  Iterator getAttributes () const;
-  bool getBooleanValue () const;
-  Iterator getChildren () const;
-  Item getEBV () const;
-  int getIntValue () const;
-  std::string getLocalName () const;
-  std::string getNamespace () const;
-  bool getNodeName (Item &aNodeName) const;
-  std::string getPrefix () const;
-  Item getType () const;
-  unsigned int getUnsignedIntValue () const;
-
-  int getNodeKind() const;
-  bool isAtomic () const;
-  bool isNaN () const;
-  bool isNode () const;
-  bool isNull () const;
-  bool isPosOrNegInf () const;
-}; // class Item
-
-class Iterator 
-{
-public:
-  void open();
-  bool next(Item&);
-  void close();
-  void destroy();
-}; // class Iterator
-
-class XQuery 
-{
-public:
-  std::string execute();
-  std::string printPlanAsXML();
-  std::string printPlanAsDOT();
-
-#ifdef SWIGPYTHON
-  void executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy);
-#endif
-
-  void destroy();
-  Iterator iterator();
-  DynamicContext getDynamicContext();
-}; // class XQuery
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+%{  // start Implementation
+
+class Iterator 
+{
+protected:
+  friend class DynamicContext;
+  zorba::Iterator_t theIterator;
+  zorba::Item theItem;
+  bool theConsumed;
+
+public:
+  Iterator() {}
+  Iterator(const Iterator& anIterator)
+    : theIterator(anIterator.theIterator),
+      theItem(anIterator.theItem),
+      theConsumed(false)
+  {}
+
+  Iterator(zorba::Iterator_t anIterator)
+    : theIterator(anIterator),
+      theConsumed(false)
+  {}
+
+  Iterator(zorba::Item& aItem)
+    : theIterator(0),
+      theItem(aItem),
+      theConsumed(false)
+  {}
+
+  void open()
+  {
+    if (theIterator)
+      theIterator->open();
+    theConsumed = false;
+  }
+
+  bool next(Item& aItem);
+
+  void close()
+  {
+    if (theIterator)
+      theIterator->close();
+    theConsumed = true;
+  }
+
+  void destroy()
+  {
+    theIterator = 0;
+  }
+
+}; // class Iterator
+
+
+class Item 
+{
+  friend class Iterator;
+  friend class StaticContext;
+  friend class DocumentManager; 
+  friend class SingletonIterator;
+  friend class DynamicContext;
+  friend class ItemFactory;
+
+private:
+  zorba::Item theItem;
+
+public:
+  Item() {}
+  Item(const Item& aItem) : theItem(aItem.theItem) {}
+  Item(const zorba::Item& aZItem) : theItem(aZItem) {}
+
+  static Item createEmptyItem() 
+  { return Item(); }
+
+  std::string getStringValue() const 
+  { return std::string(theItem.getStringValue().c_str()); }
+  
+  std::string serialize() const 
+  {
+    std::stringstream lStream; 
+    Zorba_SerializerOptions_t lOptions; 
+    zorba::Serializer_t lSerializer = zorba::Serializer::createSerializer(lOptions); 
+    zorba::SingletonItemSequence lSequence(theItem); 
+    lSerializer->serialize(&lSequence, lStream); 
+    return lStream.str();
+  }
+  
+  Iterator getAtomizationValue () const
+  { return Iterator(theItem.getAtomizationValue()); }
+  
+  Iterator getAttributes () const
+  { return Iterator(theItem.getAttributes()); }
+  
+  bool getBooleanValue () const
+  { return theItem.getBooleanValue(); }
+
+  Iterator getChildren () const
+  { return Iterator(theItem.getChildren()); }
+
+  Item getEBV () const
+  { return Item(theItem.getEBV()); }
+
+  int getIntValue () const
+  { return theItem.getIntValue(); }
+  
+  std::string getLocalName () const
+  { return std::string(theItem.getLocalName().c_str()); }
+
+  std::string getNamespace () const
+  { return std::string(theItem.getNamespace().c_str()); }
+
+  bool getNodeName (Item &aNodeName) const
+  { return theItem.getNodeName( aNodeName.theItem ); }
+
+  std::string getPrefix () const
+  { return std::string(theItem.getPrefix().c_str()); }
+
+  Item getType () const
+  { return Item( theItem.getType() ); }
+
+  unsigned int getUnsignedIntValue () const
+  { return theItem.getUnsignedIntValue(); }
+
+  bool isAtomic () const
+  { return theItem.isAtomic(); }
+
+  bool isNaN () const
+  { return theItem.isNaN(); }
+
+  bool isNode () const
+  { return theItem.isNode(); }
+
+  bool isNull () const
+  { return theItem.isNull(); }
+
+  bool isPosOrNegInf () const
+  { return theItem.isPosOrNegInf(); }
+  
+  int getNodeKind () const
+  { return theItem.getNodeKind(); }
+
+}; // class Item
+
+class DynamicContext
+{
+private:
+  zorba::DynamicContext* theContext;
+
+public:
+  DynamicContext()
+    : theContext(0)
+  {
+  }
+
+  DynamicContext(const DynamicContext& aCtx)
+    : theContext(aCtx.theContext)
+  {
+  }
+
+  DynamicContext(zorba::DynamicContext* aCtx)
+    : theContext(aCtx)
+  {
+  }
+
+  void
+  setVariable(
+    const std::string& aNamespace,
+    const std::string& aLocalname,
+    Iterator aIter)
+  {
+    theContext->setVariable(aNamespace, aLocalname, aIter.theIterator);
+  }
+
+  void
+  setContextItem(Item aItem)
+  {
+    theContext->setContextItem(aItem.theItem);
+  }
+};
+
+class XQuery 
+{
+private:
+  zorba::XQuery_t theQuery;
+
+public:
+  XQuery() {}
+  XQuery(const XQuery& aXQuery) : theQuery(aXQuery.theQuery) {}
+  XQuery(zorba::XQuery_t aQuery) : theQuery(aQuery) {}
+
+  std::string execute()
+  {
+    std::stringstream lStream;
+    lStream << theQuery;
+    return lStream.str();
+  }
+  
+  void compile (const std::string &aQuery)
+  {
+    theQuery->compile(aQuery);
+  }
+
+  void compile (const std::string &aQuery, StaticContext &aStaticContext )
+  {
+    Zorba_CompilerHints_t hints;
+    theQuery->compile(aQuery, aStaticContext.theStaticContext, hints);
+  }
+  
+  std::string printPlanAsXML()
+  {
+    std::ostringstream lStream;
+    theQuery->printPlan(lStream);
+    return lStream.str();
+  }
+
+  std::string printPlanAsDOT()
+  {
+    std::ostringstream lStream;
+    theQuery->printPlan(lStream, true);
+    return lStream.str();
+  }
+
+  DynamicContext
+  getDynamicContext()
+  {
+    return DynamicContext(theQuery->getDynamicContext());
+  }
+
+#ifdef SWIGPYTHON
+  void executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy)
+  { theQuery->executeSAX(contentHandlerProxy); }
+#endif
+
+  void destroy() { theQuery = 0; }
+  Iterator iterator() { return Iterator(theQuery->iterator()); }
+}; // class XQuery
+
+
+// remaining method definitions from Iterator
+bool
+Iterator::next(Item& aItem)
+{
+  if (theIterator)
+  {
+    return theIterator->next(aItem.theItem);
+  }
+  else
+  {
+    if (!theConsumed)
+    {
+      aItem = theItem;
+      return true;
+    }
+    else
+    {
+      return false;
+    }
+  }
+}
+
+
+%}  // end   Implementation
+
+
+// Interfaces
+
+class DynamicContext
+{
+public:
+  void
+  setVariable(
+    const std::string& aNamespace,
+    const std::string& aLocalname,
+    Iterator);
+
+  void
+  setContextItem(Item);
+};
+
+class Item 
+{
+public: 
+  static Item createEmptyItem();
+  std::string getStringValue() const;
+  std::string serialize() const;
+  Iterator getAtomizationValue () const;
+  Iterator getAttributes () const;
+  bool getBooleanValue () const;
+  Iterator getChildren () const;
+  Item getEBV () const;
+  int getIntValue () const;
+  std::string getLocalName () const;
+  std::string getNamespace () const;
+  bool getNodeName (Item &aNodeName) const;
+  std::string getPrefix () const;
+  Item getType () const;
+  unsigned int getUnsignedIntValue () const;
+
+  int getNodeKind() const;
+  bool isAtomic () const;
+  bool isNaN () const;
+  bool isNode () const;
+  bool isNull () const;
+  bool isPosOrNegInf () const;
+}; // class Item
+
+class Iterator 
+{
+public:
+  void open();
+  bool next(Item&);
+  void close();
+  void destroy();
+}; // class Iterator
+
+class XQuery 
+{
+public:
+  std::string execute();
+  std::string printPlanAsXML();
+  std::string printPlanAsDOT();
+  void compile (const std::string &aQuery);
+  void compile (const std::string &aQuery, StaticContext &aStaticContext);
+
+#ifdef SWIGPYTHON
+  void executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy);
+#endif
+
+  void destroy();
+  Iterator iterator();
+  DynamicContext getDynamicContext();
+}; // class XQuery

=== modified file 'swig/Zorba.i'
--- swig/Zorba.i	2011-07-13 21:24:04 +0000
+++ swig/Zorba.i	2011-10-12 21:04:05 +0000
@@ -1,99 +1,125 @@
-
-%{  // start Implementation
-
-class Zorba 
-{
-private:
-  zorba::Zorba* theZorba;
-  Zorba(zorba::Zorba* aZorba) : theZorba(aZorba) {}
-
-public:
-  Zorba():theZorba(0){}
-  Zorba(const Zorba& aZorba) : theZorba(aZorba.theZorba) {}
-  
-  static Zorba getInstance(const Store& aStore)
-  {
-    return Zorba(zorba::Zorba::getInstance(aStore.getStore()));
-  }
-  
-  StaticContext createStaticContext()
-  {
-    return StaticContext(theZorba->createStaticContext());
-  }
-  
-  XQuery compileQuery(const std::string& aStr) 
-  {
-    return XQuery(theZorba->compileQuery(aStr));
-  }
-/*
-  //--->> DiagnosticHandler implementations are postponed
-  XQuery compileQuery(
-    const std::string& aStr,
-    DiagnosticHandler* aDiagnosticHandler
-  )
-  {
-    return XQuery(theZorba->compileQuery(aStr, aDiagnosticHandler));
-  }
-  XQuery compileQuery(
-    const std::string& aStr,
-    StaticContext &aStaticContext, 
-    DiagnosticHandler* aDiagnosticHandler)
-  { 
-    return XQuery(
-      theZorba->compileQuery(
-        aStr,
-        aStaticContext.theStaticContext,
-        aDiagnosticHandler
-      )
-    );
-  }
-
-  XQuery compileQuery(
-    const std::string& aStr,
-    CompilerHints& aCompilerHints,
-    DiagnosticHandler* aDiagnosticHandler)
-  { 
-    return XQuery(
-      theZorba->compileQuery(
-        aStr,
-        aCompilerHints.theCompilerHints,
-        aDiagnosticHandler
-      )
-    );
-  }
-*/
-
-  XmlDataManager getXmlDataManager()
-  {
-    return XmlDataManager(theZorba->getXmlDataManager());
-  }
-
-  void shutdown() 
-  {
-    theZorba->shutdown();
-  }
-
-}; // class Zorba
-
-
-%}  // end Implementation
-
-// Interface
-
-class Zorba 
-{
- public:
-  static Zorba getInstance(const Store&);
-  StaticContext createStaticContext();
-  XQuery compileQuery(const std::string& aStr);
-  /*
-  XQuery compileQuery(const std::string& aStr, DiagnosticHandler* aDiagnosticHandler);
-  XQuery compileQuery(const std::string& aStr, StaticContext &aStaticContext, 
-                      DiagnosticHandler* aDiagnosticHandler);
-  XQuery compileQuery(const std::string& aStr, CompilerHints &aCompilerHints, 
-                      DiagnosticHandler* aDiagnosticHandler);
-  */
-  XmlDataManager getXmlDataManager();
-  void shutdown();
-
-}; // class Zorba
+
+%{  // start Implementation
+
+class Zorba 
+{
+private:
+  zorba::Zorba* theZorba;
+  Zorba(zorba::Zorba* aZorba) : theZorba(aZorba) {}
+
+public:
+  Zorba():theZorba(0){}
+  Zorba(const Zorba& aZorba) : theZorba(aZorba.theZorba) {}
+  
+  static Zorba getInstance(const Store& aStore)
+  {
+    return Zorba(zorba::Zorba::getInstance(aStore.getStore()));
+  }
+  ItemFactory getItemFactory()
+  {
+    return ItemFactory(theZorba->getItemFactory());
+  }
+  
+  StaticContext createStaticContext()
+  {
+    return StaticContext(theZorba->createStaticContext());
+  }
+  
+  XQuery compileQuery(const std::string& aStr) 
+  {
+    return XQuery(theZorba->compileQuery(aStr));
+  }
+
+  XQuery createQuery() 
+  {
+    return XQuery(theZorba->createQuery());
+  }
+
+  XQuery compileQuery(
+    const std::string& aStr,
+    StaticContext &aStaticContext )
+  { 
+    return XQuery(
+      theZorba->compileQuery(
+        aStr,
+        aStaticContext.theStaticContext
+      )
+    );
+  }
+
+  /*
+  //--->> DiagnosticHandler implementations are postponed
+  XQuery compileQuery(
+    const std::string& aStr,
+    DiagnosticHandler* aDiagnosticHandler
+  )
+  {
+    return XQuery(theZorba->compileQuery(aStr, aDiagnosticHandler));
+  }
+  XQuery compileQuery(
+    const std::string& aStr,
+    StaticContext &aStaticContext, 
+    DiagnosticHandler* aDiagnosticHandler)
+  { 
+    return XQuery(
+      theZorba->compileQuery(
+        aStr,
+        aStaticContext.theStaticContext,
+        aDiagnosticHandler
+      )
+    );
+  }
+
+  XQuery compileQuery(
+    const std::string& aStr,
+    CompilerHints& aCompilerHints,
+    DiagnosticHandler* aDiagnosticHandler)
+  { 
+    return XQuery(
+      theZorba->compileQuery(
+        aStr,
+        aCompilerHints.theCompilerHints,
+        aDiagnosticHandler
+      )
+    );
+  }
+*/
+
+  XmlDataManager getXmlDataManager()
+  {
+    return XmlDataManager(theZorba->getXmlDataManager());
+  }
+
+  void shutdown() 
+  {
+    theZorba->shutdown();
+  }
+
+}; // class Zorba
+
+
+%}  // end Implementation
+
+// Interface
+
+class Zorba 
+{
+ public:
+  static Zorba getInstance(const Store&);
+  StaticContext createStaticContext();
+  XQuery createQuery();
+  XQuery compileQuery(const std::string& aStr);
+  XQuery compileQuery(const std::string& aStr, StaticContext &aStaticContext );
+  ItemFactory getItemFactory();
+  
+  /*
+  XQuery compileQuery(const std::string& aStr, DiagnosticHandler* aDiagnosticHandler);
+  XQuery compileQuery(const std::string& aStr, StaticContext &aStaticContext, 
+                      DiagnosticHandler* aDiagnosticHandler);
+  XQuery compileQuery(const std::string& aStr, CompilerHints &aCompilerHints, 
+                      DiagnosticHandler* aDiagnosticHandler);
+  */
+  XmlDataManager getXmlDataManager();
+  void shutdown();
+
+}; // class Zorba

=== modified file 'swig/java/CMakeLists.txt'
--- swig/java/CMakeLists.txt	2011-09-02 19:58:59 +0000
+++ swig/java/CMakeLists.txt	2011-10-12 21:04:05 +0000
@@ -60,6 +60,8 @@
   MESSAGE(STATUS "Java module install path: " ${JAVA_SITEARCH_DIR})
 
   FILE(GLOB JAVA_SWIG_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.java")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
 
   IF ( APPLE )
     INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_SWIG_LIB_PREFIX}libzorba_api.jnilib DESTINATION ${JAVA_SITEARCH_DIR})

=== modified file 'swig/php/CMakeLists.txt'
--- swig/php/CMakeLists.txt	2011-09-02 19:58:59 +0000
+++ swig/php/CMakeLists.txt	2011-10-12 21:04:05 +0000
@@ -38,6 +38,9 @@
     SWIG_LINK_LIBRARIES (zorba_api ${PHP5_LIBRARY})
   ENDIF (WIN32)
 
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
+
   # The following fix was added because of the changes in CMake 2.8, which have the
   # result of naming the java binding library "liblibzorba_api.so" instead of "libzorba_api.so"
   SET_TARGET_PROPERTIES( ${SWIG_MODULE_zorba_api_REAL_NAME} PROPERTIES PROJECT_LABEL "Api_PHP" )

=== modified file 'swig/php/zorba_api.i'
--- swig/php/zorba_api.i	2011-07-12 00:51:50 +0000
+++ swig/php/zorba_api.i	2011-10-12 21:04:05 +0000
@@ -28,6 +28,12 @@
   #define PHP_COMPILER_ID "VC6"
 #endif
 #endif
+
+#if defined(_MSC_VER)
+#define strtoll _strtoi64
+#define strtoull _strtoui64
+#endif
+
 %}
 
 

=== modified file 'swig/python/CMakeLists.txt'
--- swig/python/CMakeLists.txt	2011-09-02 19:58:59 +0000
+++ swig/python/CMakeLists.txt	2011-10-12 21:04:05 +0000
@@ -29,6 +29,8 @@
   )
    
   SET (PYTHON_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/share/python")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
   MESSAGE (STATUS "SWIG Python: Python module install path: " ${PYTHON_INSTALL_PATH})
 
   IF (NOT WIN32)   

=== modified file 'swig/ruby/CMakeLists.txt'
--- swig/ruby/CMakeLists.txt	2011-09-02 19:58:59 +0000
+++ swig/ruby/CMakeLists.txt	2011-10-12 21:04:05 +0000
@@ -43,6 +43,8 @@
   EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']"
     OUTPUT_VARIABLE RUBY_SITEARCH_DIR)
   #STRING(REPLACE "/usr/" "" RUBY_SITEARCH_DIR "${RUBY_SITEARCH_DIR}" )
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
   
   SET (RUBY_SITEARCH_DIR "${CMAKE_INSTALL_PREFIX}/share/ruby")
   

=== modified file 'swig/zorba_api.i'
--- swig/zorba_api.i	2011-07-13 21:24:04 +0000
+++ swig/zorba_api.i	2011-10-12 21:04:05 +0000
@@ -52,7 +52,6 @@
   class Item;
   class Iterator;
   class XQuery;
-  class StaticContext;
   class Store;
   class Zorba;
 
@@ -65,6 +64,9 @@
   class UserException;
   class ZorbaException;
 
+  #include "StaticContext.h"
+  #include "ItemFactory.h"
+
 %}
 
 
@@ -77,5 +79,6 @@
 %include "CompilerHints.i"
 %include "StaticContext.i"
 %include "Zorba.i"
+%include "ItemFactory.i"
 
 


Follow ups