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

Proposed by Rodolfo Ochoa
Status: Merged
Approved by: Rodolfo Ochoa
Approved revision: 10590
Merged at revision: 10589
Proposed branch: lp:~zorba-coders/zorba/ItemFactory
Merge into: lp:zorba
Diff against target: 302 lines (+184/-5)
7 files modified
ChangeLog (+1/-0)
include/zorba/item_factory.h (+58/-0)
src/api/itemfactoryimpl.cpp (+60/-3)
src/api/itemfactoryimpl.h (+24/-2)
src/store/api/item_factory.h (+4/-0)
src/store/naive/simple_item_factory.cpp (+33/-0)
src/store/naive/simple_item_factory.h (+4/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/ItemFactory
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Nicolae Brinza Approve
Cezar Andrei Pending
Review via email: mp+86125@code.launchpad.net

Commit message

-Added createDayTimeDuration
-Added createYearMonthDuration
-Added createDocumentNode
-Added createCommentNode
-Added createPiNode

Description of the change

-Added createDayTimeDuration
-Added createYearMonthDuration
-Added createDocumentNode
-Added createCommentNode
-Added createPiNode

To post a comment you must log in.
Revision history for this message
Nicolae Brinza (nbrinza) wrote :

Approved.

review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

The commit looks good to me. However, could you please put an item int he ChangeLog that mentions the api extension?

Also, for consistency and performance, the results of the Unmarshaller calls in createComment/PiNode should be "zstring const&".

review: Needs Fixing
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in ChangeLog

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-12-20T21-51-30.924Z 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
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-12-20T22-25-18.544Z 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

lp:~zorba-coders/zorba/ItemFactory updated
10589. By Rodolfo Ochoa

fix for createTextNode used in process-module

10590. By Rodolfo Ochoa

one more change to avoid error on process-module

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-12-20T22-53-17.591Z 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
=== modified file 'ChangeLog'
--- ChangeLog 2011-12-20 11:50:23 +0000
+++ ChangeLog 2011-12-20 22:52:25 +0000
@@ -7,6 +7,7 @@
7 * Added index management function to the C++ api's StaticCollectionManager.7 * Added index management function to the C++ api's StaticCollectionManager.
8 * Fixed bug #905041 (allow for the default element and function namespaces to be8 * Fixed bug #905041 (allow for the default element and function namespaces to be
9 set multiple times via the c++ api).9 set multiple times via the c++ api).
10 * Added createDayTimeDuration, createYearMonthDuration, createDocumentNode, createCommentNode, createPiNode to api's ItemFactory.
1011
11version 2.112version 2.1
1213
1314
=== modified file 'include/zorba/item_factory.h'
--- include/zorba/item_factory.h 2011-07-24 22:28:31 +0000
+++ include/zorba/item_factory.h 2011-12-20 22:52:25 +0000
@@ -327,6 +327,34 @@
327 createDuration ( short aYear, short aMonths, short aDays,327 createDuration ( short aYear, short aMonths, short aDays,
328 short aHours, short aMinutes, double aSeconds ) = 0;328 short aHours, short aMinutes, double aSeconds ) = 0;
329329
330 /** \brief Creates a dayTimeDuration Item
331 * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
332 *
333 * @param aValue String lexical representation of the duration.
334 * @return the dayTimeDuration Item.
335 */
336 virtual Item
337 createDayTimeDuration( const String& aValue ) = 0;
338
339 /** \brief Creates a yearMonthDuration Item
340 * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
341 *
342 * @param aValue String lexical representation of the duration.
343 * @return the yearMonthDuration Item.
344 */
345 virtual Item
346 createYearMonthDuration( const String& aValue ) = 0;
347
348 /** \brief Creates a documentNode Item
349 * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
350 *
351 * @param aBaseUri String representation of the Base URI.
352 * @param aDocUri String representation of the Document URI.
353 * @return the documentNode Item.
354 */
355 virtual Item
356 createDocumentNode( const String& aBaseUri, const String& aDocUri ) = 0;
357
330 /** \brief creates a float item358 /** \brief creates a float item
331 * see [http://www.w3.org/tr/xmlschema-2/#float]359 * see [http://www.w3.org/tr/xmlschema-2/#float]
332 *360 *
@@ -609,6 +637,36 @@
609 std::vector<Item> aTypedValue) = 0;637 std::vector<Item> aTypedValue) = 0;
610638
611 /**639 /**
640 * Create a new comment node N and place it as the last child of a given
641 * parent node. If no parent is given, N becomes the root (and single node)
642 * of a new XML tree.
643 *
644 * @param parent The parent P of the new node; may be NULL.
645 * @param content The content of the new node.
646 * @return The new node N created by this method
647 */
648 virtual Item createCommentNode (
649 Item aParent,
650 String &aContent) = 0;
651
652 /**
653 * Create a new Processing Instruction node N and place it among the
654 * children of a given parent node. If no parent is given, N becomes the
655 * root (and single node) of a new XML tree.
656 *
657 * @param aParent The parent P of the new node; may be NULL.
658 * @param aTarget The Target of the new node.
659 * @param aContent The Content of the new node.
660 * @param aBaseUri The Base URI of the new node, may be NULL.
661 * @return The new node N created by this method
662 */
663 virtual Item createPiNode (
664 Item aParent,
665 String &aTarget,
666 String &aContent,
667 String &aBaseUri)=0;
668
669 /**
612 * Create a new text node N and place it among the670 * Create a new text node N and place it among the
613 * children of a given parent node. If no parent is given, N becomes the671 * children of a given parent node. If no parent is given, N becomes the
614 * root (and single node) of a new XML tree.672 * root (and single node) of a new XML tree.
615673
=== modified file 'src/api/itemfactoryimpl.cpp'
--- src/api/itemfactoryimpl.cpp 2011-07-22 07:23:17 +0000
+++ src/api/itemfactoryimpl.cpp 2011-12-20 22:52:25 +0000
@@ -406,8 +406,39 @@
406 406
407 return &*lItem;407 return &*lItem;
408}408}
409 409
410 410Item ItemFactoryImpl::createDayTimeDuration( const String& aValue )
411{
412 zstring const &lString = Unmarshaller::getInternalString( aValue );
413 store::Item_t lItem;
414 theItemFactory->createDayTimeDuration(lItem, lString.c_str(), lString.size());
415
416 return &*lItem;
417}
418
419Item ItemFactoryImpl::createYearMonthDuration( const String& aValue )
420{
421 zstring const &lString = Unmarshaller::getInternalString( aValue );
422 store::Item_t lItem;
423 theItemFactory->createYearMonthDuration(lItem, lString.c_str(), lString.size());
424
425 return &*lItem;
426}
427
428Item ItemFactoryImpl::createDocumentNode( const String& aBaseUri, const String& aDocUri )
429{
430 store::Item_t lItem;
431 zstring &lBaseUri = Unmarshaller::getInternalString( aBaseUri );
432 zstring &lDocUri = Unmarshaller::getInternalString( aDocUri );
433 try {
434 theItemFactory->createDocumentNode(lItem, lBaseUri, lDocUri);
435 }
436 catch ( std::exception const& ) {
437 // ignore
438 }
439 return &*lItem;
440}
441
411Item ItemFactoryImpl::createFloat ( const String& aValue )442Item ItemFactoryImpl::createFloat ( const String& aValue )
412{443{
413 zstring const &lString = Unmarshaller::getInternalString( aValue );444 zstring const &lString = Unmarshaller::getInternalString( aValue );
@@ -738,10 +769,36 @@
738}769}
739770
740771
772zorba::Item ItemFactoryImpl::createCommentNode(Item aParent, String &aContent)
773{
774 store::Item_t lItem;
775 zstring &lContent = Unmarshaller::getInternalString(aContent);
776 theItemFactory->createCommentNode(lItem,
777 Unmarshaller::getInternalItem(aParent),
778 lContent);
779 return &*lItem;
780}
781
782
783zorba::Item ItemFactoryImpl::createPiNode(Item aParent, String &aTarget, String &aContent, String &aBaseUri)
784{
785 store::Item_t lItem;
786 zstring &lTarget = Unmarshaller::getInternalString(aTarget);
787 zstring &lContent = Unmarshaller::getInternalString(aContent);
788 zstring &lBaseUri = Unmarshaller::getInternalString(aBaseUri);
789 theItemFactory->createPiNode(lItem,
790 Unmarshaller::getInternalItem(aParent),
791 lTarget,
792 lContent,
793 lBaseUri);
794 return &*lItem;
795}
796
797
741zorba::Item ItemFactoryImpl::createTextNode(Item parent, String content)798zorba::Item ItemFactoryImpl::createTextNode(Item parent, String content)
742{799{
743 store::Item_t lItem;800 store::Item_t lItem;
744 zstring lContent = Unmarshaller::getInternalString(content);801 zstring &lContent = Unmarshaller::getInternalString(content);
745 theItemFactory->createTextNode(lItem,802 theItemFactory->createTextNode(lItem,
746 Unmarshaller::getInternalItem(parent),803 Unmarshaller::getInternalItem(parent),
747 lContent);804 lContent);
748805
=== modified file 'src/api/itemfactoryimpl.h'
--- src/api/itemfactoryimpl.h 2011-07-22 07:23:17 +0000
+++ src/api/itemfactoryimpl.h 2011-12-20 22:52:25 +0000
@@ -125,7 +125,16 @@
125 virtual Item125 virtual Item
126 createDuration ( short aYears, short aMonths, short aDays, 126 createDuration ( short aYears, short aMonths, short aDays,
127 short aHours, short aMinutes, double aSeconds );127 short aHours, short aMinutes, double aSeconds );
128 128
129 virtual Item
130 createDayTimeDuration( const String& aValue );
131
132 virtual Item
133 createYearMonthDuration( const String& aValue );
134
135 virtual Item
136 createDocumentNode( const String& aBaseUri, const String& aDocUri );
137
129 virtual Item138 virtual Item
130 createFloat ( const String& aValue );139 createFloat ( const String& aValue );
131 140
@@ -218,7 +227,20 @@
218 Item aTypeName,227 Item aTypeName,
219 std::vector<Item> aTypedValue);228 std::vector<Item> aTypedValue);
220229
221 virtual Item createTextNode(230 virtual Item
231 createCommentNode (
232 Item aParent,
233 String &aContent);
234
235 virtual Item
236 createPiNode (
237 Item aParent,
238 String &aTarget,
239 String &aContent,
240 String &aBaseUri);
241
242 virtual Item
243 createTextNode(
222 Item parent,244 Item parent,
223 String content);245 String content);
224246
225247
=== modified file 'src/store/api/item_factory.h'
--- src/store/api/item_factory.h 2011-12-20 09:04:58 +0000
+++ src/store/api/item_factory.h 2011-12-20 22:52:25 +0000
@@ -474,8 +474,12 @@
474474
475 virtual bool createYearMonthDuration(Item_t& result, xs_yearMonthDuration* value ) = 0;475 virtual bool createYearMonthDuration(Item_t& result, xs_yearMonthDuration* value ) = 0;
476476
477 virtual bool createYearMonthDuration(Item_t& result, const char* str, ulong strlen ) = 0;
478
477 virtual bool createDayTimeDuration(Item_t& result, xs_dayTimeDuration* value ) = 0;479 virtual bool createDayTimeDuration(Item_t& result, xs_dayTimeDuration* value ) = 0;
478480
481 virtual bool createDayTimeDuration(Item_t& result, const char* str, ulong strlen ) = 0;
482
479 /**483 /**
480 * Specification: [http://www.w3.org/TR/xmlschema-2/#duration]484 * Specification: [http://www.w3.org/TR/xmlschema-2/#duration]
481 * @param value string representation of the value485 * @param value string representation of the value
482486
=== modified file 'src/store/naive/simple_item_factory.cpp'
--- src/store/naive/simple_item_factory.cpp 2011-12-20 18:30:39 +0000
+++ src/store/naive/simple_item_factory.cpp 2011-12-20 22:52:25 +0000
@@ -954,6 +954,22 @@
954 return true;954 return true;
955}955}
956956
957bool BasicItemFactory::createYearMonthDuration(
958 store::Item_t& result,
959 const char* str,
960 ulong strlen)
961{
962 Duration d;
963 if (Duration::parseYearMonthDuration(str, strlen, d) == 0)
964 {
965 result = new DurationItem(&d);
966 return true;
967 }
968
969 result = NULL;
970 return false;
971}
972
957973
958bool BasicItemFactory::createDayTimeDuration(974bool BasicItemFactory::createDayTimeDuration(
959 store::Item_t& result,975 store::Item_t& result,
@@ -964,6 +980,23 @@
964}980}
965981
966982
983bool BasicItemFactory::createDayTimeDuration(
984 store::Item_t& result,
985 const char* str,
986 ulong strlen)
987{
988 Duration d;
989 if (Duration::parseDayTimeDuration(str, strlen, d) == 0)
990 {
991 result = new DurationItem(&d);
992 return true;
993 }
994
995 result = NULL;
996 return false;
997}
998
999
967bool BasicItemFactory::createBase64Binary(store::Item_t& result, xs_base64Binary value)1000bool BasicItemFactory::createBase64Binary(store::Item_t& result, xs_base64Binary value)
968{1001{
969 result = new Base64BinaryItem(value);1002 result = new Base64BinaryItem(value);
9701003
=== modified file 'src/store/naive/simple_item_factory.h'
--- src/store/naive/simple_item_factory.h 2011-12-20 18:30:39 +0000
+++ src/store/naive/simple_item_factory.h 2011-12-20 22:52:25 +0000
@@ -204,10 +204,14 @@
204204
205 bool createDuration(store::Item_t& result, short years, short months, short days, short hours, short minutes, double seconds);205 bool createDuration(store::Item_t& result, short years, short months, short days, short hours, short minutes, double seconds);
206206
207 bool createYearMonthDuration(store::Item_t& result, const char* str, ulong strlen );
208
207 bool createYearMonthDuration(store::Item_t& result, xs_yearMonthDuration* value );209 bool createYearMonthDuration(store::Item_t& result, xs_yearMonthDuration* value );
208210
209 bool createDayTimeDuration(store::Item_t& result, xs_dayTimeDuration* value );211 bool createDayTimeDuration(store::Item_t& result, xs_dayTimeDuration* value );
210212
213 bool createDayTimeDuration(store::Item_t& result, const char* str, ulong strlen );
214
211 bool createENTITIES(store::Item_t& result, zstring& value);215 bool createENTITIES(store::Item_t& result, zstring& value);
212216
213 bool createENTITY(store::Item_t& result, zstring& value);217 bool createENTITY(store::Item_t& result, zstring& value);

Subscribers

People subscribed via source and target branches