Moved GsweHouseData to its own sources

This commit is contained in:
Gergely Polonkai 2013-09-24 01:24:00 +02:00
parent 20c3aafe85
commit 9ee5569bb1
11 changed files with 206 additions and 36 deletions

View File

@ -70,6 +70,7 @@ IGNORE_HFILES = \
gswe-antiscion-axis-info-private.h \
gswe-antiscion-data-private.h \
gswe-house-system-info-private.h \
gswe-house-data-private.h \
$(NULL)
# Images to copy into HTML directory.

View File

@ -28,6 +28,7 @@
<xi:include href="xml/gswe-antiscion-axis-info.xml" />
<xi:include href="xml/gswe-antiscion-data.xml" />
<xi:include href="xml/gswe-house-system-info.xml" />
<xi:include href="xml/gswe-house-data.xml" />
<xi:include href="xml/swe-glib.xml"/>
<xi:include href="xml/gswe-moment.xml"/>
<xi:include href="xml/gswe-timestamp.xml"/>

View File

@ -159,6 +159,17 @@ GSWE_TYPE_HOUSE_SYSTEM_INFO
gswe_house_system_info_get_type
</SECTION>
<SECTION>
<FILE>gswe-house-data</FILE>
GsweHouseData
gswe_house_data_get_cusp_position
gswe_house_data_get_house
gswe_house_data_get_sign
<SUBSECTION Standard>
GSWE_TYPE_HOUSE_DATA
gswe_house_data_get_type
</SECTION>
<SECTION>
<FILE>gswe-timestamp</FILE>
<TITLE>GsweTimestamp</TITLE>
@ -213,12 +224,9 @@ GsweQuality
GsweHouseSystem
GsweMoonPhase
GsweCoordinates
GsweHouseData
<SUBSECTION Standard>
GSWE_TYPE_COORDINATES
GSWE_TYPE_HOUSE_DATA
gswe_coordinates_get_type
gswe_house_data_get_type
</SECTION>
<SECTION>

View File

@ -15,6 +15,7 @@ INST_H_SRC_FILES = \
gswe-antiscion-axis-info.h \
gswe-antiscion-data.h \
gswe-house-system-info.h \
gswe-house-data.h \
gswe-moment.h \
gswe-timestamp.h \
$(NULL)
@ -36,6 +37,7 @@ libswe_glib_1_0_la_SOURCES = \
gswe-antiscion-axis-info.c \
gswe-antiscion-data.c \
gswe-house-system-info.c \
gswe-house-data.c \
gswe-moment.c \
gswe-timestamp.c \
gswe-enumtypes.c \

View File

@ -0,0 +1,41 @@
/* gswe-house-data-private.h: Private parts of GsweHouseData
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifdef __SWE_GLIB_BUILDING__
#ifndef __SWE_GLIB_GSWE_HOUSE_DATA_PRIVATE_H__
#define __SWE_GLIB_GSWE_HOUSE_DATA_PRIVATE_H__
#include "gswe-house-data.h"
struct _GsweHouseData {
/* the number of the house (usually in the range [1;12]. Sometimes may be [1;36]) */
guint house;
/* the position of the house's cusp on the sky */
gdouble cusp_position;
/* the #GsweSignInfo structure associated with the sign in which the house cusp is in */
GsweSignInfo *sign;
};
GsweHouseData *gswe_house_data_copy(GsweHouseData *house_data);
#endif /* __SWE_GLIB_GSWE_HOUSE_DATA_PRIVATE_H__ */
#else /* not defined __SWE_GLIB_BUILDING__ */
#error __FILE__ "Can not be included, unless building SWE-GLib"
#endif /* __SWE_GLIB_BUILDING__ */

101
src/gswe-house-data.c Normal file
View File

