[girepository] Move GIErrorDomainInfo out of ginfo.ch

This commit is contained in:
Johan Dahlin 2010-06-06 13:01:26 -03:00
parent edcce0af88
commit dab5e1ddaf
5 changed files with 135 additions and 72 deletions

View File

@ -3,6 +3,7 @@ girepo_HEADERS = \
giarginfo.h \
gibaseinfo.h \
gicallableinfo.h \
gierrordomaininfo.h \
gifunctioninfo.h \
girepository.h \
girffi.h \
@ -18,8 +19,9 @@ libgirepository_1_0_la_SOURCES = \
gfield.c \
giarginfo.c \
gibaseinfo.c \
gifunctioninfo.c \
gicallableinfo.c \
gierrordomaininfo.c \
gifunctioninfo.c \
ginfo.c \
ginvoke.c \
girepository.c \

87
gierrordomaininfo.c Normal file
View File

@ -0,0 +1,87 @@
/* GObject introspection: ErrorDomain implementation
*
* Copyright (C) 2005 Matthias Clasen
* Copyright (C) 2008,2009 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <glib.h>
#include <girepository.h>
#include "girepository-private.h"
#include "gitypelib-internal.h"
/**
* SECTION:gierrordomaininfo
* @Short_description: Struct representing an error domain
* @Title: GIErrorDomainInfo
*
* A GIErrorDomainInfo struct represents a domain of a #GError.
* An error domain is associated with a #GQuark and contains a pointer
* to an enum with all the error codes.
*/
/**
* g_error_domain_info_get_quark:
* @info: a #GIErrorDomainInfo
*
* Obtain a string representing the quark for this error domain.
* %NULL will be returned if the type tag is wrong or if a quark is
* missing in the typelib.
*
* Returns: the quark represented as a string or %NULL
*/
const gchar *
g_error_domain_info_get_quark (GIErrorDomainInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ErrorDomainBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_ERROR_DOMAIN_INFO (info), NULL);
blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
return g_typelib_get_string (rinfo->typelib, blob->get_quark);
}
/**
* g_error_domain_info_get_codes:
* @info: a #GIErrorDomainInfo
*
* Obtain the enum containing all the error codes for this error domain.
* The return value will have a #GIInfoType of %GI_INFO_TYPE_ERROR_DOMAIN
*
* Returns: (transfer full): the error domain or %NULL if type tag is wrong,
* free the struct with g_base_info_unref() when done.
*/
GIInterfaceInfo *
g_error_domain_info_get_codes (GIErrorDomainInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ErrorDomainBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_ERROR_DOMAIN_INFO (info), NULL);
blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
rinfo->typelib, blob->error_codes);
}

44
gierrordomaininfo.h Normal file
View File

@ -0,0 +1,44 @@
/* GObject introspection: Error Domain
*
* Copyright (C) 2005 Matthias Clasen
* Copyright (C) 2008,2009 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __GIERRORDOMAININFO_H__
#define __GIERRORDOMAININFO_H__
#if !defined (__GIREPOSITORY_H_INSIDE__) && !defined (GI_COMPILATION)
#error "Only <girepository.h> can be included directly."
#endif
#include <gitypes.h>
G_BEGIN_DECLS
#define GI_IS_ERROR_DOMAIN_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ERROR_DOMAIN)
const gchar * g_error_domain_info_get_quark (GIErrorDomainInfo *info);
GIInterfaceInfo * g_error_domain_info_get_codes (GIErrorDomainInfo *info);
G_END_DECLS
#endif /* __GIERRORDOMAININFO_H__ */

62
ginfo.c
View File

@ -29,68 +29,6 @@
#include "girepository-private.h"
/* GIErrorDomainInfo functions */
/**
* SECTION:gierrordomaininfo
* @Short_description: Struct representing an error domain
* @Title: GIErrorDomainInfo
*
* A GIErrorDomainInfo struct represents a domain of a #GError.
* An error domain is associated with a #GQuark and contains a pointer
* to an enum with all the error codes.
*/
/**
* g_error_domain_info_get_quark:
* @info: a #GIErrorDomainInfo
*
* Obtain a string representing the quark for this error domain.
* %NULL will be returned if the type tag is wrong or if a quark is
* missing in the typelib.
*
* Returns: the quark represented as a string or %NULL
*/
const gchar *
g_error_domain_info_get_quark (GIErrorDomainInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ErrorDomainBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_ERROR_DOMAIN_INFO (info), NULL);
blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
return g_typelib_get_string (rinfo->typelib, blob->get_quark);
}
/**
* g_error_domain_info_get_codes:
* @info: a #GIErrorDomainInfo
*
* Obtain the enum containing all the error codes for this error domain.
* The return value will have a #GIInfoType of %GI_INFO_TYPE_ERROR_DOMAIN
*
* Returns: (transfer full): the error domain or %NULL if type tag is wrong,
* free the struct with g_base_info_unref() when done.
*/
GIInterfaceInfo *
g_error_domain_info_get_codes (GIErrorDomainInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
ErrorDomainBlob *blob;
g_return_val_if_fail (info != NULL, NULL);
g_return_val_if_fail (GI_IS_ERROR_DOMAIN_INFO (info), NULL);
blob = (ErrorDomainBlob *)&rinfo->typelib->data[rinfo->offset];
return (GIInterfaceInfo *) _g_info_from_entry (rinfo->repository,
rinfo->typelib, blob->error_codes);
}
/* GIEnumInfo and GIValueInfo functions */
/**

View File

@ -29,6 +29,7 @@
#include <giarginfo.h>
#include <gibaseinfo.h>
#include <gicallableinfo.h>
#include <gierrordomaininfo.h>
#include <gifunctioninfo.h>
#include <gitypeinfo.h>
#include <gitypelib.h>
@ -148,15 +149,6 @@ void gi_cclosure_marshal_generic (GClosure *closure,
gpointer invocation_hint,
gpointer marshal_data);
/* GIErrorDomainInfo */
#define GI_IS_ERROR_DOMAIN_INFO(info) \
(g_base_info_get_type((GIBaseInfo*)info) == GI_INFO_TYPE_ERROR_DOMAIN)
const gchar * g_error_domain_info_get_quark (GIErrorDomainInfo *info);
GIInterfaceInfo * g_error_domain_info_get_codes (GIErrorDomainInfo *info);
/* GIValueInfo */
#define GI_IS_VALUE_INFO(info) \