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
1=== modified file 'ChangeLog'
2--- ChangeLog 2011-12-20 11:50:23 +0000
3+++ ChangeLog 2011-12-20 22:52:25 +0000
4@@ -7,6 +7,7 @@
5 * Added index management function to the C++ api's StaticCollectionManager.
6 * Fixed bug #905041 (allow for the default element and function namespaces to be
7 set multiple times via the c++ api).
8+ * Added createDayTimeDuration, createYearMonthDuration, createDocumentNode, createCommentNode, createPiNode to api's ItemFactory.
9
10 version 2.1
11
12
13=== modified file 'include/zorba/item_factory.h'
14--- include/zorba/item_factory.h 2011-07-24 22:28:31 +0000
15+++ include/zorba/item_factory.h 2011-12-20 22:52:25 +0000
16@@ -327,6 +327,34 @@
17 createDuration ( short aYear, short aMonths, short aDays,
18 short aHours, short aMinutes, double aSeconds ) = 0;
19
20+ /** \brief Creates a dayTimeDuration Item
21+ * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
22+ *
23+ * @param aValue String lexical representation of the duration.
24+ * @return the dayTimeDuration Item.
25+ */
26+ virtual Item
27+ createDayTimeDuration( const String& aValue ) = 0;
28+
29+ /** \brief Creates a yearMonthDuration Item
30+ * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
31+ *
32+ * @param aValue String lexical representation of the duration.
33+ * @return the yearMonthDuration Item.
34+ */
35+ virtual Item
36+ createYearMonthDuration( const String& aValue ) = 0;
37+
38+ /** \brief Creates a documentNode Item
39+ * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
40+ *
41+ * @param aBaseUri String representation of the Base URI.
42+ * @param aDocUri String representation of the Document URI.
43+ * @return the documentNode Item.
44+ */
45+ virtual Item
46+ createDocumentNode( const String& aBaseUri, const String& aDocUri ) = 0;
47+
48 /** \brief creates a float item
49 * see [http://www.w3.org/tr/xmlschema-2/#float]
50 *
51@@ -609,6 +637,36 @@
52 std::vector<Item> aTypedValue) = 0;
53
54 /**
55+ * Create a new comment node N and place it as the last child of a given
56+ * parent node. If no parent is given, N becomes the root (and single node)
57+ * of a new XML tree.
58+ *
59+ * @param parent The parent P of the new node; may be NULL.
60+ * @param content The content of the new node.
61+ * @return The new node N created by this method
62+ */
63+ virtual Item createCommentNode (
64+ Item aParent,
65+ String &aContent) = 0;
66+
67+ /**
68+ * Create a new Processing Instruction node N and place it among the
69+ * children of a given parent node. If no parent is given, N becomes the
70+ * root (and single node) of a new XML tree.
71+ *
72+ * @param aParent The parent P of the new node; may be NULL.
73+ * @param aTarget The Target of the new node.
74+ * @param aContent The Content of the new node.
75+ * @param aBaseUri The Base URI of the new node, may be NULL.
76+ * @return The new node N created by this method
77+ */
78+ virtual Item createPiNode (
79+ Item aParent,
80+ String &aTarget,
81+ String &aContent,
82+ String &aBaseUri)=0;
83+
84+ /**
85 * Create a new text node N and place it among the
86 * children of a given parent node. If no parent is given, N becomes the
87 * root (and single node) of a new XML tree.
88
89=== modified file 'src/api/itemfactoryimpl.cpp'
90--- src/api/itemfactoryimpl.cpp 2011-07-22 07:23:17 +0000
91+++ src/api/itemfactoryimpl.cpp 2011-12-20 22:52:25 +0000
92@@ -406,8 +406,39 @@
93
94 return &*lItem;
95 }
96-
97-
98+
99+Item ItemFactoryImpl::createDayTimeDuration( const String& aValue )
100+{
101+ zstring const &lString = Unmarshaller::getInternalString( aValue );
102+ store::Item_t lItem;
103+ theItemFactory->createDayTimeDuration(lItem, lString.c_str(), lString.size());
104+
105+ return &*lItem;
106+}
107+
108+Item ItemFactoryImpl::createYearMonthDuration( const String& aValue )
109+{
110+ zstring const &lString = Unmarshaller::getInternalString( aValue );
111+ store::Item_t lItem;
112+ theItemFactory->createYearMonthDuration(lItem, lString.c_str(), lString.size());
113+
114+ return &*lItem;
115+}
116+
117+Item ItemFactoryImpl::createDocumentNode( const String& aBaseUri, const String& aDocUri )
118+{
119+ store::Item_t lItem;
120+ zstring &lBaseUri = Unmarshaller::getInternalString( aBaseUri );
121+ zstring &lDocUri = Unmarshaller::getInternalString( aDocUri );
122+ try {
123+ theItemFactory->createDocumentNode(lItem, lBaseUri, lDocUri);
124+ }
125+ catch ( std::exception const& ) {
126+ // ignore
127+ }
128+ return &*lItem;
129+}
130+
131 Item ItemFactoryImpl::createFloat ( const String& aValue )
132 {
133 zstring const &lString = Unmarshaller::getInternalString( aValue );
134@@ -738,10 +769,36 @@
135 }
136
137
138+zorba::Item ItemFactoryImpl::createCommentNode(Item aParent, String &aContent)
139+{
140+ store::Item_t lItem;
141+ zstring &lContent = Unmarshaller::getInternalString(aContent);
142+ theItemFactory->createCommentNode(lItem,
143+ Unmarshaller::getInternalItem(aParent),
144+ lContent);
145+ return &*lItem;
146+}
147+
148+
149+zorba::Item ItemFactoryImpl::createPiNode(Item aParent, String &aTarget, String &aContent, String &aBaseUri)
150+{
151+ store::Item_t lItem;
152+ zstring &lTarget = Unmarshaller::getInternalString(aTarget);
153+ zstring &lContent = Unmarshaller::getInternalString(aContent);
154+ zstring &lBaseUri = Unmarshaller::getInternalString(aBaseUri);
155+ theItemFactory->createPiNode(lItem,
156+ Unmarshaller::getInternalItem(aParent),
157+ lTarget,
158+ lContent,
159+ lBaseUri);
160+ return &*lItem;
161+}
162+
163+
164 zorba::Item ItemFactoryImpl::createTextNode(Item parent, String content)
165 {
166 store::Item_t lItem;
167- zstring lContent = Unmarshaller::getInternalString(content);
168+ zstring &lContent = Unmarshaller::getInternalString(content);
169 theItemFactory->createTextNode(lItem,
170 Unmarshaller::getInternalItem(parent),
171 lContent);
172
173=== modified file 'src/api/itemfactoryimpl.h'
174--- src/api/itemfactoryimpl.h 2011-07-22 07:23:17 +0000
175+++ src/api/itemfactoryimpl.h 2011-12-20 22:52:25 +0000
176@@ -125,7 +125,16 @@
177 virtual Item
178 createDuration ( short aYears, short aMonths, short aDays,
179 short aHours, short aMinutes, double aSeconds );
180-
181+
182+ virtual Item
183+ createDayTimeDuration( const String& aValue );
184+
185+ virtual Item
186+ createYearMonthDuration( const String& aValue );
187+
188+ virtual Item
189+ createDocumentNode( const String& aBaseUri, const String& aDocUri );
190+
191 virtual Item
192 createFloat ( const String& aValue );
193
194@@ -218,7 +227,20 @@
195 Item aTypeName,
196 std::vector<Item> aTypedValue);
197
198- virtual Item createTextNode(
199+ virtual Item
200+ createCommentNode (
201+ Item aParent,
202+ String &aContent);
203+
204+ virtual Item
205+ createPiNode (
206+ Item aParent,
207+ String &aTarget,
208+ String &aContent,
209+ String &aBaseUri);
210+
211+ virtual Item
212+ createTextNode(
213 Item parent,
214 String content);
215
216
217=== modified file 'src/store/api/item_factory.h'
218--- src/store/api/item_factory.h 2011-12-20 09:04:58 +0000
219+++ src/store/api/item_factory.h 2011-12-20 22:52:25 +0000
220@@ -474,8 +474,12 @@
221
222 virtual bool createYearMonthDuration(Item_t& result, xs_yearMonthDuration* value ) = 0;
223
224+ virtual bool createYearMonthDuration(Item_t& result, const char* str, ulong strlen ) = 0;
225+
226 virtual bool createDayTimeDuration(Item_t& result, xs_dayTimeDuration* value ) = 0;
227
228+ virtual bool createDayTimeDuration(Item_t& result, const char* str, ulong strlen ) = 0;
229+
230 /**
231 * Specification: [http://www.w3.org/TR/xmlschema-2/#duration]
232 * @param value string representation of the value
233
234=== modified file 'src/store/naive/simple_item_factory.cpp'
235--- src/store/naive/simple_item_factory.cpp 2011-12-20 18:30:39 +0000
236+++ src/store/naive/simple_item_factory.cpp 2011-12-20 22:52:25 +0000
237@@ -954,6 +954,22 @@
238 return true;
239 }
240
241+bool BasicItemFactory::createYearMonthDuration(
242+ store::Item_t& result,
243+ const char* str,
244+ ulong strlen)
245+{
246+ Duration d;
247+ if (Duration::parseYearMonthDuration(str, strlen, d) == 0)
248+ {
249+ result = new DurationItem(&d);
250+ return true;
251+ }
252+
253+ result = NULL;
254+ return false;
255+}
256+
257
258 bool BasicItemFactory::createDayTimeDuration(
259 store::Item_t& result,
260@@ -964,6 +980,23 @@
261 }
262
263
264+bool BasicItemFactory::createDayTimeDuration(
265+ store::Item_t& result,
266+ const char* str,
267+ ulong strlen)
268+{
269+ Duration d;
270+ if (Duration::parseDayTimeDuration(str, strlen, d) == 0)
271+ {
272+ result = new DurationItem(&d);
273+ return true;
274+ }
275+
276+ result = NULL;
277+ return false;
278+}
279+
280+
281 bool BasicItemFactory::createBase64Binary(store::Item_t& result, xs_base64Binary value)
282 {
283 result = new Base64BinaryItem(value);
284
285=== modified file 'src/store/naive/simple_item_factory.h'
286--- src/store/naive/simple_item_factory.h 2011-12-20 18:30:39 +0000
287+++ src/store/naive/simple_item_factory.h 2011-12-20 22:52:25 +0000
288@@ -204,10 +204,14 @@
289
290 bool createDuration(store::Item_t& result, short years, short months, short days, short hours, short minutes, double seconds);
291
292+ bool createYearMonthDuration(store::Item_t& result, const char* str, ulong strlen );
293+
294 bool createYearMonthDuration(store::Item_t& result, xs_yearMonthDuration* value );
295
296 bool createDayTimeDuration(store::Item_t& result, xs_dayTimeDuration* value );
297
298+ bool createDayTimeDuration(store::Item_t& result, const char* str, ulong strlen );
299+
300 bool createENTITIES(store::Item_t& result, zstring& value);
301
302 bool createENTITY(store::Item_t& result, zstring& value);

Subscribers

People subscribed via source and target branches