zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #02848
[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/86125
-Added createDayTimeDuration
-Added createYearMonthDuration
-Added createDocumentNode
-Added createCommentNode
-Added createPiNode
--
https://code.launchpad.net/~zorba-coders/zorba/ItemFactory/+merge/86125
Your team Zorba Coders is subscribed to branch lp:zorba.
=== 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-16 22:35:30 +0000
@@ -327,6 +327,34 @@
createDuration ( short aYear, short aMonths, short aDays,
short aHours, short aMinutes, double aSeconds ) = 0;
+ /** \brief Creates a dayTimeDuration Item
+ * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
+ *
+ * @param aValue String lexical representation of the duration.
+ * @return the dayTimeDuration Item.
+ */
+ virtual Item
+ createDayTimeDuration( const String& aValue ) = 0;
+
+ /** \brief Creates a yearMonthDuration Item
+ * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
+ *
+ * @param aValue String lexical representation of the duration.
+ * @return the yearMonthDuration Item.
+ */
+ virtual Item
+ createYearMonthDuration( const String& aValue ) = 0;
+
+ /** \brief Creates a documentNode Item
+ * see [http://www.w3.org/TR/xpath-functions/#duration-subtypes]
+ *
+ * @param aBaseUri String representation of the Base URI.
+ * @param aDocUri String representation of the Document URI.
+ * @return the documentNode Item.
+ */
+ virtual Item
+ createDocumentNode( const String& aBaseUri, const String& aDocUri ) = 0;
+
/** \brief creates a float item
* see [http://www.w3.org/tr/xmlschema-2/#float]
*
@@ -609,6 +637,36 @@
std::vector<Item> aTypedValue) = 0;
/**
+ * Create a new comment node N and place it as the last child of a given
+ * parent node. If no parent is given, N becomes the root (and single node)
+ * of a new XML tree.
+ *
+ * @param parent The parent P of the new node; may be NULL.
+ * @param content The content of the new node.
+ * @return The new node N created by this method
+ */
+ virtual Item createCommentNode (
+ Item aParent,
+ String aContent) = 0;
+
+ /**
+ * Create a new Processing Instruction node N and place it among the
+ * children of a given parent node. If no parent is given, N becomes the
+ * root (and single node) of a new XML tree.
+ *
+ * @param aParent The parent P of the new node; may be NULL.
+ * @param aTarget The Target of the new node.
+ * @param aContent The Content of the new node.
+ * @param aBaseUri The Base URI of the new node, may be NULL.
+ * @return The new node N created by this method
+ */
+ virtual Item createPiNode (
+ Item aParent,
+ String aTarget,
+ String aContent,
+ String aBaseUri)=0;
+
+ /**
* Create a new text node N and place it among the
* children of a given parent node. If no parent is given, N becomes the
* root (and single node) of a new XML tree.
=== modified file 'src/api/itemfactoryimpl.cpp'
--- src/api/itemfactoryimpl.cpp 2011-07-22 07:23:17 +0000
+++ src/api/itemfactoryimpl.cpp 2011-12-16 22:35:30 +0000
@@ -406,8 +406,39 @@
return &*lItem;
}
-
-
+
+Item ItemFactoryImpl::createDayTimeDuration( const String& aValue )
+{
+ zstring const &lString = Unmarshaller::getInternalString( aValue );
+ store::Item_t lItem;
+ theItemFactory->createDayTimeDuration(lItem, lString.c_str(), lString.size());
+
+ return &*lItem;
+}
+
+Item ItemFactoryImpl::createYearMonthDuration( const String& aValue )
+{
+ zstring const &lString = Unmarshaller::getInternalString( aValue );
+ store::Item_t lItem;
+ theItemFactory->createYearMonthDuration(lItem, lString.c_str(), lString.size());
+
+ return &*lItem;
+}
+
+Item ItemFactoryImpl::createDocumentNode( const String& aBaseUri, const String& aDocUri )
+{
+ store::Item_t lItem;
+ zstring &lBaseUri = Unmarshaller::getInternalString( aBaseUri );
+ zstring &lDocUri = Unmarshaller::getInternalString( aDocUri );
+ try {
+ theItemFactory->createDocumentNode(lItem, lBaseUri, lDocUri);
+ }
+ catch ( std::exception const& ) {
+ // ignore
+ }
+ return &*lItem;
+}
+
Item ItemFactoryImpl::createFloat ( const String& aValue )
{
zstring const &lString = Unmarshaller::getInternalString( aValue );
@@ -738,6 +769,32 @@
}
+zorba::Item ItemFactoryImpl::createCommentNode(Item aParent, String aContent)
+{
+ store::Item_t lItem;
+ zstring lContent = Unmarshaller::getInternalString(aContent);
+ theItemFactory->createCommentNode(lItem,
+ Unmarshaller::getInternalItem(aParent),
+ lContent);
+ return &*lItem;
+}
+
+
+zorba::Item ItemFactoryImpl::createPiNode(Item aParent, String aTarget, String aContent, String aBaseUri)
+{
+ store::Item_t lItem;
+ zstring lTarget = Unmarshaller::getInternalString(aTarget);
+ zstring lContent = Unmarshaller::getInternalString(aContent);
+ zstring lBaseUri = Unmarshaller::getInternalString(aBaseUri);
+ theItemFactory->createPiNode(lItem,
+ Unmarshaller::getInternalItem(aParent),
+ lTarget,
+ lContent,
+ lBaseUri);
+ return &*lItem;
+}
+
+
zorba::Item ItemFactoryImpl::createTextNode(Item parent, String content)
{
store::Item_t lItem;
=== modified file 'src/api/itemfactoryimpl.h'
--- src/api/itemfactoryimpl.h 2011-07-22 07:23:17 +0000
+++ src/api/itemfactoryimpl.h 2011-12-16 22:35:30 +0000
@@ -125,7 +125,16 @@
virtual Item
createDuration ( short aYears, short aMonths, short aDays,
short aHours, short aMinutes, double aSeconds );
-
+
+ virtual Item
+ createDayTimeDuration( const String& aValue );
+
+ virtual Item
+ createYearMonthDuration( const String& aValue );
+
+ virtual Item
+ createDocumentNode( const String& aBaseUri, const String& aDocUri );
+
virtual Item
createFloat ( const String& aValue );
@@ -218,7 +227,20 @@
Item aTypeName,
std::vector<Item> aTypedValue);
- virtual Item createTextNode(
+ virtual Item
+ createCommentNode (
+ Item aParent,
+ String aContent);
+
+ virtual Item
+ createPiNode (
+ Item aParent,
+ String aTarget,
+ String aContent,
+ String aBaseUri);
+
+ virtual Item
+ createTextNode(
Item parent,
String content);
=== modified file 'src/store/api/item_factory.h'
--- src/store/api/item_factory.h 2011-12-13 03:38:23 +0000
+++ src/store/api/item_factory.h 2011-12-16 22:35:30 +0000
@@ -474,8 +474,12 @@
virtual bool createYearMonthDuration(Item_t& result, xs_yearMonthDuration* value ) = 0;
+ virtual bool createYearMonthDuration(Item_t& result, const char* str, ulong strlen ) = 0;
+
virtual bool createDayTimeDuration(Item_t& result, xs_dayTimeDuration* value ) = 0;
+ virtual bool createDayTimeDuration(Item_t& result, const char* str, ulong strlen ) = 0;
+
/**
* Specification: [http://www.w3.org/TR/xmlschema-2/#duration]
* @param value string representation of the value
=== modified file 'src/store/naive/simple_item_factory.cpp'
--- src/store/naive/simple_item_factory.cpp 2011-12-09 19:37:09 +0000
+++ src/store/naive/simple_item_factory.cpp 2011-12-16 22:35:30 +0000
@@ -954,6 +954,22 @@
return true;
}
+bool BasicItemFactory::createYearMonthDuration(
+ store::Item_t& result,
+ const char* str,
+ ulong strlen)
+{
+ Duration d;
+ if (Duration::parseYearMonthDuration(str, strlen, d) == 0)
+ {
+ result = new DurationItem(&d);
+ return true;
+ }
+
+ result = NULL;
+ return false;
+}
+
bool BasicItemFactory::createDayTimeDuration(
store::Item_t& result,
@@ -964,6 +980,23 @@
}
+bool BasicItemFactory::createDayTimeDuration(
+ store::Item_t& result,
+ const char* str,
+ ulong strlen)
+{
+ Duration d;
+ if (Duration::parseDayTimeDuration(str, strlen, d) == 0)
+ {
+ result = new DurationItem(&d);
+ return true;
+ }
+
+ result = NULL;
+ return false;
+}
+
+
bool BasicItemFactory::createBase64Binary(store::Item_t& result, xs_base64Binary value)
{
result = new Base64BinaryItem(value);
=== modified file 'src/store/naive/simple_item_factory.h'
--- src/store/naive/simple_item_factory.h 2011-12-09 19:37:09 +0000
+++ src/store/naive/simple_item_factory.h 2011-12-16 22:35:30 +0000
@@ -204,10 +204,14 @@
bool createDuration(store::Item_t& result, short years, short months, short days, short hours, short minutes, double seconds);
+ bool createYearMonthDuration(store::Item_t& result, const char* str, ulong strlen );
+
bool createYearMonthDuration(store::Item_t& result, xs_yearMonthDuration* value );
bool createDayTimeDuration(store::Item_t& result, xs_dayTimeDuration* value );
+ bool createDayTimeDuration(store::Item_t& result, const char* str, ulong strlen );
+
bool createENTITIES(store::Item_t& result, zstring& value);
bool createENTITY(store::Item_t& result, zstring& value);
Follow ups
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: noreply, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Rodolfo Ochoa, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
Re: [Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Rodolfo Ochoa, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
Re: [Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Rodolfo Ochoa, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
Re: [Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Zorba Build Bot, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Matthias Brantner, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Rodolfo Ochoa, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Rodolfo Ochoa, 2011-12-20
-
[Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Matthias Brantner, 2011-12-20
-
Re: [Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Matthias Brantner, 2011-12-20
-
Re: [Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Matthias Brantner, 2011-12-19
-
Re: [Merge] lp:~zorba-coders/zorba/ItemFactory into lp:zorba
From: Nicolae Brinza, 2011-12-16