summaryrefslogtreecommitdiff
path: root/src/utils/parserutilserror.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/parserutilserror.h')
-rw-r--r--src/utils/parserutilserror.h41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/utils/parserutilserror.h b/src/utils/parserutilserror.h
new file mode 100644
index 0000000..3e05524
--- /dev/null
+++ b/src/utils/parserutilserror.h
@@ -0,0 +1,41 @@
+/*
+ * This file is part of Hubbub.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
+ */
+
+#ifndef hubbub_utils_parserutilserror_h_
+#define hubbub_utils_parserutilserror_h_
+
+#include <parserutils/errors.h>
+
+#include <hubbub/errors.h>
+
+/**
+ * Convert a ParserUtils error into a LibCSS error
+ *
+ * \param error The ParserUtils error to convert
+ * \return The corresponding LibCSS error
+ */
+static inline hubbub_error hubbub_error_from_parserutils_error(
+ parserutils_error error)
+{
+ if (error == PARSERUTILS_OK)
+ return HUBBUB_OK;
+ else if (error == PARSERUTILS_NOMEM)
+ return HUBBUB_NOMEM;
+ else if (error == PARSERUTILS_BADPARM)
+ return HUBBUB_BADPARM;
+ else if (error == PARSERUTILS_INVALID)
+ return HUBBUB_INVALID;
+ else if (error == PARSERUTILS_FILENOTFOUND)
+ return HUBBUB_FILENOTFOUND;
+ else if (error == PARSERUTILS_NEEDDATA)
+ return HUBBUB_NEEDDATA;
+
+ return HUBBUB_UNKNOWN;
+}
+
+#endif
+