@ -0,0 +1,101 @@
/* gswe-house-data.c: House related data
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#include "gswe-types.h"
#include "gswe-house-data.h"
#include "gswe-house-data-private.h"
/**
* SECTION:gswe-house-data
* @short_description: a structure representing a house's position-related data
* @title: GsweHouseData
* @stability: Stable
* @include: swe-glib.h
* @see_also: #GsweHouseSystemInfo
*
* #GsweHouseData is a structure that represents a house's position.
*/
G_DEFINE_BOXED_TYPE(GsweHouseData, gswe_house_data, (GBoxedCopyFunc)gswe_house_data_copy, (GBoxedFreeFunc)g_free);
GsweHouseData *
gswe_house_data_copy(GsweHouseData *house_data)
{
GsweHouseData *ret = g_new0(GsweHouseData, 1);
ret->house = house_data->house;
ret->cusp_position = house_data->cusp_position;
ret->sign = house_data->sign;
return ret;
}
/**
* gswe_house_data_get_house:
* @house_data: (in) (allow-none): a #GsweHouseData
*
* Gets the number of the house.
*
* Returns: the house number
*/
guint
gswe_house_data_get_house(GsweHouseData *house_data)
{
if (house_data) {
return house_data->house;
} else {
return 0;
}
}
/**
* gswe_house_data_get_cusp_position:
* @house_data: (in) (allow-none): a #GsweHouseData
*
* Gets the position of the house's cusp.
*
* Returns: the cusp position, in degrees
*/
gdouble
gswe_house_data_get_cusp_position(GsweHouseData *house_data)
{
if (house_data) {
return house_data->cusp_position;
} else {
return 0.0;
}
}
/**
* gswe_house_data_get_sign:
* @house_data: (in) (allow-none): a #GsweHouseData
*
* Gets the sign in which the house's cusp is.
*
* Returns: (transfer none): a #GsweSignInfo representing the sign
*/
GsweSignInfo *
gswe_house_data_get_sign(GsweHouseData *house_data)
{
if (house_data) {
return house_data->sign;
} else {
return NULL;
}
}

47
src/gswe-house-data.h Normal file
View File

@ -0,0 +1,47 @@
/* gswe-house-data.h: House related data
*
* Copyright © 2013 Gergely Polonkai
*
* SWE-GLib is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* SWE-GLib 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this library; if not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __SWE_GLIB_GSWE_HOUSE_DATA_H__
#define __SWE_GLIB_GSWE_HOUSE_DATA_H__
#include <glib-object.h>
#include "gswe-sign-info.h"
G_BEGIN_DECLS
/**
* GsweHouseData:
*
* <structname>GsweHouseData</structname> is an opaque structure whose members
* cannot be accessed directly.
*
* Since: 1.1
*/
typedef struct _GsweHouseData GsweHouseData;
GType gswe_house_data_get_type(void);
#define GSWE_TYPE_HOUSE_DATA (gswe_house_data_get_type())
guint gswe_house_data_get_house(GsweHouseData *house_data);
gdouble gswe_house_data_get_cusp_position(GsweHouseData *house_data);
GsweSignInfo *gswe_house_data_get_sign(GsweHouseData *house_data);
G_END_DECLS
#endif /* __SWE_GLIB_GSWE_HOUSE_DATA_H__ */

View File

@ -32,17 +32,3 @@ gswe_coordinates_copy(GsweCoordinates *coordinates)
G_DEFINE_BOXED_TYPE(GsweCoordinates, gswe_coordinates, (GBoxedCopyFunc)gswe_coordinates_copy, (GBoxedFreeFunc)g_free);
static GsweHouseData *
gswe_house_data_copy(GsweHouseData *house_data)
{
GsweHouseData *ret = g_new0(GsweHouseData, 1);
ret->house = house_data->house;
ret->cusp_position = house_data->cusp_position;
ret->sign = house_data->sign;
return ret;
}
G_DEFINE_BOXED_TYPE(GsweHouseData, gswe_house_data, (GBoxedCopyFunc)gswe_house_data_copy, (GBoxedFreeFunc)g_free);

View File

@ -266,24 +266,5 @@ typedef struct _GsweCoordinates {
GType gswe_coordinates_get_type(void);
#define GSWE_TYPE_COORDINATES (gswe_coordinates_get_type())
/**
* GsweHouseData:
* @house: the number of the house (usually in the range [1;12]. Sometimes may
* be [1;36].
* @cusp_position: the position of the house's cusp on the sky
* @sign: the #GsweSignInfo structure associated with the sign in which the
* house cusp is in
*
* Holds information of a given house.
*/
typedef struct {
guint house;
gdouble cusp_position;
GsweSignInfo *sign;
} GsweHouseData;
GType gswe_house_data_get_type(void);
#define GSWE_TYPE_HOUSE_DATA (gswe_house_data_get_type())
#endif /* __SWE_GLIB_GSWE_TYPES_H__ */

View File

@ -28,6 +28,7 @@
#include "gswe-antiscion-axis-info-private.h"
#include "gswe-antiscion-data-private.h"
#include "gswe-house-system-info-private.h"
#include "gswe-house-data-private.h"
extern gchar *gswe_ephe_path;
extern GsweTimestamp *gswe_full_moon_base_date;

View File

@ -29,6 +29,7 @@
#include "gswe-antiscion-axis-info.h"
#include "gswe-antiscion-data.h"
#include "gswe-house-system-info.h"
#include "gswe-house-data.h"
#include "gswe-timestamp.h"
#include "gswe-moment.h"
#include "gswe-enumtypes.h"