Add an ArrayList<String> to the IPC paramtraits
authorSunwook Bae <sunwook45.bae@samsung.com>
Wed, 31 Jul 2013 10:28:58 +0000 (19:28 +0900)
committerSunwook Bae <sunwook45.bae@samsung.com>
Wed, 31 Jul 2013 10:31:17 +0000 (19:31 +0900)
Change-Id: I9401ce8164d9fae74ad06954d72b2135c27c60df
Signed-off-by: Sunwook Bae <sunwook45.bae@samsung.com>
src/io/inc/FIo_IpcCommonParamTraits.h

index 6525176..babed4e 100644 (file)
@@ -29,6 +29,7 @@
 #include <FBaseString.h>
 #include <FBaseByteBuffer.h>
 #include <FBaseColArrayList.h>
+#include <FBaseColArrayListT.h>
 #include <FBaseColHashMap.h>
 #include <FBaseSysLog.h>
 #include "FIo_IpcCommonDataTypes.h"
@@ -196,6 +197,54 @@ struct ParamTraits <Tizen::Base::Collection::ArrayList>
 };
 
 template<>
+struct ParamTraits <Tizen::Base::Collection::ArrayListT<Tizen::Base::String> >
+{
+       typedef Tizen::Base::Collection::ArrayListT<Tizen::Base::String> param_type;
+
+       static void Write(Message* m, const param_type& p)
+       {
+               int count = p.GetCount();
+               Tizen::Base::String str;
+
+               WriteParam(m, count);
+
+               for (int i = 0; i < count; i++)
+               {
+                       p.GetAt(i, str);
+                       WriteParam(m, str);
+               }
+       }
+
+       static bool Read(const Message* m, void** iter, param_type* r)
+       {
+               Tizen::Base::String str;
+               int count = 0;
+
+               if (!m->ReadLength(iter, &count))
+               {
+                       return false;
+               }
+
+               r->Construct(count);
+
+               for (int i = 0; i < count; i++)
+               {
+                       if (!ReadParam(m, iter, &str))
+                       {
+                               return false;
+                       }
+                       r->Add(str);
+               }
+
+               return true;
+       }
+
+       static void Log(const param_type& p, std::string* l)
+       {
+       }
+};
+
+template<>
 struct ParamTraits <Tizen::Base::Collection::HashMap>
 {
        typedef Tizen::Base::Collection::HashMap param_type;