]> git.draconx.ca Git - upkg.git/blobdiff - src/uobject/vfs.h
package: Get rid of separate mechanisms for opening packages.
[upkg.git] / src / uobject / vfs.h
diff --git a/src/uobject/vfs.h b/src/uobject/vfs.h
new file mode 100644 (file)
index 0000000..d986aec
--- /dev/null
@@ -0,0 +1,55 @@
+/*
+ *  Functions for handling UObject package search paths.
+ *  Copyright (C) 2009 Nick Bowler
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+#ifndef U_OBJECT_VFS_H_
+#define U_OBJECT_VFS_H_
+
+/*
+ * Insert a local package to the VFS.  A "local package" is an explicit
+ * association of a name to a file, and thus can be located outside the normal
+ * search path.  Local packages are searched before any other location.
+ *
+ * Returns a pointer to an internal copy of name on success, or NULL on
+ * failure.  The returned name must not be modified or freed.  If name is
+ * NULL, it is determined automatically from the filename.
+ */
+const char *u_pkg_vfs_add_local(const char *name, const char *file);
+
+/*
+ * Remove a local package from the VFS by name.
+ */
+void u_pkg_vfs_del_local(const char *name);
+
+/*
+ * Find a package by name in the VFS.  Names are case-insensitive.
+ */
+const char *u_pkg_vfs_lookup(const char *name);
+
+/*
+ * Initialize the UObject VFS system.  Returns 0 on success, -1 otherwise.
+ * The VFS system can be safely initialized multiple times.
+ */
+int u_pkg_vfs_init(void);
+
+/*
+ * Shutdown the UObject VFS system.
+ * The VFS system is only shut down when this function has been called as
+ * many times as u_pkg_vfs_init.
+ */
+void u_pkg_vfs_exit(void);
+
+#endif