[json-glib] Disallow single header file inclusion



commit d84c0f367b06e094ff693d60a724b9f141c33ca9
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Aug 12 13:48:17 2009 +0100

    Disallow single header file inclusion
    
    The correct header file for JSON-GLib is, and has always been,
    json-glib.h. Anything else was not supported, as we've been
    moving around stuff for a while, now.
    
    This commit enforces the single include file, using the same
    policy enacted by other libraries, like: GLib, GTK+ and Clutter.

 json-glib/json-enum-types.h.in |    4 ++++
 json-glib/json-generator.h     |    4 ++++
 json-glib/json-glib.h          |    6 ++++++
 json-glib/json-parser.h        |    4 ++++
 json-glib/json-types.h         |    4 ++++
 json-glib/json-version.h.in    |    4 ++++
 6 files changed, 26 insertions(+), 0 deletions(-)
---
diff --git a/json-glib/json-enum-types.h.in b/json-glib/json-enum-types.h.in
index 9ca7f72..96f565e 100644
--- a/json-glib/json-enum-types.h.in
+++ b/json-glib/json-enum-types.h.in
@@ -1,4 +1,8 @@
 /*** BEGIN file-header ***/
+#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
+#error "Only <json-glib/json-glib.h> can be included directly."
+#endif
+
 #ifndef __JSON_ENUM_TYPES_H__
 #define __JSON_ENUM_TYPES_H__
 
diff --git a/json-glib/json-generator.h b/json-glib/json-generator.h
index b2ee7e8..743ec27 100644
--- a/json-glib/json-generator.h
+++ b/json-glib/json-generator.h
@@ -21,6 +21,10 @@
  *   Emmanuele Bassi  <ebassi linux intel com>
  */
 
+#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
+#error "Only <json-glib/json-glib.h> can be included directly."
+#endif
+
 #ifndef __JSON_GENERATOR_H__
 #define __JSON_GENERATOR_H__
 
diff --git a/json-glib/json-glib.h b/json-glib/json-glib.h
index 35e3813..794a8be 100644
--- a/json-glib/json-glib.h
+++ b/json-glib/json-glib.h
@@ -24,10 +24,16 @@
 #ifndef __JSON_GLIB_H__
 #define __JSON_GLIB_H__
 
+#define __JSON_GLIB_INSIDE__
+
 #include <json-glib/json-types.h>
 #include <json-glib/json-generator.h>
 #include <json-glib/json-parser.h>
 #include <json-glib/json-version.h>
 #include <json-glib/json-enum-types.h>
 
+#include <json-glib/json-gobject.h>
+
+#undef __JSON_GLIB_INSIDE__
+
 #endif /* __JSON_GLIB_H__ */
diff --git a/json-glib/json-parser.h b/json-glib/json-parser.h
index f4bc2ea..7589464 100644
--- a/json-glib/json-parser.h
+++ b/json-glib/json-parser.h
@@ -21,6 +21,10 @@
  *   Emmanuele Bassi  <ebassi linux intel com>
  */
 
+#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
+#error "Only <json-glib/json-glib.h> can be included directly."
+#endif
+
 #ifndef __JSON_PARSER_H__
 #define __JSON_PARSER_H__
 
diff --git a/json-glib/json-types.h b/json-glib/json-types.h
index a3bae4b..49e562c 100644
--- a/json-glib/json-types.h
+++ b/json-glib/json-types.h
@@ -21,6 +21,10 @@
  *   Emmanuele Bassi  <ebassi linux intel com>
  */
 
+#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
+#error "Only <json-glib/json-glib.h> can be included directly."
+#endif
+
 #ifndef __JSON_TYPES_H__
 #define __JSON_TYPES_H__
 
diff --git a/json-glib/json-version.h.in b/json-glib/json-version.h.in
index d716154..bc05f1b 100644
--- a/json-glib/json-version.h.in
+++ b/json-glib/json-version.h.in
@@ -21,6 +21,10 @@
  *   Emmanuele Bassi  <ebassi linux intel com>
  */
 
+#if !defined(__JSON_GLIB_INSIDE__) && !defined(JSON_COMPILATION)
+#error "Only <json-glib/json-glib.h> can be included directly."
+#endif
+
 #ifndef __JSON_VERSION_H__
 #define __JSON_VERSION_H__
 



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