Add to support a _StringMap type in internal IPC
[platform/framework/native/appfw.git] / src / io / inc / FIo_IpcCommonParamTraits.h
index babed4e..070fdaa 100644 (file)
@@ -344,6 +344,67 @@ struct ParamTraits <Tizen::Base::Collection::HashMap>
 };
 
 template<>
+struct ParamTraits <Tizen::Io::_StringMap>
+{
+       typedef Tizen::Io::_StringMap param_type;
+
+       static void Write(Message* m, const param_type& p)
+       {
+               int count = p.GetCount();
+               Tizen::Base::String key;
+               Tizen::Base::String value;
+
+               WriteParam(m, count);
+
+               Tizen::Base::Collection::IMapEnumeratorT<Tizen::Base::String, Tizen::Base::String>*    pEnum = p.GetMapEnumeratorN();
+
+               while (pEnum->MoveNext() == E_SUCCESS)
+               {
+                       pEnum->GetKey(key);
+                       WriteParam(m, key);
+
+                       pEnum->GetValue(value);
+                       WriteParam(m, value);
+               }
+
+               delete pEnum;
+       }
+
+       static bool Read(const Message* m, void** iter, param_type* r)
+       {
+               int count = 0;
+               Tizen::Base::String key;
+               Tizen::Base::String value;
+
+               if (!m->ReadLength(iter, &count))
+               {
+                       return false;
+               }
+
+               for (int i = 0; i < count; i++)
+               {
+                       if (!ReadParam(m, iter, &key))
+                       {
+                               return false;
+                       }
+
+                       if (!ReadParam(m, iter, &value))
+                       {
+                               return false;
+                       }
+
+                       r->Add(key, value);
+               }
+
+               return true;
+       }
+
+       static void Log(const param_type& p, std::string* l)
+       {
+       }
+};
+
+template<>
 struct ParamTraits <Tizen::Io::_IpcBuffer>
 {
        typedef Tizen::Io::_IpcBuffer param_type;