#include <atompub/atom.h>
+#include <glib.h>
+
struct _iri
{
char *scheme;
char *path;
};
+IRI *
+iri_new ()
+{
+ IRI *iri;
+ iri = g_slice_new (IRI);
+ iri->scheme = NULL;
+ iri->host = NULL;
+ iri->path = NULL;
+ return iri;
+}
+
+IRI *
+iri_new_from_string (char *str)
+{
+ IRI *iri;
+ return iri_new ();
+}
+
+void
+iri_delete (IRI *iri)
+{
+ if (iri->scheme)
+ g_free (iri->scheme);
+ if (iri->host)
+ g_free (iri->host);
+ if (iri->path)
+ g_free (iri->path);
+ g_slice_free (IRI, iri);
+}
+
+IRI *
+iri_copy (IRI *iri)
+{
+ IRI *niri;
+ niri = g_slice_new (IRI);
+ niri->scheme = g_strdup (iri->scheme);
+ niri->host = g_strdup (iri->host);
+ niri->path = g_strdup (iri->path);
+ return niri;
+}
+
+char *
+iri_get_scheme (IRI *iri)
+{
+ return iri->scheme;
+}
+
+void
+iri_set_scheme (IRI *iri, char *scheme)
+{
+ if (iri->scheme)
+ g_free (iri->scheme);
+ iri->scheme = g_strdup (iri->scheme);
+}
+
+char *
+iri_get_host (IRI *iri)
+{
+ return iri->host;
+}
+
+void
+iri_set_host (IRI *iri, char *host)
+{
+ if (iri->host)
+ g_free (iri->host);
+ iri->host = g_strdup (host);
+}
+
char *
iri_get_path (IRI *iri)
{
return iri->path;
}
-#endif
+void
+iri_set_path (IRI *iri, char *path)
+{
+ if (iri->path)
+ g_free (iri->path);
+ iri->path = g_strdup (path);
+}
+
+char *
+iri_get_string (IRI *iri)
+{
+ if (iri->scheme == NULL || iri->host == NULL || iri->path == NULL)
+ return NULL;
+ return g_strconcat (iri->scheme, iri->host, iri->path, NULL);
+}