lib: Move compiler.h to <openvswitch/compiler.h>
[cascardo/ovs.git] / lib / smap.h
index 993d0b2..caf3efc 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 Nicira, Inc.
+/* Copyright (c) 2012, 2014 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,6 +17,8 @@
 
 #include "hmap.h"
 
+struct json;
+
 /* A map from string to string. */
 struct smap {
     struct hmap map;           /* Contains "struct smap_node"s. */
@@ -40,13 +42,15 @@ void smap_init(struct smap *);
 void smap_destroy(struct smap *);
 
 struct smap_node *smap_add(struct smap *, const char *, const char *);
+struct smap_node *smap_add_nocopy(struct smap *, char *, char *);
 bool smap_add_once(struct smap *, const char *, const char *);
 void smap_add_format(struct smap *, const char *key, const char *, ...)
-    PRINTF_FORMAT(3, 4);
+    OVS_PRINTF_FORMAT(3, 4);
 void smap_replace(struct smap *, const char *, const char *);
 
 void smap_remove(struct smap *, const char *);
-void smap_remove_node(struct smap *smap, struct smap_node *);
+void smap_remove_node(struct smap *, struct smap_node *);
+void smap_steal(struct smap *, struct smap_node *, char **keyp, char **valuep);
 void smap_clear(struct smap *);
 
 const char *smap_get(const struct smap *, const char *);
@@ -57,7 +61,10 @@ int smap_get_int(const struct smap *smap, const char *key, int def);
 bool smap_is_empty(const struct smap *);
 size_t smap_count(const struct smap *);
 
-void smap_clone(struct smap *dst, struct smap *src);
+void smap_clone(struct smap *dst, const struct smap *src);
 const struct smap_node **smap_sort(const struct smap *);
 
+void smap_from_json(struct smap *, const struct json *);
+struct json *smap_to_json(const struct smap *);
+
 #endif /* smap.h */