Moved GsweHouseSystemInfo to its own sources
This commit is contained in:
parent
39ddb2ee0e
commit
20c3aafe85
@ -69,6 +69,7 @@ IGNORE_HFILES = \
|
||||
gswe-aspect-data-private.h \
|
||||
gswe-antiscion-axis-info-private.h \
|
||||
gswe-antiscion-data-private.h \
|
||||
gswe-house-system-info-private.h \
|
||||
$(NULL)
|
||||
|
||||
# Images to copy into HTML directory.
|
||||
|
@ -27,6 +27,7 @@
|
||||
<xi:include href="xml/gswe-aspect-info.xml" />
|
||||
<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/swe-glib.xml"/>
|
||||
<xi:include href="xml/gswe-moment.xml"/>
|
||||
<xi:include href="xml/gswe-timestamp.xml"/>
|
||||
|
@ -148,6 +148,17 @@ GSWE_TYPE_ANTISCION_DATA
|
||||
gswe_antiscion_data_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gswe-house-system-info</FILE>
|
||||
GsweHouseSystemInfo
|
||||
gswe_house_system_info_get_house_system
|
||||
gswe_house_system_info_get_name
|
||||
gswe_house_system_info_get_sweph_id
|
||||
<SUBSECTION Standard>
|
||||
GSWE_TYPE_HOUSE_SYSTEM_INFO
|
||||
gswe_house_system_info_get_type
|
||||
</SECTION>
|
||||
|
||||
<SECTION>
|
||||
<FILE>gswe-timestamp</FILE>
|
||||
<TITLE>GsweTimestamp</TITLE>
|
||||
@ -201,7 +212,6 @@ GsweElement
|
||||
GsweQuality
|
||||
GsweHouseSystem
|
||||
GsweMoonPhase
|
||||
GsweHouseSystemInfo
|
||||
GsweCoordinates
|
||||
GsweHouseData
|
||||
<SUBSECTION Standard>
|
||||
|
@ -14,6 +14,7 @@ INST_H_SRC_FILES = \
|
||||
gswe-aspect-data.h \
|
||||
gswe-antiscion-axis-info.h \
|
||||
gswe-antiscion-data.h \
|
||||
gswe-house-system-info.h \
|
||||
gswe-moment.h \
|
||||
gswe-timestamp.h \
|
||||
$(NULL)
|
||||
@ -34,6 +35,7 @@ libswe_glib_1_0_la_SOURCES = \
|
||||
gswe-aspect-data.c \
|
||||
gswe-antiscion-axis-info.c \
|
||||
gswe-antiscion-data.c \
|
||||
gswe-house-system-info.c \
|
||||
gswe-moment.c \
|
||||
gswe-timestamp.c \
|
||||
gswe-enumtypes.c \
|
||||
|
44
src/gswe-house-system-info-private.h
Normal file
44
src/gswe-house-system-info-private.h
Normal file
@ -0,0 +1,44 @@
|
||||
/* gswe-house-system-info-private.h: Private parts of GsweHouseSystemInfo
|
||||
*
|
||||
* 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_SYSTEM_INFO_PRIVATE_H__
|
||||
#define __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_PRIVATE_H__
|
||||
|
||||
#include "gswe-types.h"
|
||||
|
||||
#include "gswe-house-system-info.h"
|
||||
|
||||
struct _GsweHouseSystemInfo {
|
||||
/* the house system's ID */
|
||||
GsweHouseSystem house_system;
|
||||
|
||||
/* the character value that represents this house system in the Swiss Ephemeris library */
|
||||
gchar sweph_id;
|
||||
|
||||
/* the name of this house system */
|
||||
gchar *name;
|
||||
};
|
||||
|
||||
GsweHouseSystemInfo *gswe_house_system_info_copy(GsweHouseSystemInfo *house_system_info);
|
||||
void gswe_house_system_info_free(GsweHouseSystemInfo *house_system_info);
|
||||
|
||||
#endif /* __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_PRIVATE_H__ */
|
||||
#else /* not defined __SWE_GLIB_BUILDING__ */
|
||||
#error __FILE__ "Can not be included, unless building SWE-GLib"
|
||||
#endif /* __SWE_GLIB_BUILDING__ */
|
||||
|
116
src/gswe-house-system-info.c
Normal file
116
src/gswe-house-system-info.c
Normal file
@ -0,0 +1,116 @@
|
||||
/* gswe-house-system-info.c: House system information
|
||||
*
|
||||
* 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-system-info.h"
|
||||
#include "gswe-house-system-info-private.h"
|
||||
|
||||
/**
|
||||
* SECTION:gswe-house-system-info
|
||||
* @short_description: a structure storing information about a house system
|
||||
* @title: GsweHouseSystemInfo
|
||||
* @stability: Stable
|
||||
* @include: swe-glib.h
|
||||
*
|
||||
* #GsweHouseSystemInfo stores information of a house system.
|
||||
*/
|
||||
|
||||
G_DEFINE_BOXED_TYPE(GsweHouseSystemInfo, gswe_house_system_info, (GBoxedCopyFunc)gswe_house_system_info_copy, (GBoxedFreeFunc)gswe_house_system_info_free);
|
||||
|
||||
GsweHouseSystemInfo *
|
||||
gswe_house_system_info_copy(GsweHouseSystemInfo *house_system_info)
|
||||
{
|
||||
GsweHouseSystemInfo *ret;
|
||||
|
||||
if (house_system_info == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = g_new0(GsweHouseSystemInfo, 1);
|
||||
ret->house_system = house_system_info->house_system;
|
||||
ret->sweph_id = house_system_info->sweph_id;
|
||||
ret->name = g_strdup(house_system_info->name);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
gswe_house_system_info_free(GsweHouseSystemInfo *house_system_info)
|
||||
{
|
||||
if (house_system_info) {
|
||||
if (house_system_info->name) {
|
||||
g_free(house_system_info->name);
|
||||
}
|
||||
|
||||
g_free(house_system_info);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gswe_house_system_info_get_house_system:
|
||||
* @house_system_info: (in) (allow-none): a #GsweHouseSystemInfo
|
||||
*
|
||||
* Gets the house system ID this #GsweHouseSystemInfo represents.
|
||||
*
|
||||
* Returns: the house system ID
|
||||
*/
|
||||
GsweHouseSystem
|
||||
gswe_house_system_info_get_house_system(GsweHouseSystemInfo *house_system_info)
|
||||
{
|
||||
if (house_system_info) {
|
||||
return house_system_info->house_system;
|
||||
} else {
|
||||
return GSWE_HOUSE_SYSTEM_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gswe_house_system_info_get_sweph_id:
|
||||
* @house_system_info: (in) (allow-none): a #GsweHouseSystemInfo
|
||||
*
|
||||
* Gets the Swiss Ephemeris ID for the house system.
|
||||
*
|
||||
* Returns: the character representing this house system in Swiss Ephemeris
|
||||
*/
|
||||
gchar
|
||||
gswe_house_system_info_get_sweph_id(GsweHouseSystemInfo *house_system_info)
|
||||
{
|
||||
if (house_system_info) {
|
||||
return house_system_info->sweph_id;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* gswe_house_system_info_get_name:
|
||||
* @house_system_info: (in) (allow-none): a #GsweHouseSystemInfo
|
||||
*
|
||||
* Gets the name of the house system.
|
||||
*
|
||||
* Returns: (transfer none): the name of the house system
|
||||
*/
|
||||
const gchar *
|
||||
gswe_house_system_info_get_name(GsweHouseSystemInfo *house_system_info)
|
||||
{
|
||||
if (house_system_info) {
|
||||
return house_system_info->name;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
47
src/gswe-house-system-info.h
Normal file
47
src/gswe-house-system-info.h
Normal file
@ -0,0 +1,47 @@
|
||||
/* gswe-house-system-info.h: House system information
|
||||
*
|
||||
* 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_SYSTEM_INFO_H__
|
||||
#define __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_H__
|
||||
|
||||
#include <glib-object.h>
|
||||
|
||||
#include "gswe-types.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/**
|
||||
* GsweHouseSystemInfo:
|
||||
*
|
||||
* <structname>GsweHouseSystemInfo</structname> is an opaque structure whose members
|
||||
* cannot be accessed directly.
|
||||
*
|
||||
* Since: 1.1
|
||||
*/
|
||||
typedef struct _GsweHouseSystemInfo GsweHouseSystemInfo;
|
||||
|
||||
GType gswe_house_system_info_get_type(void);
|
||||
#define GSWE_TYPE_HOUSE_SYSTEM_INFO (gswe_house_system_info_get_type())
|
||||
|
||||
GsweHouseSystem gswe_house_system_info_get_house_system(GsweHouseSystemInfo *house_system_info);
|
||||
gchar gswe_house_system_info_get_sweph_id(GsweHouseSystemInfo *house_system_info);
|
||||
const gchar *gswe_house_system_info_get_name(GsweHouseSystemInfo *house_system_info);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __SWE_GLIB_GSWE_HOUSE_SYSTEM_INFO_H__ */
|
||||
|
@ -249,20 +249,6 @@ typedef enum {
|
||||
GSWE_MOON_PHASE_DARK
|
||||
} GsweMoonPhase;
|
||||
|
||||
/**
|
||||
* GsweHouseSystemInfo:
|
||||
* @system: the house system's ID
|
||||
* @sweph_id: the character value that represents this house system in the Swiss Ephemeris library
|
||||
* @name: the name of this house system
|
||||
*
|
||||
* Holds information about house systems known by SWE-GLib.
|
||||
*/
|
||||
typedef struct {
|
||||
GsweHouseSystem system;
|
||||
gchar sweph_id;
|
||||
gchar *name;
|
||||
} GsweHouseSystemInfo;
|
||||
|
||||
/**
|
||||
* GsweCoordinates:
|
||||
* @longitude: longitude part of the coordinates
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "gswe-aspect-data-private.h"
|
||||
#include "gswe-antiscion-axis-info-private.h"
|
||||
#include "gswe-antiscion-data-private.h"
|
||||
#include "gswe-house-system-info-private.h"
|
||||
|
||||
extern gchar *gswe_ephe_path;
|
||||
extern GsweTimestamp *gswe_full_moon_base_date;
|
||||
|
@ -63,7 +63,7 @@ GsweTimestamp *gswe_full_moon_base_date;
|
||||
|
||||
#define ADD_HOUSE_SYSTEM(ht, v, i, s, n) \
|
||||
(v) = g_new0(GsweHouseSystemInfo, 1); \
|
||||
(v)->system = i; \
|
||||
(v)->house_system = i; \
|
||||
(v)->sweph_id = s; \
|
||||
(v)->name = g_strdup(n); \
|
||||
g_hash_table_replace((ht), GINT_TO_POINTER(i), (v));
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "gswe-aspect-data.h"
|
||||
#include "gswe-antiscion-axis-info.h"
|
||||
#include "gswe-antiscion-data.h"
|
||||
#include "gswe-house-system-info.h"
|
||||
#include "gswe-timestamp.h"
|
||||
#include "gswe-moment.h"
|
||||
#include "gswe-enumtypes.h"
|
||||
|
Loading…
Reference in New Issue
Block a user