Commits

Paweł Wieczorek committed aff8639 Draft

added primitive for sip_uri_tags

Comments (0)

Files changed (1)

  *)
 
 
+type sip_uri_tags =
+    SipUriTags of (string, string) Map.t
+
+let sip_uri_tags_of_string = function
+    | ""  ->
+        SipUriTags (Map.empty)
+
+    | s  ->
+        let equations = String.nsplit s ";" in
+        let f map eq = 
+            let key,value = String.split eq "=" in
+            Map.add key value map
+            in
+
+        SipUriTags (List.fold_left f Map.empty equations)
+   
+   (*
+    | _ ->
+        failwith "sip_uri_tags_of_string"
+    *)
+
+let string_of_sip_uri_tags = function
+    | SipUriTags table ->
+        Map.foldi (fun key value aux -> ";" ^ key ^ "=" ^ value ^ aux) table ""
+
 (*********************************************************************************************************************
  *)