← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/createUntypedAtomic into lp:zorba

 

David Graf has proposed merging lp:~zorba-coders/zorba/createUntypedAtomic into lp:zorba.

Commit message:
added createUntypedAtomic to public API

Requested reviews:
  David Graf (davidagraf)
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/createUntypedAtomic/+merge/126283

added createUntypedAtomic to public API
-- 
https://code.launchpad.net/~zorba-coders/zorba/createUntypedAtomic/+merge/126283
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/item_factory.h'
--- include/zorba/item_factory.h	2012-09-17 00:36:37 +0000
+++ include/zorba/item_factory.h	2012-09-25 16:08:22 +0000
@@ -713,6 +713,13 @@
         Item   parent,
         String content) = 0;
 
+      /** \brief Creates a UntypedAtomic Item
+       *
+       * @param value String representation of the UntypedAtomic Item.
+       * @return The UntypedAtomic Item
+       */
+      virtual Item createUntypedAtomic(const String& value) = 0;
+
 #ifdef ZORBA_WITH_JSON
 
       /**

=== modified file 'src/api/itemfactoryimpl.cpp'
--- src/api/itemfactoryimpl.cpp	2012-09-17 00:36:37 +0000
+++ src/api/itemfactoryimpl.cpp	2012-09-25 16:08:22 +0000
@@ -880,6 +880,14 @@
   return &*lItem;
 }
 
+zorba::Item ItemFactoryImpl::createUntypedAtomic(const String& value)
+{
+  store::Item_t lItem;
+  zstring &lValue = Unmarshaller::getInternalString(value);
+  theItemFactory->createUntypedAtomic(lItem, lValue);
+  return &*lItem;
+}
+
 #ifdef ZORBA_WITH_JSON
 
 zorba::Item ItemFactoryImpl::createJSONNull()

=== modified file 'src/api/itemfactoryimpl.h'
--- src/api/itemfactoryimpl.h	2012-09-17 00:36:37 +0000
+++ src/api/itemfactoryimpl.h	2012-09-25 16:08:22 +0000
@@ -263,6 +263,9 @@
         Item   parent,
         String content);
 
+      virtual Item
+      createUntypedAtomic(const String& value);
+
 #ifdef ZORBA_WITH_JSON
       virtual Item
       createJSONNull();

=== modified file 'test/api/itemfactory.cpp'
--- test/api/itemfactory.cpp	2012-09-17 00:36:37 +0000
+++ test/api/itemfactory.cpp	2012-09-25 16:08:22 +0000
@@ -560,6 +560,13 @@
     UNIT_ASSERT ( !lItem.getAtomizationValue().isNull() );
     CHECK_NOT_IMPLEMENTED(lItem, getBooleanValue() );
 
+    /** String */
+    lItem = lFactory->createUntypedAtomic("abc");
+    UNIT_ASSERT ( checkType(lItem.getType(), "untypedAtomic") );
+    UNIT_ASSERT ( lItem.isAtomic() );
+    UNIT_ASSERT ( lItem.getStringValue() == "abc" );
+    UNIT_ASSERT ( !lItem.getAtomizationValue().isNull() );
+
   } catch (ZorbaException &e) {
     std::cerr << e << std::endl;
     return 1;


Follow ups