Merge lp:~zorba-coders/zorba/ItemFactory into lp:zorba
- ItemFactory
- Merge into trunk
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 |
Related bugs: |
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 createDayTimeDu
-Added createYearMonth
-Added createDocumentNode
-Added createCommentNode
-Added createPiNode
Description of the change
-Added createDayTimeDu
-Added createYearMonth
-Added createDocumentNode
-Added createCommentNode
-Added createPiNode
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/
Matthias Brantner (matthias-brantner) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Attempt to merge into lp:zorba failed due to conflicts:
text conflict in ChangeLog
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
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/
Validation queue job ItemFactory-
final status was:
No tests were run - build or configure step must have failed.
Not commiting changes.
Error in read script: /home/ceej/
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
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/
Validation queue job ItemFactory-
final status was:
No tests were run - build or configure step must have failed.
Not commiting changes.
Error in read script: /home/ceej/
- 10589. By Rodolfo Ochoa
-
fix for createTextNode used in process-module
- 10590. By Rodolfo Ochoa
-
one more change to avoid error on process-module
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job ItemFactory-
All tests succeeded!
Preview Diff
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 | 7 | * Added index management function to the C++ api's StaticCollectionManager. | 7 | * Added index management function to the C++ api's StaticCollectionManager. |
6 | 8 | * Fixed bug #905041 (allow for the default element and function namespaces to be | 8 | * Fixed bug #905041 (allow for the default element and function namespaces to be |
7 | 9 | set multiple times via the c++ api). | 9 | set multiple times via the c++ api). |
8 | 10 | * Added createDayTimeDuration, createYearMonthDuration, createDocumentNode, createCommentNode, createPiNode to api's ItemFactory. | ||
9 | 10 | 11 | ||
10 | 11 | version 2.1 | 12 | version 2.1 |
11 | 12 | 13 | ||
12 | 13 | 14 | ||
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 | 327 | createDuration ( short aYear, short aMonths, short aDays, | 327 | createDuration ( short aYear, short aMonths, short aDays, |
18 | 328 | short aHours, short aMinutes, double aSeconds ) = 0; | 328 | short aHours, short aMinutes, double aSeconds ) = 0; |
19 | 329 | 329 | ||
20 | 330 | /** \brief Creates a dayTimeDuration Item | ||
21 | 331 | * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes] | ||
22 | 332 | * | ||
23 | 333 | * @param aValue String lexical representation of the duration. | ||
24 | 334 | * @return the dayTimeDuration Item. | ||
25 | 335 | */ | ||
26 | 336 | virtual Item | ||
27 | 337 | createDayTimeDuration( const String& aValue ) = 0; | ||
28 | 338 | |||
29 | 339 | /** \brief Creates a yearMonthDuration Item | ||
30 | 340 | * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes] | ||
31 | 341 | * | ||
32 | 342 | * @param aValue String lexical representation of the duration. | ||
33 | 343 | * @return the yearMonthDuration Item. | ||
34 | 344 | */ | ||
35 | 345 | virtual Item | ||
36 | 346 | createYearMonthDuration( const String& aValue ) = 0; | ||
37 | 347 | |||
38 | 348 | /** \brief Creates a documentNode Item | ||
39 | 349 | * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes] | ||
40 | 350 | * | ||
41 | 351 | * @param aBaseUri String representation of the Base URI. | ||
42 | 352 | * @param aDocUri String representation of the Document URI. | ||
43 | 353 | * @return the documentNode Item. | ||
44 | 354 | */ | ||
45 | 355 | virtual Item | ||
46 | 356 | createDocumentNode( const String& aBaseUri, const String& aDocUri ) = 0; | ||
47 | 357 | |||
48 | 330 | /** \brief creates a float item | 358 | /** \brief creates a float item |
49 | 331 | * see [http://www.w3.org/tr/xmlschema-2/#float] | 359 | * see [http://www.w3.org/tr/xmlschema-2/#float] |
50 | 332 | * | 360 | * |
51 | @@ -609,6 +637,36 @@ | |||
52 | 609 | std::vector<Item> aTypedValue) = 0; | 637 | std::vector<Item> aTypedValue) = 0; |
53 | 610 | 638 | ||
54 | 611 | /** | 639 | /** |
55 | 640 | * Create a new comment node N and place it as the last child of a given | ||
56 | 641 | * parent node. If no parent is given, N becomes the root (and single node) | ||
57 | 642 | * of a new XML tree. | ||
58 | 643 | * | ||
59 | 644 | * @param parent The parent P of the new node; may be NULL. | ||
60 | 645 | * @param content The content of the new node. | ||
61 | 646 | * @return The new node N created by this method | ||
62 | 647 | */ | ||
63 | 648 | virtual Item createCommentNode ( | ||
64 | 649 | Item aParent, | ||
65 | 650 | String &aContent) = 0; | ||
66 | 651 | |||
67 | 652 | /** | ||
68 | 653 | * Create a new Processing Instruction node N and place it among the | ||
69 | 654 | * children of a given parent node. If no parent is given, N becomes the | ||
70 | 655 | * root (and single node) of a new XML tree. | ||
71 | 656 | * | ||
72 | 657 | * @param aParent The parent P of the new node; may be NULL. | ||
73 | 658 | * @param aTarget The Target of the new node. | ||
74 | 659 | * @param aContent The Content of the new node. | ||
75 | 660 | * @param aBaseUri The Base URI of the new node, may be NULL. | ||
76 | 661 | * @return The new node N created by this method | ||
77 | 662 | */ | ||
78 | 663 | virtual Item createPiNode ( | ||
79 | 664 | Item aParent, | ||
80 | 665 | String &aTarget, | ||
81 | 666 | String &aContent, | ||
82 | 667 | String &aBaseUri)=0; | ||
83 | 668 | |||
84 | 669 | /** | ||
85 | 612 | * Create a new text node N and place it among the | 670 | * Create a new text node N and place it among the |
86 | 613 | * children of a given parent node. If no parent is given, N becomes the | 671 | * children of a given parent node. If no parent is given, N becomes the |
87 | 614 | * root (and single node) of a new XML tree. | 672 | * root (and single node) of a new XML tree. |
88 | 615 | 673 | ||
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 | 406 | 406 | ||
94 | 407 | return &*lItem; | 407 | return &*lItem; |
95 | 408 | } | 408 | } |
98 | 409 | 409 | ||
99 | 410 | 410 | Item ItemFactoryImpl::createDayTimeDuration( const String& aValue ) | |
100 | 411 | { | ||
101 | 412 | zstring const &lString = Unmarshaller::getInternalString( aValue ); | ||
102 | 413 | store::Item_t lItem; | ||
103 | 414 | theItemFactory->createDayTimeDuration(lItem, lString.c_str(), lString.size()); | ||
104 | 415 | |||
105 | 416 | return &*lItem; | ||
106 | 417 | } | ||
107 | 418 | |||
108 | 419 | Item ItemFactoryImpl::createYearMonthDuration( const String& aValue ) | ||
109 | 420 | { | ||
110 | 421 | zstring const &lString = Unmarshaller::getInternalString( aValue ); | ||
111 | 422 | store::Item_t lItem; | ||
112 | 423 | theItemFactory->createYearMonthDuration(lItem, lString.c_str(), lString.size()); | ||
113 | 424 | |||
114 | 425 | return &*lItem; | ||
115 | 426 | } | ||
116 | 427 | |||
117 | 428 | Item ItemFactoryImpl::createDocumentNode( const String& aBaseUri, const String& aDocUri ) | ||
118 | 429 | { | ||
119 | 430 | store::Item_t lItem; | ||
120 | 431 | zstring &lBaseUri = Unmarshaller::getInternalString( aBaseUri ); | ||
121 | 432 | zstring &lDocUri = Unmarshaller::getInternalString( aDocUri ); | ||
122 | 433 | try { | ||
123 | 434 | theItemFactory->createDocumentNode(lItem, lBaseUri, lDocUri); | ||
124 | 435 | } | ||
125 | 436 | catch ( std::exception const& ) { | ||
126 | 437 | // ignore | ||
127 | 438 | } | ||
128 | 439 | return &*lItem; | ||
129 | 440 | } | ||
130 | 441 | |||
131 | 411 | Item ItemFactoryImpl::createFloat ( const String& aValue ) | 442 | Item ItemFactoryImpl::createFloat ( const String& aValue ) |
132 | 412 | { | 443 | { |
133 | 413 | zstring const &lString = Unmarshaller::getInternalString( aValue ); | 444 | zstring const &lString = Unmarshaller::getInternalString( aValue ); |
134 | @@ -738,10 +769,36 @@ | |||
135 | 738 | } | 769 | } |
136 | 739 | 770 | ||
137 | 740 | 771 | ||
138 | 772 | zorba::Item ItemFactoryImpl::createCommentNode(Item aParent, String &aContent) | ||
139 | 773 | { | ||
140 | 774 | store::Item_t lItem; | ||
141 | 775 | zstring &lContent = Unmarshaller::getInternalString(aContent); | ||
142 | 776 | theItemFactory->createCommentNode(lItem, | ||
143 | 777 | Unmarshaller::getInternalItem(aParent), | ||
144 | 778 | lContent); | ||
145 | 779 | return &*lItem; | ||
146 | 780 | } | ||
147 | 781 | |||
148 | 782 | |||
149 | 783 | zorba::Item ItemFactoryImpl::createPiNode(Item aParent, String &aTarget, String &aContent, String &aBaseUri) | ||
150 | 784 | { | ||
151 | 785 | store::Item_t lItem; | ||
152 | 786 | zstring &lTarget = Unmarshaller::getInternalString(aTarget); | ||
153 | 787 | zstring &lContent = Unmarshaller::getInternalString(aContent); | ||
154 | 788 | zstring &lBaseUri = Unmarshaller::getInternalString(aBaseUri); | ||
155 | 789 | theItemFactory->createPiNode(lItem, | ||
156 | 790 | Unmarshaller::getInternalItem(aParent), | ||
157 | 791 | lTarget, | ||
158 | 792 | lContent, | ||
159 | 793 | lBaseUri); | ||
160 | 794 | return &*lItem; | ||
161 | 795 | } | ||
162 | 796 | |||
163 | 797 | |||
164 | 741 | zorba::Item ItemFactoryImpl::createTextNode(Item parent, String content) | 798 | zorba::Item ItemFactoryImpl::createTextNode(Item parent, String content) |
165 | 742 | { | 799 | { |
166 | 743 | store::Item_t lItem; | 800 | store::Item_t lItem; |
168 | 744 | zstring lContent = Unmarshaller::getInternalString(content); | 801 | zstring &lContent = Unmarshaller::getInternalString(content); |
169 | 745 | theItemFactory->createTextNode(lItem, | 802 | theItemFactory->createTextNode(lItem, |
170 | 746 | Unmarshaller::getInternalItem(parent), | 803 | Unmarshaller::getInternalItem(parent), |
171 | 747 | lContent); | 804 | lContent); |
172 | 748 | 805 | ||
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 | 125 | virtual Item | 125 | virtual Item |
178 | 126 | createDuration ( short aYears, short aMonths, short aDays, | 126 | createDuration ( short aYears, short aMonths, short aDays, |
179 | 127 | short aHours, short aMinutes, double aSeconds ); | 127 | short aHours, short aMinutes, double aSeconds ); |
181 | 128 | 128 | ||
182 | 129 | virtual Item | ||
183 | 130 | createDayTimeDuration( const String& aValue ); | ||
184 | 131 | |||
185 | 132 | virtual Item | ||
186 | 133 | createYearMonthDuration( const String& aValue ); | ||
187 | 134 | |||
188 | 135 | virtual Item | ||
189 | 136 | createDocumentNode( const String& aBaseUri, const String& aDocUri ); | ||
190 | 137 | |||
191 | 129 | virtual Item | 138 | virtual Item |
192 | 130 | createFloat ( const String& aValue ); | 139 | createFloat ( const String& aValue ); |
193 | 131 | 140 | ||
194 | @@ -218,7 +227,20 @@ | |||
195 | 218 | Item aTypeName, | 227 | Item aTypeName, |
196 | 219 | std::vector<Item> aTypedValue); | 228 | std::vector<Item> aTypedValue); |
197 | 220 | 229 | ||
199 | 221 | virtual Item createTextNode( | 230 | virtual Item |
200 | 231 | createCommentNode ( | ||
201 | 232 | Item aParent, | ||
202 | 233 | String &aContent); | ||
203 | 234 | |||
204 | 235 | virtual Item | ||
205 | 236 | createPiNode ( | ||
206 | 237 | Item aParent, | ||
207 | 238 | String &aTarget, | ||
208 | 239 | String &aContent, | ||
209 | 240 | String &aBaseUri); | ||
210 | 241 | |||
211 | 242 | virtual Item | ||
212 | 243 | createTextNode( | ||
213 | 222 | Item parent, | 244 | Item parent, |
214 | 223 | String content); | 245 | String content); |
215 | 224 | 246 | ||
216 | 225 | 247 | ||
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 | 474 | 474 | ||
222 | 475 | virtual bool createYearMonthDuration(Item_t& result, xs_yearMonthDuration* value ) = 0; | 475 | virtual bool createYearMonthDuration(Item_t& result, xs_yearMonthDuration* value ) = 0; |
223 | 476 | 476 | ||
224 | 477 | virtual bool createYearMonthDuration(Item_t& result, const char* str, ulong strlen ) = 0; | ||
225 | 478 | |||
226 | 477 | virtual bool createDayTimeDuration(Item_t& result, xs_dayTimeDuration* value ) = 0; | 479 | virtual bool createDayTimeDuration(Item_t& result, xs_dayTimeDuration* value ) = 0; |
227 | 478 | 480 | ||
228 | 481 | virtual bool createDayTimeDuration(Item_t& result, const char* str, ulong strlen ) = 0; | ||
229 | 482 | |||
230 | 479 | /** | 483 | /** |
231 | 480 | * Specification: [http://www.w3.org/TR/xmlschema-2/#duration] | 484 | * Specification: [http://www.w3.org/TR/xmlschema-2/#duration] |
232 | 481 | * @param value string representation of the value | 485 | * @param value string representation of the value |
233 | 482 | 486 | ||
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 | 954 | return true; | 954 | return true; |
239 | 955 | } | 955 | } |
240 | 956 | 956 | ||
241 | 957 | bool BasicItemFactory::createYearMonthDuration( | ||
242 | 958 | store::Item_t& result, | ||
243 | 959 | const char* str, | ||
244 | 960 | ulong strlen) | ||
245 | 961 | { | ||
246 | 962 | Duration d; | ||
247 | 963 | if (Duration::parseYearMonthDuration(str, strlen, d) == 0) | ||
248 | 964 | { | ||
249 | 965 | result = new DurationItem(&d); | ||
250 | 966 | return true; | ||
251 | 967 | } | ||
252 | 968 | |||
253 | 969 | result = NULL; | ||
254 | 970 | return false; | ||
255 | 971 | } | ||
256 | 972 | |||
257 | 957 | 973 | ||
258 | 958 | bool BasicItemFactory::createDayTimeDuration( | 974 | bool BasicItemFactory::createDayTimeDuration( |
259 | 959 | store::Item_t& result, | 975 | store::Item_t& result, |
260 | @@ -964,6 +980,23 @@ | |||
261 | 964 | } | 980 | } |
262 | 965 | 981 | ||
263 | 966 | 982 | ||
264 | 983 | bool BasicItemFactory::createDayTimeDuration( | ||
265 | 984 | store::Item_t& result, | ||
266 | 985 | const char* str, | ||
267 | 986 | ulong strlen) | ||
268 | 987 | { | ||
269 | 988 | Duration d; | ||
270 | 989 | if (Duration::parseDayTimeDuration(str, strlen, d) == 0) | ||
271 | 990 | { | ||
272 | 991 | result = new DurationItem(&d); | ||
273 | 992 | return true; | ||
274 | 993 | } | ||
275 | 994 | |||
276 | 995 | result = NULL; | ||
277 | 996 | return false; | ||
278 | 997 | } | ||
279 | 998 | |||
280 | 999 | |||
281 | 967 | bool BasicItemFactory::createBase64Binary(store::Item_t& result, xs_base64Binary value) | 1000 | bool BasicItemFactory::createBase64Binary(store::Item_t& result, xs_base64Binary value) |
282 | 968 | { | 1001 | { |
283 | 969 | result = new Base64BinaryItem(value); | 1002 | result = new Base64BinaryItem(value); |
284 | 970 | 1003 | ||
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 | 204 | 204 | ||
290 | 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); |
291 | 206 | 206 | ||
292 | 207 | bool createYearMonthDuration(store::Item_t& result, const char* str, ulong strlen ); | ||
293 | 208 | |||
294 | 207 | bool createYearMonthDuration(store::Item_t& result, xs_yearMonthDuration* value ); | 209 | bool createYearMonthDuration(store::Item_t& result, xs_yearMonthDuration* value ); |
295 | 208 | 210 | ||
296 | 209 | bool createDayTimeDuration(store::Item_t& result, xs_dayTimeDuration* value ); | 211 | bool createDayTimeDuration(store::Item_t& result, xs_dayTimeDuration* value ); |
297 | 210 | 212 | ||
298 | 213 | bool createDayTimeDuration(store::Item_t& result, const char* str, ulong strlen ); | ||
299 | 214 | |||
300 | 211 | bool createENTITIES(store::Item_t& result, zstring& value); | 215 | bool createENTITIES(store::Item_t& result, zstring& value); |
301 | 212 | 216 | ||
302 | 213 | bool createENTITY(store::Item_t& result, zstring& value); | 217 | bool createENTITY(store::Item_t& result, zstring& value); |
Approved.