]> wimlib.net Git - wimlib/blobdiff - include/wimlib.h
wimlib.h: Move `enum wimlib_update_op' to global scope
[wimlib] / include / wimlib.h
index 39538182e5e9e0c4077540b8e08159577c25ced1..0d20239e49e21389b6f08613f8d737c418b8b626 100644 (file)
 /** Patch version of the library (for example, the 5 in 1.2.5). */
 #define WIMLIB_PATCH_VERSION 0
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 /**
  * Opaque structure that represents a WIM file.  This is an in-memory structure
  * and need not correspond to a specific on-disk file.  However, a ::WIMStruct
@@ -1339,6 +1343,7 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
  * @name Init flags
  *
  * The following flags can be passed to wimlib_global_init().
+ * @{
  */
 
 /** Assume that strings are represented in UTF-8, even if this is not the
@@ -1374,6 +1379,7 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
  *
  * The following flags can be passed to wimlib_reference_resource_files() and
  * wimlib_reference_resources().
+ * @{
  */
 
 /** wimlib_reference_resource_files() only:  Enable shell-style filename
@@ -1392,63 +1398,73 @@ typedef int (*wimlib_iterate_lookup_table_callback_t)(const struct wimlib_resour
  * @}
  */
 
+/** The specific type of update to perform. */
+enum wimlib_update_op {
+       /** Add a new file or directory tree to the WIM image in a
+        * certain location. */
+       WIMLIB_UPDATE_OP_ADD = 0,
+
+       /** Delete a file or directory tree from the WIM image. */
+       WIMLIB_UPDATE_OP_DELETE,
+
+       /** Rename a file or directory tree in the WIM image. */
+       WIMLIB_UPDATE_OP_RENAME,
+};
+
+/** Data for a ::WIMLIB_UPDATE_OP_ADD operation. */
+struct wimlib_add_command {
+       /** Filesystem path to the file or directory tree to
+        * add. */
+       wimlib_tchar *fs_source_path;
+       /** Path, specified from the root of the WIM image, at
+        * which to add the file or directory tree within the
+        * WIM image. */
+       wimlib_tchar *wim_target_path;
+
+       /** Configuration for excluded files.  @c NULL means
+        * exclude no files (use no configuration), unless
+        * ::WIMLIB_ADD_FLAG_WINCONFIG is specified in @p
+        * add_flags.  */
+       struct wimlib_capture_config *config;
+
+       /** Bitwise OR of WIMLIB_ADD_FLAG_* flags. */
+       int add_flags;
+};
+
+/** Data for a ::WIMLIB_UPDATE_OP_DELETE operation. */
+struct wimlib_delete_command {
+       /** Path, specified from the root of the WIM image, for
+        * the file or directory tree within the WIM image to be
+        * deleted. */
+       wimlib_tchar *wim_path;
+       /** Bitwise OR of WIMLIB_DELETE_FLAG_* flags. */
+       int delete_flags;
+};
+
+/** Data for a ::WIMLIB_UPDATE_OP_RENAME operation. */
+struct wimlib_rename_command {
+       /** Path, specified from the root of the WIM image, for
+        * the source file or directory tree within the WIM
+        * image. */
+       wimlib_tchar *wim_source_path;
+       /** Path, specified from the root of the WIM image, for
+        * the destination file or directory tree within the WIM
+        * image. */
+       wimlib_tchar *wim_target_path;
+       /** Reserved; set to 0. */
+       int rename_flags;
+};
+
 /** Specification of an update to perform on a WIM image. */
 struct wimlib_update_command {
 
-       /** The specific type of update to perform. */
-       enum wimlib_update_op {
-               /** Add a new file or directory tree to the WIM image in a
-                * certain location. */
-               WIMLIB_UPDATE_OP_ADD = 0,
-
-               /** Delete a file or directory tree from the WIM image. */
-               WIMLIB_UPDATE_OP_DELETE,
+       enum wimlib_update_op op;
 
-               /** Rename a file or directory tree in the WIM image. */
-               WIMLIB_UPDATE_OP_RENAME,
-       } op;
        union {
-               /** Data for a ::WIMLIB_UPDATE_OP_ADD operation. */
-               struct wimlib_add_command {
-                       /** Filesystem path to the file or directory tree to
-                        * add. */
-                       wimlib_tchar *fs_source_path;
-                       /** Path, specified from the root of the WIM image, at
-                        * which to add the file or directory tree within the
-                        * WIM image. */
-                       wimlib_tchar *wim_target_path;
-
-                       /** Configuration for excluded files.  @c NULL means
-                        * exclude no files (use no configuration), unless
-                        * ::WIMLIB_ADD_FLAG_WINCONFIG is specified in @p
-                        * add_flags.  */
-                       struct wimlib_capture_config *config;
-
-                       /** Bitwise OR of WIMLIB_ADD_FLAG_* flags. */
-                       int add_flags;
-               } add;
-               /** Data for a ::WIMLIB_UPDATE_OP_DELETE operation. */
-               struct wimlib_delete_command {
-                       /** Path, specified from the root of the WIM image, for
-                        * the file or directory tree within the WIM image to be
-                        * deleted. */
-                       wimlib_tchar *wim_path;
-                       /** Bitwise OR of WIMLIB_DELETE_FLAG_* flags. */
-                       int delete_flags;
-               } delete;
-               /** Data for a ::WIMLIB_UPDATE_OP_RENAME operation. */
-               struct wimlib_rename_command {
-                       /** Path, specified from the root of the WIM image, for
-                        * the source file or directory tree within the WIM
-                        * image. */
-                       wimlib_tchar *wim_source_path;
-                       /** Path, specified from the root of the WIM image, for
-                        * the destination file or directory tree within the WIM
-                        * image. */
-                       wimlib_tchar *wim_target_path;
-                       /** Reserved; set to 0. */
-                       int rename_flags;
-               } rename;
+               struct wimlib_add_command add;
+               struct wimlib_delete_command delete_; /* Underscore is for C++
+                                                        compatibility.  */
+               struct wimlib_rename_command rename;
        };
 };
 
@@ -2031,7 +2047,7 @@ wimlib_extract_image(WIMStruct *wim, int image,
  *     wimlib_resolve_image() uses.  However, unlike wimlib_extract_image(),
  *     only a single image (not all images) can be specified.  Alternatively,
  *     specify @p NULL here to use the first image in the WIM if it contains
- *     exactly one image but otherwise return @p WIMLIB_ERR_INVALID_IMAGE.
+ *     exactly one image but otherwise return ::WIMLIB_ERR_INVALID_IMAGE.
  * @param target
  *     Same as the corresponding parameter to wimlib_extract_image().
  * @param extract_flags
@@ -2307,8 +2323,8 @@ wimlib_iterate_lookup_table(WIMStruct *wim, int flags,
  *     Number of filenames in @p swms.
  * @param swm_open_flags
  *     Open flags for the split WIM parts (e.g.
- *     ::WIMLIB_OPEN_FLAG_CHECK_INTEGRITY).  Note: WIMLIB_OPEN_FLAG_SPLIT_OK is
- *     automatically added to the value specified here.
+ *     ::WIMLIB_OPEN_FLAG_CHECK_INTEGRITY).  Note: ::WIMLIB_OPEN_FLAG_SPLIT_OK
+ *     is automatically added to the value specified here.
  * @param wim_write_flags
  *     Bitwise OR of relevant flags prefixed with WIMLIB_WRITE_FLAG, which will
  *     be used to write the joined WIM.
@@ -2743,8 +2759,9 @@ wimlib_reference_resource_files(WIMStruct *wim,
  *
  * @retval ::WIMLIB_ERR_INVALID_PARAM
  *     @p wim was @c NULL, or @p num_resource_wims was nonzero but @p
- *     resource_wims was @c NULL, or @p wim did not contain metadata resources,
- *     or an entry in @p resource_wims was @p NULL.
+ *     resource_wims was @c NULL, or an entry in @p resource_wims was @p NULL.
+ * @retval ::WIMLIB_ERR_NOMEM
+ *     Failed to allocate memory.
  */
 extern int
 wimlib_reference_resources(WIMStruct *wim, WIMStruct **resource_wims,
@@ -3364,4 +3381,8 @@ extern int
 wimlib_xpress_decompress(const void *compressed_data, unsigned compressed_len,
                         void *uncompressed_data, unsigned uncompressed_len);
 
+#ifdef __cplusplus
+}
+#endif
+
 #endif /* _WIMLIB_H */