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

Proposed by Rodolfo Ochoa
Status: Merged
Approved by: Cezar Andrei
Approved revision: 10517
Merged at revision: 10528
Proposed branch: lp:~zorba-coders/zorba/itemfactory
Merge into: lp:zorba
Diff against target: 809 lines (+435/-109)
13 files modified
swig/CMakeLists.txt (+1/-0)
swig/ItemFactory.h (+69/-0)
swig/ItemFactory.i (+192/-0)
swig/StaticContext.h (+69/-0)
swig/StaticContext.i (+43/-107)
swig/XQuery.i (+14/-0)
swig/Zorba.i (+28/-1)
swig/java/CMakeLists.txt (+2/-0)
swig/php/CMakeLists.txt (+3/-0)
swig/php/zorba_api.i (+6/-0)
swig/python/CMakeLists.txt (+2/-0)
swig/ruby/CMakeLists.txt (+2/-0)
swig/zorba_api.i (+4/-1)
To merge this branch: bzr merge lp:~zorba-coders/zorba/itemfactory
Reviewer Review Type Date Requested Status
Cezar Andrei Approve
Rodolfo Ochoa Approve
Review via email: mp+79181@code.launchpad.net

Commit message

Item Factory class added for SWIG API, many methods included.

Description of the change

Item Factory class added for SWIG API, many methods included, need to be tested on linux.

To post a comment you must log in.
Revision history for this message
Chris Hillery (ceejatec) wrote :

Rodolfo - it looks from the diffs like maybe the files XQuery.i and Zorba.i have Windows line endings, or something? The whole files are showing up as one big diff, even though it doesn't look like everything changed. Any idea what's going on there?

Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) wrote :

> Rodolfo - it looks from the diffs like maybe the files XQuery.i and Zorba.i
> have Windows line endings, or something? The whole files are showing up as one
> big diff, even though it doesn't look like everything changed. Any idea what's
> going on there?

I think it's the file encoding, I had this problem before, Windows default is ANSI and *nix is UTF-8, can you convert them from ANSI to UTF-8?

Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

Fix line diffs for XQuery.i and Zorba.i.

Try to also add the commented method in swig/ItemFactory.h:

//Item createElementNode (Item &aParent, Item aNodeName, Item aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings);

review: Needs Fixing
Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) wrote :

According to this document, EOLs shouldn't be causing the problem...
http://doc.bazaar.canonical.com/bzr.2.4/en/user-reference/eol-help.html

Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) wrote :

I used previous version of the files and didn't touch anything else but the methods I added.

Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

good

review: Approve
Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/itemfactory into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:272 (message):
  Validation queue job itemfactory-2011-10-26T21-50-14.651Z is finished. The
  final status was:

  No tests were run - build or configure step must have failed.

  Not commiting changes.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

Rodolfo, you need to fix the following errors from the log:

[ 73%] Building CXX object swig/java/CMakeFiles/libzorba_api.dir/zorba_apiJAVA_wrap.cxx.o
In file included from zorba_apiPYTHON_wrap.cxx:3472:
StaticContext.h:13: error: extra qualification 'StaticContext::' on member 'StaticContext'
make[2]: *** [swig/python/CMakeFiles/_zorba_api_python.dir/zorba_apiPYTHON_wrap.cxx.o] Error 1
make[1]: *** [swig/python/CMakeFiles/_zorba_api_python.dir/all] Error 2
In fil.e included from zorba_apiJAVA_wrap.cxx:301:
StaticContext.h:13: error: extra qualification 'StaticContext::' on member 'StaticContext'
make[2]: *** [swig/java/CMakeFiles/libzorba_api.dir/zorba_apiJAVA_wrap.cxx.o] Error 1
make[1]: *** [swig/java/CMakeFiles/libzorba_api.dir/all] Error 2
make: *** [all] Error 2

Revision history for this message
Cezar Andrei (cezar-andrei) wrote :

Build broken, needs fixing.

review: Needs Fixing
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

There are additional revisions which have not been approved in review. Please seek review and approval of these new revisions.

Revision history for this message
Rodolfo Ochoa (rodolfo-ochoa) wrote :

The file itemfactory.h is now fixed...

