[libgxps/wip/nacho/visibility: 2/5] Add version macro for 0.2.x



commit 07402fd8970d7ebf7108f6c7ac4a3f91268edd80
Author: Ignacio Casal Quinteiro <ignacio casal nice-software com>
Date:   Thu Sep 8 14:35:23 2016 +0200

    Add version macro for 0.2.x
    
    https://bugzilla.gnome.org/show_bug.cgi?id=771057

 libgxps/gxps-core-properties.h |   34 ++++++++++++------------
 libgxps/gxps-version.h.in      |   57 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 74 insertions(+), 17 deletions(-)
---
diff --git a/libgxps/gxps-core-properties.h b/libgxps/gxps-core-properties.h
index cc08b3d..9f7cc70 100644
--- a/libgxps/gxps-core-properties.h
+++ b/libgxps/gxps-core-properties.h
@@ -57,40 +57,40 @@ struct _GXPSCorePropertiesClass {
         GObjectClass parent_class;
 };
 
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 GType        gxps_core_properties_get_type             (void) G_GNUC_CONST;
 
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_title            (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_creator          (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_description      (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_subject          (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_keywords         (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_version          (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_revision         (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_identifier       (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_language         (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_category         (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_content_status   (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_content_type     (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 time_t       gxps_core_properties_get_created          (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 const gchar *gxps_core_properties_get_last_modified_by (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 time_t       gxps_core_properties_get_modified         (GXPSCoreProperties *core_props);
-GXPS_AVAILABLE_IN_ALL
+GXPS_AVAILABLE_IN_0_2
 time_t       gxps_core_properties_get_last_printed     (GXPSCoreProperties *core_props);
 
 G_END_DECLS
diff --git a/libgxps/gxps-version.h.in b/libgxps/gxps-version.h.in
index d82e102..8fc4f69 100644
--- a/libgxps/gxps-version.h.in
+++ b/libgxps/gxps-version.h.in
@@ -105,6 +105,63 @@
 #  endif /* !G_PLATFORM_WIN32 */
 #endif /* GXPS_VAR */
 
+/* Deprecation / Availability macros */
+
+#define GXPS_VERSION_0_2 (G_ENCODE_VERSION (0, 2))
+
+/* evaluates to the current stable version; for development cycles,
+ * this means the next stable target
+ */
+#if (GXPS_MINOR_VERSION % 2)
+#define GXPS_VERSION_CUR_STABLE (G_ENCODE_VERSION (GXPS_MAJOR_VERSION, GXPS_MINOR_VERSION + 1))
+#else
+#define GXPS_VERSION_CUR_STABLE (G_ENCODE_VERSION (GXPS_MAJOR_VERSION, GXPS_MINOR_VERSION))
+#endif
+
+/* evaluates to the previous stable version */
+#if (GXPS_MINOR_VERSION % 2)
+#define GXPS_VERSION_PREV_STABLE (G_ENCODE_VERSION (GXPS_MAJOR_VERSION, GXPS_MINOR_VERSION - 1))
+#else
+#define GXPS_VERSION_PREV_STABLE (G_ENCODE_VERSION (GXPS_MAJOR_VERSION, GXPS_MINOR_VERSION - 2))
+#endif
+
+#ifndef GXPS_VERSION_MIN_REQUIRED
+# define GXPS_VERSION_MIN_REQUIRED (GXPS_VERSION_CUR_STABLE)
+#elif GXPS_VERSION_MIN_REQUIRED == 0
+# undef  GXPS_VERSION_MIN_REQUIRED
+# define GXPS_VERSION_MIN_REQUIRED (GXPS_VERSION_CUR_STABLE + 2)
+#endif
+
+#if !defined (GXPS_VERSION_MAX_ALLOWED) || (GXPS_VERSION_MAX_ALLOWED == 0)
+# undef GXPS_VERSION_MAX_ALLOWED
+# define GXPS_VERSION_MAX_ALLOWED (GXPS_VERSION_CUR_STABLE)
+#endif
+
+/* sanity checks */
+#if GXPS_VERSION_MIN_REQUIRED > GXPS_VERSION_CUR_STABLE
+#error "GXPS_VERSION_MIN_REQUIRED must be <= GXPS_VERSION_CUR_STABLE"
+#endif
+#if GXPS_VERSION_MAX_ALLOWED < GXPS_VERSION_MIN_REQUIRED
+#error "GXPS_VERSION_MAX_ALLOWED must be >= GXPS_VERSION_MIN_REQUIRED"
+#endif
+#if GXPS_VERSION_MIN_REQUIRED < GXPS_VERSION_0_2
+#error "GXPS_VERSION_MIN_REQUIRED must be >= GXPS_VERSION_0_2"
+#endif
+
 #define GXPS_AVAILABLE_IN_ALL                   _GXPS_EXTERN
 
+#if GXPS_VERSION_MIN_REQUIRED >= GXPS_VERSION_0_2
+# define GXPS_DEPRECATED_IN_0_2                G_DEPRECATED
+# define GXPS_DEPRECATED_IN_0_2_FOR(f)         G_DEPRECATED_FOR(f)
+#else
+# define GXPS_DEPRECATED_IN_0_2
+# define GXPS_DEPRECATED_IN_0_2_FOR(f)
+#endif
+
+#if GXPS_VERSION_MAX_ALLOWED < GXPS_VERSION_0_2
+# define GXPS_AVAILABLE_IN_0_2                 G_UNAVAILABLE(0, 2) _GXPS_EXTERN
+#else
+# define GXPS_AVAILABLE_IN_0_2                 _GXPS_EXTERN
+#endif
+
 #endif /* __GXPS_VERSION_H__ */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]