[Xfce4-commits] <squeeze:master> Cleanup parser-context.{c,h}
Stephan Arts
noreply at xfce.org
Thu Oct 6 22:02:02 CEST 2011
Updating branch refs/heads/master
to f115d748302dc3d2e14a6087479f236b5f80c26d (commit)
from 82e1c0070bb93777a83a756ac038b594e33c8bc4 (commit)
commit f115d748302dc3d2e14a6087479f236b5f80c26d
Author: Stephan Arts <stephan at xfce.org>
Date: Thu Oct 6 22:00:46 2011 +0200
Cleanup parser-context.{c,h}
libsqueeze/parser-context.c | 125 ++++++++++++++++++++++++++-----------------
libsqueeze/parser-context.h | 54 +++++++++++--------
2 files changed, 108 insertions(+), 71 deletions(-)
diff --git a/libsqueeze/parser-context.c b/libsqueeze/parser-context.c
index 286ca7d..56e6e14 100644
--- a/libsqueeze/parser-context.c
+++ b/libsqueeze/parser-context.c
@@ -29,99 +29,126 @@
#include "parser-context.h"
enum {
- LSQ_PARSER_CONTEXT_PROPERTY_ARCHIVE = 1
+ LSQ_PARSER_CONTEXT_PROPERTY_ARCHIVE = 1
};
-static void lsq_parser_context_set_property(GObject*, guint, const GValue*, GParamSpec*);
-static void lsq_parser_context_get_property(GObject*, guint, GValue*, GParamSpec*);
+static void
+lsq_parser_context_set_property (
+ GObject *,
+ guint,
+ const GValue *,
+ GParamSpec * );
+
+static void
+lsq_parser_context_get_property (
+ GObject *,
+ guint,
+ GValue *,
+ GParamSpec * );
-G_DEFINE_TYPE(LSQParserContext, lsq_parser_context, G_TYPE_OBJECT);
+G_DEFINE_TYPE ( LSQParserContext, lsq_parser_context, G_TYPE_OBJECT );
static void
-lsq_parser_context_init(LSQParserContext *self)
+lsq_parser_context_init ( LSQParserContext *self )
{
- self->archive = NULL;
- self->channel = NULL;
- self->last_stat = G_IO_STATUS_AGAIN;
+ self->archive = NULL;
+ self->channel = NULL;
+ self->last_stat = G_IO_STATUS_AGAIN;
}
static void
-lsq_parser_context_class_init(LSQParserContextClass *klass)
+lsq_parser_context_class_init ( LSQParserContextClass *klass )
{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
- GParamSpec *pspec;
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
+ GParamSpec *pspec;
- object_class->set_property = lsq_parser_context_set_property;
- object_class->get_property = lsq_parser_context_get_property;
+ object_class->set_property = lsq_parser_context_set_property;
+ object_class->get_property = lsq_parser_context_get_property;
- pspec = g_param_spec_object("archive", NULL, NULL, LSQ_TYPE_ARCHIVE, G_PARAM_READABLE|G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_property(object_class, LSQ_PARSER_CONTEXT_PROPERTY_ARCHIVE, pspec);
+ pspec = g_param_spec_object("archive", NULL, NULL, LSQ_TYPE_ARCHIVE, G_PARAM_READABLE|G_PARAM_WRITABLE|G_PARAM_CONSTRUCT_ONLY);
+ g_object_class_install_property(object_class, LSQ_PARSER_CONTEXT_PROPERTY_ARCHIVE, pspec);
}
static void
-lsq_parser_context_set_property(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+lsq_parser_context_set_property (
+ GObject *object,
+ guint property_id,
+ const GValue *value,
+ GParamSpec *pspec )
{
- switch(property_id)
- {
- case LSQ_PARSER_CONTEXT_PROPERTY_ARCHIVE:
- LSQ_PARSER_CONTEXT(object)->archive = g_value_get_object(value);
- break;
- }
+ switch ( property_id )
+ {
+ case LSQ_PARSER_CONTEXT_PROPERTY_ARCHIVE:
+ LSQ_PARSER_CONTEXT ( object )->archive = g_value_get_object ( value );
+ break;
+ }
}
static void
-lsq_parser_context_get_property(GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+lsq_parser_context_get_property (
+ GObject *object,
+ guint property_id,
+ GValue *value,
+ GParamSpec *pspec )
{
- switch(property_id)
- {
- case LSQ_PARSER_CONTEXT_PROPERTY_ARCHIVE:
- g_value_set_object(value, LSQ_PARSER_CONTEXT(object)->archive);
- break;
- }
+ switch ( property_id )
+ {
+ case LSQ_PARSER_CONTEXT_PROPERTY_ARCHIVE:
+ g_value_set_object ( value, LSQ_PARSER_CONTEXT ( object )->archive );
+ break;
+ }
}
LSQParserContext*
-lsq_parser_context_new(LSQArchive *archive)
+lsq_parser_context_new ( LSQArchive *archive )
{
- LSQParserContext *ctx;
-
- g_return_val_if_fail(LSQ_IS_ARCHIVE(archive), NULL);
+ LSQParserContext *ctx;
- ctx = g_object_new(LSQ_TYPE_PARSER_CONTEXT, "archive", archive, NULL);
-
- return ctx;
+ g_return_val_if_fail ( LSQ_IS_ARCHIVE ( archive ), NULL );
+
+ ctx = g_object_new (
+ LSQ_TYPE_PARSER_CONTEXT,
+ "archive",
+ archive,
+ NULL);
+
+ return ctx;
}
void
-lsq_parser_context_set_channel(LSQParserContext *ctx, GIOChannel *channel)
+lsq_parser_context_set_channel (
+ LSQParserContext *ctx,
+ GIOChannel *channel )
{
- ctx->channel = channel;
- ctx->last_stat = G_IO_STATUS_AGAIN;
+ ctx->channel = channel;
+ ctx->last_stat = G_IO_STATUS_AGAIN;
}
gboolean
-lsq_parser_context_get_line(LSQParserContext *ctx, gchar **line, gsize *length)
+lsq_parser_context_get_line (
+ LSQParserContext *ctx,
+ gchar **line,
+ gsize *length )
{
- GIOStatus stat;
+ GIOStatus stat;
g_return_val_if_fail(ctx->channel, FALSE);
- stat = g_io_channel_read_line(ctx->channel, line, length, NULL, NULL);
+ stat = g_io_channel_read_line(ctx->channel, line, length, NULL, NULL);
- ctx->last_stat = stat;
+ ctx->last_stat = stat;
- return stat == G_IO_STATUS_NORMAL;
+ return stat == G_IO_STATUS_NORMAL;
}
gboolean
-lsq_parser_context_is_good(LSQParserContext *ctx)
+lsq_parser_context_is_good ( LSQParserContext *ctx )
{
- return ctx->last_stat == G_IO_STATUS_NORMAL || ctx->last_stat == G_IO_STATUS_AGAIN;
+ return ctx->last_stat == G_IO_STATUS_NORMAL || ctx->last_stat == G_IO_STATUS_AGAIN;
}
gboolean
-lsq_parser_context_read_again(LSQParserContext *ctx)
+lsq_parser_context_read_again ( LSQParserContext *ctx )
{
- return ctx->last_stat == G_IO_STATUS_NORMAL;
+ return ctx->last_stat == G_IO_STATUS_NORMAL;
}
-
diff --git a/libsqueeze/parser-context.h b/libsqueeze/parser-context.h
index 5100dcb..7cbf32d 100644
--- a/libsqueeze/parser-context.h
+++ b/libsqueeze/parser-context.h
@@ -20,56 +20,66 @@ G_BEGIN_DECLS
#define LSQ_TYPE_PARSER_CONTEXT lsq_parser_context_get_type()
-#define LSQ_PARSER_CONTEXT(obj) ( \
- G_TYPE_CHECK_INSTANCE_CAST ((obj), \
- LSQ_TYPE_PARSER_CONTEXT, \
+#define LSQ_PARSER_CONTEXT(obj) ( \
+ G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+ LSQ_TYPE_PARSER_CONTEXT, \
LSQParserContext))
-#define LSQ_IS_PARSER_CONTEXT(obj) ( \
- G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+#define LSQ_IS_PARSER_CONTEXT(obj) ( \
+ G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
LSQ_TYPE_PARSER_CONTEXT))
-#define LSQ_PARSER_CONTEXT_CLASS(class) ( \
- G_TYPE_CHECK_CLASS_CAST ((class), \
- LSQ_TYPE_PARSER_CONTEXT, \
+#define LSQ_PARSER_CONTEXT_CLASS(class) ( \
+ G_TYPE_CHECK_CLASS_CAST ((class), \
+ LSQ_TYPE_PARSER_CONTEXT, \
LSQParserContextClass))
-#define LSQ_IS_PARSER_CONTEXT_CLASS(class) ( \
- G_TYPE_CHECK_CLASS_TYPE ((class), \
+#define LSQ_IS_PARSER_CONTEXT_CLASS(class) ( \
+ G_TYPE_CHECK_CLASS_TYPE ((class), \
LSQ_TYPE_PARSER_CONTEXT))
typedef struct _LSQParserContext LSQParserContext;
struct _LSQParserContext
{
- GObject parent;
+ GObject parent;
- LSQArchive *archive;
+ LSQArchive *archive;
- GIOChannel *channel;
- GIOStatus last_stat;
+ GIOChannel *channel;
+ GIOStatus last_stat;
};
typedef struct _LSQParserContextClass LSQParserContextClass;
struct _LSQParserContextClass
{
- GObjectClass parent;
+ GObjectClass parent;
};
-GType lsq_parser_context_get_type (void);
+GType
+lsq_parser_context_get_type ( void);
-LSQParserContext *lsq_parser_context_new (LSQArchive *archive);
+LSQParserContext *
+lsq_parser_context_new ( LSQArchive *archive );
-gboolean lsq_parser_context_get_line (LSQParserContext *, gchar **, gsize *);
+gboolean
+lsq_parser_context_get_line (
+ LSQParserContext *,
+ gchar **,
+ gsize * );
-gboolean lsq_parser_context_is_good (LSQParserContext *);
+gboolean
+lsq_parser_context_is_good ( LSQParserContext * );
-gboolean lsq_parser_context_read_again(LSQParserContext *);
+gboolean
+lsq_parser_context_read_again ( LSQParserContext *);
-void lsq_parser_context_set_channel(LSQParserContext *, GIOChannel *);
+void
+lsq_parser_context_set_channel (
+ LSQParserContext *,
+ GIOChannel * );
G_END_DECLS
#endif /* __LIBSQUEEZE_PARSER_CONTEXT_H__ */
-
More information about the Xfce4-commits
mailing list