Revision history for this message
Cezar Andrei (cezar-andrei) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job itemfactory-2011-10-27T17-47-13.793Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'swig/CMakeLists.txt'
2--- swig/CMakeLists.txt 2011-09-09 16:33:19 +0000
3+++ swig/CMakeLists.txt 2011-10-27 02:34:25 +0000
4@@ -26,6 +26,7 @@
5 SET (SWIG_MODULE_zorba_api_EXTRA_DEPS ${SWIG_FILES})
6 SET (SWIG_MODULE_libzorba_api_EXTRA_DEPS ${SWIG_FILES})
7
8+
9 # on apple and cmake 2.8, the generated swig libraries are prefixed with "lib"
10 SET (ZORBA_SWIG_LIB_PREFIX)
11 IF (APPLE AND CMAKE_MINOR_VERSION GREATER 6)
12
13=== added file 'swig/ItemFactory.h'
14--- swig/ItemFactory.h 1970-01-01 00:00:00 +0000
15+++ swig/ItemFactory.h 2011-10-27 02:34:25 +0000
16@@ -0,0 +1,69 @@
17+// Interface
18+
19+class ItemFactory
20+{
21+
22+ private:
23+ zorba::ItemFactory* theItemFactory;
24+ public:
25+ ItemFactory(): theItemFactory(0) {}
26+ ItemFactory(zorba::ItemFactory* aItemFactory) : theItemFactory(aItemFactory) {}
27+ ItemFactory(const ItemFactory& aItemFactory) : theItemFactory(aItemFactory.theItemFactory) {}
28+
29+ Item createAnyURI (const std::string &aURI);
30+ Item createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, Item aTypedValue);
31+ Item createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, std::vector< Item > aTypedValue);
32+ Item createBase64Binary (const char *aBinData, size_t aLength);
33+ Item createBase64Binary (std::istream &aStream);
34+ Item createBase64Binary (const unsigned char *aBinData, size_t aLength);
35+ Item createBoolean (bool aValue);
36+ Item createByte (char aByte);
37+ Item createDate (const std::string &aDate);
38+ Item createDate (short aYear, short aMonth, short aDay);
39+ Item createDateTime (const std::string &aDateTimeValue);
40+ Item createDateTime (short aYear, short aMonth, short aDay, short aHour, short aMinute, double aSecond, short aTimeZone_hours);
41+ Item createDecimal (const std::string &aValue);
42+ Item createDecimalFromDouble (double aValue);
43+ Item createDecimalFromLong (unsigned long aValue);
44+ Item createDouble (const std::string &aValue);
45+ Item createDouble (double aValue);
46+ Item createDuration (const std::string &aValue);
47+ Item createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds);
48+ //Item createElementNode (Item &aParent, Item aNodeName, Item aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings);
49+ Item createFloat (const std::string &aValue);
50+ Item createFloat (float aValue);
51+ Item createGDay (const std::string &aValue);
52+ Item createGDay (short aDay);
53+ Item createGMonth (const std::string &aValue);
54+ Item createGMonth (short aMonth);
55+ Item createGMonthDay (const std::string &aValue);
56+ Item createGMonthDay (short aMonth, short aDay);
57+ Item createGYear (short aYear);
58+ Item createGYear (const std::string &aValue);
59+ Item createGYearMonth (const std::string &aValue);
60+ Item createGYearMonth (short aYear, short aMonth);
61+ Item createHexBinary (const char *aHexData, size_t aSize);
62+ Item createInt (int aInt);
63+ Item createInteger (const std::string &aInteger);
64+ Item createInteger (long long aInteger);
65+ Item createLong (long long aLong);
66+ Item createNCName (const std::string &aValue);
67+ Item createNegativeInteger (long long aValue);
68+ Item createNonNegativeInteger (unsigned long long aValue);
69+ Item createNonPositiveInteger (long long aValue);
70+ Item createPositiveInteger (unsigned long long aValue);
71+ Item createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname);
72+ Item createQName (const std::string &aNamespace, const std::string &aLocalname);
73+ Item createQName (const std::string &aQNameString);
74+ Item createShort (short aShort);
75+ //Item createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false);
76+ Item createString (const std::string &aString);
77+ Item createTextNode (Item parent, std::string content);
78+ Item createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours);
79+ Item createTime (short aHour, short aMinute, double aSecond);
80+ Item createTime (const std::string &aValue);
81+ Item createUnsignedByte (const unsigned char aValue);
82+ Item createUnsignedInt (unsigned int aValue);
83+ Item createUnsignedLong (unsigned long long aValue);
84+ Item createUnsignedShort (unsigned short aValue);
85+}; // class ItemFactory
86
87=== added file 'swig/ItemFactory.i'
88--- swig/ItemFactory.i 1970-01-01 00:00:00 +0000
89+++ swig/ItemFactory.i 2011-10-27 02:34:25 +0000
90@@ -0,0 +1,192 @@
91+
92+%{ // start Implementation
93+
94+
95+
96+ Item ItemFactory::createAnyURI (const std::string &aURI){
97+ return Item(theItemFactory->createAnyURI(aURI));
98+ }
99+
100+ Item ItemFactory::createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, Item aTypedValue){
101+ return Item( theItemFactory->createAttributeNode( aParent.theItem, aNodeName.theItem, aTypeName.theItem, aTypedValue.theItem ));
102+ }
103+
104+ Item ItemFactory::createAttributeNode (Item aParent, Item aNodeName, Item aTypeName, std::vector< Item > aTypedValue){
105+
106+ std::vector< zorba::Item > typedValue;
107+ typedValue.reserve(aTypedValue.size());
108+ std::vector< Item >::iterator iter;
109+ for(iter = aTypedValue.begin(); iter != aTypedValue.end(); iter++) {
110+ typedValue.push_back((*iter).theItem);
111+ }
112+ return Item( theItemFactory->createAttributeNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, typedValue ));
113+ }
114+
115+ Item ItemFactory::createBase64Binary (const char *aBinData, size_t aLength){
116+ return Item( theItemFactory->createBase64Binary(aBinData, aLength));
117+ }
118+ Item ItemFactory::createBase64Binary (std::istream &aStream){
119+ return Item( theItemFactory->createBase64Binary(aStream));
120+ }
121+ Item ItemFactory::createBase64Binary (const unsigned char *aBinData, size_t aLength){
122+ return Item( theItemFactory->createBase64Binary(aBinData, aLength));
123+ }
124+ Item ItemFactory::createBoolean (bool aValue){
125+ return Item( theItemFactory->createBoolean(aValue));
126+ }
127+ Item ItemFactory::createByte (char aByte){
128+ return Item( theItemFactory->createByte(aByte));
129+ }
130+ Item ItemFactory::createDate (const std::string &aDate){
131+ return Item( theItemFactory->createDate(aDate));
132+ }
133+ Item ItemFactory::createDate (short aYear, short aMonth, short aDay){
134+ return Item( theItemFactory->createDate (aYear, aMonth, aDay));
135+ }
136+ Item ItemFactory::createDateTime (const std::string &aDateTimeValue){
137+ return Item( theItemFactory->createDateTime (aDateTimeValue));
138+ }
139+ Item ItemFactory::createDateTime (short aYear, short aMonth, short aDay, short aHour, short aMinute, double aSecond, short aTimeZone_hours){
140+ return Item( theItemFactory->createDateTime (aYear, aMonth, aDay, aHour, aMinute, aSecond, aTimeZone_hours));
141+ }
142+ Item ItemFactory::createDecimal (const std::string &aValue){
143+ return Item( theItemFactory->createDecimal (aValue));
144+ }
145+ Item ItemFactory::createDecimalFromDouble (double aValue){
146+ return Item( theItemFactory->createDecimalFromDouble (aValue));
147+ }
148+ Item ItemFactory::createDecimalFromLong (unsigned long aValue){
149+ return Item( theItemFactory->createDecimalFromLong (aValue));
150+ }
151+ Item ItemFactory::createDouble (const std::string &aValue){
152+ return Item( theItemFactory->createDouble (aValue));
153+ }
154+ Item ItemFactory::createDouble (double aValue){
155+ return Item( theItemFactory->createDouble (aValue));
156+ }
157+ Item ItemFactory::createDuration (const std::string &aValue){
158+ return Item( theItemFactory->createDuration (aValue));
159+ }
160+ Item ItemFactory::createDuration (short aYear, short aMonths, short aDays, short aHours, short aMinutes, double aSeconds){
161+ return Item( theItemFactory->createDuration (aYear, aMonths, aDays, aHours, aMinutes, aSeconds));
162+ }
163+ /*
164+ Item ItemFactory::createElementNode (Item &aParent, Item aNodeName, Item aTypeName, bool aHasTypedValue, bool aHasEmptyValue, std::vector< std::pair< std::string, std::string > > aNsBindings){
165+ return Item( theItemFactory->createElementNode (aParent.theItem, aNodeName.theItem, aTypeName.theItem, aHasTypedValue, aHasEmptyValue, aNsBindings));
166+ }
167+ */
168+ Item ItemFactory::createFloat (const std::string &aValue){
169+ return Item( theItemFactory->createFloat (aValue));
170+ }
171+ Item ItemFactory::createFloat (float aValue){
172+ return Item( theItemFactory->createFloat (aValue));
173+ }
174+ Item ItemFactory::createGDay (const std::string &aValue){
175+ return Item( theItemFactory->createGDay (aValue));
176+ }
177+ Item ItemFactory::createGDay (short aDay){
178+ return Item( theItemFactory->createGDay (aDay));
179+ }
180+ Item ItemFactory::createGMonth (const std::string &aValue){
181+ return Item( theItemFactory->createGMonth (aValue));
182+ }
183+ Item ItemFactory::createGMonth (short aMonth){
184+ return Item( theItemFactory->createGMonth (aMonth));
185+ }
186+ Item ItemFactory::createGMonthDay (const std::string &aValue){
187+ return Item( theItemFactory->createGMonthDay (aValue));
188+ }
189+ Item ItemFactory::createGMonthDay (short aMonth, short aDay){
190+ return Item( theItemFactory->createGMonthDay (aMonth, aDay));
191+ }
192+ Item ItemFactory::createGYear (short aYear){
193+ return Item( theItemFactory->createGYear (aYear));
194+ }
195+ Item ItemFactory::createGYear (const std::string &aValue){
196+ return Item( theItemFactory->createGYear (aValue));
197+ }
198+ Item ItemFactory::createGYearMonth (const std::string &aValue){
199+ return Item( theItemFactory->createGYearMonth (aValue));
200+ }
201+ Item ItemFactory::createGYearMonth (short aYear, short aMonth){
202+ return Item( theItemFactory->createGYearMonth (aYear, aMonth));
203+ }
204+ Item ItemFactory::createHexBinary (const char *aHexData, size_t aSize){
205+ return Item( theItemFactory->createHexBinary (aHexData, aSize));
206+ }
207+ Item ItemFactory::createInt (int aInt){
208+ return Item( theItemFactory->createInt (aInt));
209+ }
210+ Item ItemFactory::createInteger (const std::string &aInteger){
211+ return Item( theItemFactory->createInteger (aInteger));
212+ }
213+ Item ItemFactory::createInteger (long long aInteger){
214+ return Item( theItemFactory->createInteger (aInteger));
215+ }
216+ Item ItemFactory::createLong (long long aLong){
217+ return Item( theItemFactory->createLong (aLong));
218+ }
219+ Item ItemFactory::createNCName (const std::string &aValue){
220+ return Item( theItemFactory->createNCName (aValue));
221+ }
222+ Item ItemFactory::createNegativeInteger (long long aValue){
223+ return Item( theItemFactory->createNegativeInteger (aValue));
224+ }
225+ Item ItemFactory::createNonNegativeInteger (unsigned long long aValue){
226+ return Item( theItemFactory->createNonNegativeInteger (aValue));
227+ }
228+ Item ItemFactory::createNonPositiveInteger (long long aValue){
229+ return Item( theItemFactory->createNonPositiveInteger (aValue));
230+ }
231+ Item ItemFactory::createPositiveInteger (unsigned long long aValue){
232+ return Item( theItemFactory->createPositiveInteger (aValue));
233+ }
234+ Item ItemFactory::createQName (const std::string &aNamespace, const std::string &aPrefix, const std::string &aLocalname){
235+ return Item( theItemFactory->createQName (aNamespace, aPrefix, aLocalname));
236+ }
237+ Item ItemFactory::createQName (const std::string &aNamespace, const std::string &aLocalname){
238+ return Item( theItemFactory->createQName (aNamespace, aLocalname));
239+ }
240+ Item ItemFactory::createQName (const std::string &aQNameString){
241+ return Item( theItemFactory->createQName (aQNameString));
242+ }
243+ Item ItemFactory::createShort (short aShort){
244+ return Item( theItemFactory->createShort (aShort));
245+ }
246+ /*
247+ Item ItemFactory::createStreamableString (std::istream &stream, StreamReleaser streamReleaser, bool seekable=false){
248+ return Item( theItemFactory->createStreamableString (std::istream &stream, StreamReleaser streamReleaser, seekable));
249+ }
250+ */
251+ Item ItemFactory::createString (const std::string &aString){
252+ return Item( theItemFactory->createString (aString));
253+ }
254+ Item ItemFactory::createTextNode (Item parent, std::string content){
255+ return Item( theItemFactory->createTextNode (parent.theItem, content));
256+ }
257+ Item ItemFactory::createTime (short aHour, short aMinute, double aSecond, short aTimeZone_hours){
258+ return Item( theItemFactory->createTime (aHour, aMinute, aSecond, aTimeZone_hours));
259+ }
260+ Item ItemFactory::createTime (short aHour, short aMinute, double aSecond){
261+ return Item( theItemFactory->createTime (aHour, aMinute, aSecond));
262+ }
263+ Item ItemFactory::createTime (const std::string &aValue){
264+ return Item( theItemFactory->createTime (aValue));
265+ }
266+ Item ItemFactory::createUnsignedByte (const unsigned char aValue){
267+ return Item( theItemFactory->createUnsignedByte (aValue));
268+ }
269+ Item ItemFactory::createUnsignedInt (unsigned int aValue){
270+ return Item( theItemFactory->createUnsignedInt (aValue));
271+ }
272+ Item ItemFactory::createUnsignedLong (unsigned long long aValue){
273+ return Item( theItemFactory->createUnsignedLong (aValue));
274+ }
275+ Item ItemFactory::createUnsignedShort (unsigned short aValue){
276+ return Item( theItemFactory->createUnsignedShort (aValue));
277+ }
278+
279+
280+%} // end Implementation
281+
282+%include "ItemFactory.h"
283\ No newline at end of file
284
285=== added file 'swig/StaticContext.h'
286--- swig/StaticContext.h 1970-01-01 00:00:00 +0000
287+++ swig/StaticContext.h 2011-10-27 02:34:25 +0000
288@@ -0,0 +1,69 @@
289+#include <zorba/static_context_consts.h>
290+
291+class StaticContext
292+{
293+friend class Zorba;
294+friend class XQuery;
295+
296+private:
297+ zorba::StaticContext_t theStaticContext;
298+public:
299+ StaticContext();
300+ StaticContext(const StaticContext& aStaticContext);
301+ StaticContext(zorba::StaticContext_t aStaticContext);
302+
303+ virtual void addColation(const std::string& aURI);
304+ virtual bool addNamespace(const std::string& aPrefix,
305+ const std::string& aURI);
306+ void addReference() const;
307+ virtual bool containsFunction(const std::string &aFnNameUri,
308+ const std::string &aFnNameLocal,
309+ int arity) const;
310+
311+ virtual StaticContext createChildContext() const;
312+ virtual void declareOption(const Item &aQName,
313+ const std::string &aOptionVal);
314+ virtual void disableFunction(const Item &aQName, int arity);
315+
316+ virtual void free ();
317+ virtual std::string getBaseURI () const;
318+ virtual zorba::boundary_space_mode_t getBoundarySpacePolicy () const;
319+
320+ virtual zorba::construction_mode_t getConstructionMode () const;
321+ virtual void getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const;
322+ virtual std::string getDefaultCollation () const;
323+ virtual std::string getDefaultElementAndTypeNamespace () const;
324+ virtual std::string getDefaultFunctionNamespace () const;
325+ virtual zorba::order_empty_mode_t getDefaultOrderForEmptySequences () const;
326+
327+ virtual std::string getNamespaceURIByPrefix(const std::string &aPrefix) const;
328+ virtual bool getOption(const Item &aQName, std::string &aOptionValue) const;
329+ virtual zorba::ordering_mode_t getOrderingMode() const;
330+ long getRefCount() const;
331+ virtual zorba::validation_mode_t getRevalidationMode();
332+ virtual zorba::xpath1_0compatib_mode_t getXPath1_0CompatibMode () const;
333+ virtual void loadProlog (const std::string & aProlog,
334+ const CompilerHints &hints);
335+
336+ void removeReference ();
337+ virtual void resetTraceStream ();
338+ virtual bool setBaseURI (const std::string &aBaseURI);
339+ virtual bool setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode);
340+
341+ virtual bool setConstructionMode (zorba::construction_mode_t aMode);
342+
343+ virtual bool setCopyNamespacesMode (zorba::preserve_mode_t aPreserve,
344+ zorba::inherit_mode_t aInherit);
345+ virtual void setDefaultCollation (const std::string &aURI);
346+ virtual bool setDefaultElementAndTypeNamespace (const std::string &aURI);
347+ virtual bool setDefaultFunctionNamespace (const std::string &aURI);
348+ virtual bool setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode);
349+
350+ virtual bool setOrderingMode (zorba::ordering_mode_t aMode);
351+ virtual void setRevalidationMode (zorba::validation_mode_t aMode);
352+
353+ virtual bool setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode);
354+
355+ void destroy();
356+}; // class StaticContext
357+
358
359=== modified file 'swig/StaticContext.i'
360--- swig/StaticContext.i 2011-06-29 20:05:38 +0000
361+++ swig/StaticContext.i 2011-10-27 02:34:25 +0000
362@@ -20,149 +20,144 @@
363 #include <zorba/static_context_consts.h>
364
365
366-class StaticContext
367-{
368- friend class Zorba;
369+StaticContext::StaticContext() {}
370
371-private:
372- zorba::StaticContext_t theStaticContext;
373-public:
374- StaticContext() {}
375- StaticContext(const StaticContext& aStaticContext) :
376+StaticContext::StaticContext(const StaticContext& aStaticContext) :
377 theStaticContext(aStaticContext.theStaticContext) {}
378- StaticContext(zorba::StaticContext_t aStaticContext) :
379+
380+StaticContext::StaticContext(zorba::StaticContext_t aStaticContext) :
381 theStaticContext(aStaticContext) {}
382
383- virtual void addColation(const std::string& aURI)
384+void StaticContext::addColation(const std::string& aURI)
385 { theStaticContext->addCollation(aURI); }
386
387- virtual bool addNamespace(const std::string& aPrefix,
388+bool StaticContext::addNamespace(const std::string& aPrefix,
389 const std::string& aURI)
390 { return theStaticContext->addNamespace(aPrefix, aURI); }
391
392- void addReference() const
393+void StaticContext::addReference() const
394 { theStaticContext->addReference(); }
395
396- virtual bool containsFunction(const std::string &aFnNameUri,
397+bool StaticContext::containsFunction(const std::string &aFnNameUri,
398 const std::string &aFnNameLocal,
399 int arity) const
400 { return theStaticContext->containsFunction(aFnNameUri, aFnNameLocal,
401 arity); }
402
403- virtual StaticContext createChildContext() const
404+StaticContext StaticContext::createChildContext() const
405 { return StaticContext(theStaticContext->createChildContext()); }
406
407- virtual void declareOption (const Item &aQName,
408+void StaticContext::declareOption (const Item &aQName,
409 const std::string &aOptionVal)
410 { return theStaticContext->declareOption(aQName.theItem, aOptionVal); }
411
412- virtual void disableFunction (const Item &aQName, int arity)
413+void StaticContext::disableFunction (const Item &aQName, int arity)
414 { theStaticContext->disableFunction( aQName.theItem, arity); }
415
416- virtual void free ()
417+void StaticContext::free ()
418 { theStaticContext->free(); }
419
420- virtual std::string getBaseURI () const
421+std::string StaticContext::getBaseURI () const
422 { return std::string(theStaticContext->getBaseURI().c_str()); }
423
424- virtual zorba::boundary_space_mode_t getBoundarySpacePolicy() const
425+zorba::boundary_space_mode_t StaticContext::getBoundarySpacePolicy() const
426 { return theStaticContext->getBoundarySpacePolicy(); }
427
428- virtual zorba::construction_mode_t getConstructionMode () const
429+zorba::construction_mode_t StaticContext::getConstructionMode () const
430 { return theStaticContext->getConstructionMode(); }
431
432- virtual void getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const
433+void StaticContext::getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const
434 { return theStaticContext->getCopyNamespacesMode(aPreserve, aInherit); }
435
436- virtual std::string getDefaultCollation () const
437+std::string StaticContext::getDefaultCollation () const
438 { return std::string(theStaticContext->getDefaultCollation().c_str()); }
439
440- virtual std::string getDefaultElementAndTypeNamespace () const
441+std::string StaticContext::getDefaultElementAndTypeNamespace () const
442 {
443 return std::string(theStaticContext->getDefaultElementAndTypeNamespace().
444 c_str());
445 }
446
447- virtual std::string getDefaultFunctionNamespace () const
448+std::string StaticContext::getDefaultFunctionNamespace () const
449 {
450 return std::string(theStaticContext->getDefaultFunctionNamespace().c_str());
451 }
452
453- virtual zorba::order_empty_mode_t getDefaultOrderForEmptySequences() const
454+zorba::order_empty_mode_t StaticContext::getDefaultOrderForEmptySequences() const
455 { return theStaticContext->getDefaultOrderForEmptySequences(); }
456
457- virtual std::string getNamespaceURIByPrefix(const std::string &aPrefix) const
458+std::string StaticContext::getNamespaceURIByPrefix(const std::string &aPrefix) const
459 {
460 return std::string(theStaticContext->getNamespaceURIByPrefix(aPrefix).
461 c_str());
462 }
463
464- virtual bool getOption(const Item &aQName, std::string &aOptionValue) const
465+bool StaticContext::getOption(const Item &aQName, std::string &aOptionValue) const
466 {
467 zorba::String optVal = zorba::String(aOptionValue.c_str());
468 return theStaticContext->getOption(aQName.theItem, optVal);
469 }
470
471- virtual zorba::ordering_mode_t getOrderingMode () const
472+zorba::ordering_mode_t StaticContext::getOrderingMode () const
473 { return theStaticContext->getOrderingMode(); }
474
475- long getRefCount () const
476+long StaticContext::getRefCount () const
477 { return theStaticContext->getRefCount(); }
478
479- virtual zorba::validation_mode_t getRevalidationMode ()
480+zorba::validation_mode_t StaticContext::getRevalidationMode ()
481 { return theStaticContext->getRevalidationMode(); }
482
483- virtual zorba::xpath1_0compatib_mode_t getXPath1_0CompatibMode () const
484+zorba::xpath1_0compatib_mode_t StaticContext::getXPath1_0CompatibMode () const
485 { return theStaticContext->getXPath1_0CompatibMode(); }
486
487- virtual void loadProlog (const std::string & aProlog,
488+void StaticContext::loadProlog (const std::string & aProlog,
489 const CompilerHints &hints)
490 { theStaticContext->loadProlog( aProlog, hints.theCompilerHints); }
491
492- void removeReference ()
493+void StaticContext::removeReference ()
494 { theStaticContext->removeReference(); }
495
496- virtual void resetTraceStream ()
497+void StaticContext::resetTraceStream ()
498 { theStaticContext->resetTraceStream(); }
499
500- virtual bool setBaseURI (const std::string &aBaseURI)
501+bool StaticContext::setBaseURI (const std::string &aBaseURI)
502 { return theStaticContext->setBaseURI(aBaseURI); }
503
504- virtual bool setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode)
505+bool StaticContext::setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode)
506 { return theStaticContext->setBoundarySpacePolicy(aMode); }
507
508- virtual bool setConstructionMode (zorba::construction_mode_t aMode)
509+bool StaticContext::setConstructionMode (zorba::construction_mode_t aMode)
510 { return theStaticContext->setConstructionMode(aMode); }
511
512- virtual bool setCopyNamespacesMode (zorba::preserve_mode_t aPreserve,
513+bool StaticContext::setCopyNamespacesMode (zorba::preserve_mode_t aPreserve,
514 zorba::inherit_mode_t aInherit)
515 { return theStaticContext->setCopyNamespacesMode(aPreserve, aInherit); }
516
517- virtual void setDefaultCollation (const std::string &aURI)
518+void StaticContext::setDefaultCollation (const std::string &aURI)
519 { theStaticContext->setDefaultCollation(aURI); }
520
521- virtual bool setDefaultElementAndTypeNamespace (const std::string &aURI)
522+bool StaticContext::setDefaultElementAndTypeNamespace (const std::string &aURI)
523 { return theStaticContext->setDefaultElementAndTypeNamespace(aURI); }
524
525- virtual bool setDefaultFunctionNamespace (const std::string &aURI)
526+bool StaticContext::setDefaultFunctionNamespace (const std::string &aURI)
527 { return theStaticContext->setDefaultFunctionNamespace(aURI); }
528
529- virtual bool setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode)
530+bool StaticContext::setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode)
531 { return theStaticContext->setDefaultOrderForEmptySequences(aMode); }
532
533- virtual bool setOrderingMode (zorba::ordering_mode_t aMode)
534+bool StaticContext::setOrderingMode (zorba::ordering_mode_t aMode)
535 { return theStaticContext->setOrderingMode(aMode); }
536
537- virtual void setRevalidationMode (zorba::validation_mode_t aMode)
538+void StaticContext::setRevalidationMode (zorba::validation_mode_t aMode)
539 { return theStaticContext->setRevalidationMode(aMode); }
540
541- virtual bool setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode)
542+bool StaticContext::setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode)
543 { return theStaticContext->setXPath1_0CompatibMode(aMode); }
544
545- void destroy()
546+void StaticContext::destroy()
547 { theStaticContext = 0; }
548
549-}; // class StaticContext
550+ // class StaticContext
551
552
553
554@@ -209,63 +204,4 @@
555 %rename(VALIDATE_LAX) validate_lax;
556 %rename(VALIDATE_STRICT) validate_strict;
557
558-#include <zorba/static_context_consts.h>
559-
560-
561-class StaticContext
562-{
563- public:
564- virtual void addColation(const std::string& aURI);
565- virtual bool addNamespace(const std::string& aPrefix,
566- const std::string& aURI);
567- void addReference() const;
568- virtual bool containsFunction(const std::string &aFnNameUri,
569- const std::string &aFnNameLocal,
570- int arity) const;
571-
572- virtual StaticContext createChildContext() const;
573- virtual void declareOption(const Item &aQName,
574- const std::string &aOptionVal);
575- virtual void disableFunction(const Item &aQName, int arity);
576-
577- virtual void free ();
578- virtual std::string getBaseURI () const;
579- virtual zorba::boundary_space_mode_t getBoundarySpacePolicy () const;
580-
581- virtual zorba::construction_mode_t getConstructionMode () const;
582- virtual void getCopyNamespacesMode (zorba::preserve_mode_t &aPreserve, zorba::inherit_mode_t &aInherit) const;
583- virtual std::string getDefaultCollation () const;
584- virtual std::string getDefaultElementAndTypeNamespace () const;
585- virtual std::string getDefaultFunctionNamespace () const;
586- virtual zorba::order_empty_mode_t getDefaultOrderForEmptySequences () const;
587-
588- virtual std::string getNamespaceURIByPrefix(const std::string &aPrefix) const;
589- virtual bool getOption(const Item &aQName, std::string &aOptionValue) const;
590- virtual zorba::ordering_mode_t getOrderingMode() const;
591- long getRefCount() const;
592- virtual zorba::validation_mode_t getRevalidationMode();
593- virtual zorba::xpath1_0compatib_mode_t getXPath1_0CompatibMode () const;
594- virtual void loadProlog (const std::string &,
595- const Zorba_CompilerHints_t &hints);
596-
597- void removeReference ();
598- virtual void resetTraceStream ();
599- virtual bool setBaseURI (const std::string &aBaseURI);
600- virtual bool setBoundarySpacePolicy (zorba::boundary_space_mode_t aMode);
601-
602- virtual bool setConstructionMode (zorba::construction_mode_t aMode);
603-
604- virtual bool setCopyNamespacesMode (zorba::preserve_mode_t aPreserve,
605- zorba::inherit_mode_t aInherit);
606- virtual void setDefaultCollation (const std::string &aURI);
607- virtual bool setDefaultElementAndTypeNamespace (const std::string &aURI);
608- virtual bool setDefaultFunctionNamespace (const std::string &aURI);
609- virtual bool setDefaultOrderForEmptySequences (zorba::order_empty_mode_t aMode);
610-
611- virtual bool setOrderingMode (zorba::ordering_mode_t aMode);
612- virtual void setRevalidationMode (zorba::validation_mode_t aMode);
613-
614- virtual bool setXPath1_0CompatibMode (zorba::xpath1_0compatib_mode_t aMode);
615-
616- void destroy();
617-}; // class StaticContext
618+%include "StaticContext.h"
619
620=== modified file 'swig/XQuery.i'
621--- swig/XQuery.i 2011-07-20 01:40:52 +0000
622+++ swig/XQuery.i 2011-10-27 02:34:25 +0000
623@@ -74,6 +74,7 @@
624 friend class DocumentManager;
625 friend class SingletonIterator;
626 friend class DynamicContext;
627+ friend class ItemFactory;
628
629 private:
630 zorba::Item theItem;
631@@ -209,6 +210,17 @@
632 return lStream.str();
633 }
634
635+ void compile (const std::string &aQuery)
636+ {
637+ theQuery->compile(aQuery);
638+ }
639+
640+ void compile (const std::string &aQuery, StaticContext &aStaticContext )
641+ {
642+ Zorba_CompilerHints_t hints;
643+ theQuery->compile(aQuery, aStaticContext.theStaticContext, hints);
644+ }
645+
646 std::string printPlanAsXML()
647 {
648 std::ostringstream lStream;
649@@ -322,6 +334,8 @@
650 std::string execute();
651 std::string printPlanAsXML();
652 std::string printPlanAsDOT();
653+ void compile (const std::string &aQuery);
654+ void compile (const std::string &aQuery, StaticContext &aStaticContext);
655
656 #ifdef SWIGPYTHON
657 void executeSAX(SAX2ContentHandlerProxy* contentHandlerProxy);
658
659=== modified file 'swig/Zorba.i'
660--- swig/Zorba.i 2011-07-13 21:24:04 +0000
661+++ swig/Zorba.i 2011-10-27 02:34:25 +0000
662@@ -16,6 +16,11 @@
663 return Zorba(zorba::Zorba::getInstance(aStore.getStore()));
664 }
665
666+ ItemFactory getItemFactory()
667+ {
668+ return ItemFactory(theZorba->getItemFactory());
669+ }
670+
671 StaticContext createStaticContext()
672 {
673 return StaticContext(theZorba->createStaticContext());
674@@ -25,7 +30,25 @@
675 {
676 return XQuery(theZorba->compileQuery(aStr));
677 }
678-/*
679+
680+ XQuery createQuery()
681+ {
682+ return XQuery(theZorba->createQuery());
683+ }
684+
685+ XQuery compileQuery(
686+ const std::string& aStr,
687+ StaticContext &aStaticContext )
688+ {
689+ return XQuery(
690+ theZorba->compileQuery(
691+ aStr,
692+ aStaticContext.theStaticContext
693+ )
694+ );
695+ }
696+
697+ /*
698 //--->> DiagnosticHandler implementations are postponed
699 XQuery compileQuery(
700 const std::string& aStr,
701@@ -85,7 +108,11 @@
702 public:
703 static Zorba getInstance(const Store&);
704 StaticContext createStaticContext();
705+ XQuery createQuery();
706 XQuery compileQuery(const std::string& aStr);
707+ XQuery compileQuery(const std::string& aStr, StaticContext &aStaticContext );
708+ ItemFactory getItemFactory();
709+
710 /*
711 XQuery compileQuery(const std::string& aStr, DiagnosticHandler* aDiagnosticHandler);
712 XQuery compileQuery(const std::string& aStr, StaticContext &aStaticContext,
713
714=== modified file 'swig/java/CMakeLists.txt'
715--- swig/java/CMakeLists.txt 2011-09-02 19:58:59 +0000
716+++ swig/java/CMakeLists.txt 2011-10-27 02:34:25 +0000
717@@ -60,6 +60,8 @@
718 MESSAGE(STATUS "Java module install path: " ${JAVA_SITEARCH_DIR})
719
720 FILE(GLOB JAVA_SWIG_FILES "${CMAKE_CURRENT_BINARY_DIR}/*.java")
721+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
722+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
723
724 IF ( APPLE )
725 INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${ZORBA_SWIG_LIB_PREFIX}libzorba_api.jnilib DESTINATION ${JAVA_SITEARCH_DIR})
726
727=== modified file 'swig/php/CMakeLists.txt'
728--- swig/php/CMakeLists.txt 2011-09-02 19:58:59 +0000
729+++ swig/php/CMakeLists.txt 2011-10-27 02:34:25 +0000
730@@ -38,6 +38,9 @@
731 SWIG_LINK_LIBRARIES (zorba_api ${PHP5_LIBRARY})
732 ENDIF (WIN32)
733
734+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
735+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
736+
737 # The following fix was added because of the changes in CMake 2.8, which have the
738 # result of naming the java binding library "liblibzorba_api.so" instead of "libzorba_api.so"
739 SET_TARGET_PROPERTIES( ${SWIG_MODULE_zorba_api_REAL_NAME} PROPERTIES PROJECT_LABEL "Api_PHP" )
740
741=== modified file 'swig/php/zorba_api.i'
742--- swig/php/zorba_api.i 2011-07-12 00:51:50 +0000
743+++ swig/php/zorba_api.i 2011-10-27 02:34:25 +0000
744@@ -28,6 +28,12 @@
745 #define PHP_COMPILER_ID "VC6"
746 #endif
747 #endif
748+
749+#if defined(_MSC_VER)
750+#define strtoll _strtoi64
751+#define strtoull _strtoui64
752+#endif
753+
754 %}
755
756
757
758=== modified file 'swig/python/CMakeLists.txt'
759--- swig/python/CMakeLists.txt 2011-09-02 19:58:59 +0000
760+++ swig/python/CMakeLists.txt 2011-10-27 02:34:25 +0000
761@@ -29,6 +29,8 @@
762 )
763
764 SET (PYTHON_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/share/python")
765+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
766+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
767 MESSAGE (STATUS "SWIG Python: Python module install path: " ${PYTHON_INSTALL_PATH})
768
769 IF (NOT WIN32)
770
771=== modified file 'swig/ruby/CMakeLists.txt'
772--- swig/ruby/CMakeLists.txt 2011-10-26 00:13:05 +0000
773+++ swig/ruby/CMakeLists.txt 2011-10-27 02:34:25 +0000
774@@ -50,6 +50,8 @@
775 EXECUTE_PROCESS(COMMAND ${RUBY_EXECUTABLE} -r rbconfig -e "print Config::CONFIG['sitearchdir']"
776 OUTPUT_VARIABLE RUBY_SITEARCH_DIR)
777 #STRING(REPLACE "/usr/" "" RUBY_SITEARCH_DIR "${RUBY_SITEARCH_DIR}" )
778+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../StaticContext.h" "${CMAKE_CURRENT_BINARY_DIR}/StaticContext.h")
779+ CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/../ItemFactory.h" "${CMAKE_CURRENT_BINARY_DIR}/ItemFactory.h")
780
781 SET (RUBY_SITEARCH_DIR "${CMAKE_INSTALL_PREFIX}/share/ruby")
782
783
784=== modified file 'swig/zorba_api.i'
785--- swig/zorba_api.i 2011-07-13 21:24:04 +0000
786+++ swig/zorba_api.i 2011-10-27 02:34:25 +0000
787@@ -52,7 +52,6 @@
788 class Item;
789 class Iterator;
790 class XQuery;
791- class StaticContext;
792 class Store;
793 class Zorba;
794
795@@ -65,6 +64,9 @@
796 class UserException;
797 class ZorbaException;
798
799+ #include "StaticContext.h"
800+ #include "ItemFactory.h"
801+
802 %}
803
804
805@@ -77,5 +79,6 @@
806 %include "CompilerHints.i"
807 %include "StaticContext.i"
808 %include "Zorba.i"
809+%include "ItemFactory.i"
810
811

Subscribers

People subscribed via source and target branches