[Cxplorer-cvs 01033] CVS update: libcxp/src

Back to archive index

Yasumichi Akahoshi yasum****@users*****
2005年 4月 15日 (金) 23:21:42 JST


Index: libcxp/src/cxp-profile.c
diff -u libcxp/src/cxp-profile.c:1.8 libcxp/src/cxp-profile.c:1.9
--- libcxp/src/cxp-profile.c:1.8	Fri Apr  8 20:36:14 2005
+++ libcxp/src/cxp-profile.c	Fri Apr 15 23:21:42 2005
@@ -1,10 +1,22 @@
-/***************************************************************************
- *            cxp-profile.c
+/* $Id: cxp-profile.c,v 1.9 2005/04/15 14:21:42 yasumichi Exp $ */
+/**
+ * \if japanese
+ * @file
+ * @brief cxp-profile.hの内部実装
+ *
+ * @author 赤星 柔充
+ * @date Fri Jan 21 16:34:46 2005
+ * $Revision: 1.9 $
+ * \endif
+ * \if english
+ * @file
+ * @brief Internal mounting of cxp-profile.h
  *
- *  Mon Nov 29 23:50:12 2004
- *  Copyright  2004  Yasumichi Akahoshi
- *  yasum****@users*****
- ****************************************************************************/
+ * @author Yasumichi Akahoshi
+ * @date Fri Jan 21 2005
+ * $Revision: 1.9 $
+ * \endif
+ */
 
 /*
  *  This program is free software; you can redistribute it and/or modify
@@ -32,6 +44,16 @@
 #include <sys/types.h>
 #include "cxp-profile.h"
 
+/**
+ * \if japanese
+ * @brief プロパティを識別するための列挙型です。
+ *
+ * \endif
+ * \if english
+ * @brief It is an enumeration type to identify property. 
+ *
+ * \endif
+ */
 enum
 {
 	CXP_PROFILE_APPNAME = 1,
@@ -39,12 +61,19 @@
 };
 
 /**
- * @brief private member of CxpProfile
+ * \if japanese
+ * @brief CxpProfileのプライベートなメンバ
+ *
+ * \endif
+ * \if english
+ * @brief Private member of CxpProfile
+ *
+ * \endif
  */
 typedef struct
 {
-	gchar *appname;			/**< application name */
-	gchar *section;			/**< section name */
+	gchar *appname;			/**< Application name */
+	gchar *section;			/**< Section name */
 	GHashTable *config;		/**< hash table of configuration */
 	gboolean dispose_has_run;	/**< Is dispose funciton executed */
 } CxpProfilePrivate;
@@ -54,10 +83,10 @@
 static GObjectClass *parent_class = NULL;
 
 /*
- * privete methods
+ * Prototypes of privete methods
  */
-static void cxp_profile_init (GTypeInstance * instance, gpointer g_class);
 static void cxp_profile_class_init (gpointer g_class, gpointer g_class_data);
+static void cxp_profile_init (GTypeInstance * instance, gpointer g_class);
 static void cxp_profile_dispose (GObject * obj);
 static void cxp_profile_finalize (GObject * obj);
 static void cxp_profile_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
@@ -67,8 +96,15 @@
 static void cxp_profile_load_file (CxpProfile * profile);
 
 /**
- * regist CxpProfile to GTypeTable.
- * @return GType
+ * \if japanese
+ * CxpProfileのオブジェクト型とクラスを型管理システムへ登録し、GType型を得る。
+ * @return 登録した型のユニークな (重複しない) 識別子を表す数値です。
+ * \endif
+ * \if english
+ * The object type and the class of CxpProfile are registered to the type management 
+ * system, and the GType type is obtained. 
+ * @return A numerical value which represents the unique identifier of a registered type.
+ * \endif
  */
 GType cxp_profile_get_type (void)
 {
@@ -95,21 +131,16 @@
 }
 
 /**
- * Init instance
- */
-static void cxp_profile_init (GTypeInstance * instance, gpointer g_class)
-{
-	CxpProfilePrivate *priv = CXP_PROFILE_GET_PRIVATE(instance);
-
-	priv->appname = NULL;
-	priv->section = NULL;
-	priv->config = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
-	priv->dispose_has_run = FALSE;
-}
-
-/**
- * class init CxpProfileClass
- *
+ * \if japanese
+ * クラスCxpProfileClassを初期化します。
+ * @param [in,out] g_class 初期化処理を行う構造体 GTypeClass
+ * @param [in,out] g_class を介して提供されるメンバ class_data
+ * \endif
+ * \if english
+ * Class CxpProfileClass is initialized. 
+ * @param [in,out] The GTypeClass structure to initialize.
+ * @param [in,out] The class_data member supplied via the GTypeInfo structure.
+ * \endif
  */
 static void cxp_profile_class_init (gpointer g_class, gpointer g_class_data)
 {
@@ -145,6 +176,46 @@
 	parent_class = g_type_class_peek_parent (g_class);
 }
 
+/**
+ * \if japanese
+ * オブジェクトCxpProfileのインスタンスを初期化します。
+ * @param [in,out] instance 初期化処理を行うインスタンス
+ * @param [in,out] g_class instance を生成する型のクラス
+ * \endif
+ * \if english
+ * The instance of object CxpProfile is initialized.
+ * @param [in,out] The instance to initialize.
+ * @param [in,out] The class of the type the instance is created for.
+ * \endif
+ */
+static void cxp_profile_init (GTypeInstance * instance, gpointer g_class)
+{
+	CxpProfilePrivate *priv = CXP_PROFILE_GET_PRIVATE(instance);
+
+	priv->appname = NULL;
+	priv->section = NULL;
+	priv->config = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
+	priv->dispose_has_run = FALSE;
+}
+
+/**
+ * \if japanese
+ * 全てのリファレンスを他のオブジェクトにドロップする役割を持つ関数であるが、
+ * その他のインスタンスはそのままにしておくので、クライアント側からのメソッド
+ * 呼び出しは動作する(ループを参照するために、複数の時間に分けて動作する)。
+ * この関数から返る前に、親クラスのメソッド dispose を連鎖的に呼び出す必要が
+ * ある。
+ * @param [in,out] obj GObject
+ * \endif
+ * \if english
+ * the dispose function is supposed to drop all references to other objects,
+ * but keep the instance otherwise intact, so that client method invocations
+ * still work. It may be run multiple times (due to reference loops). Before
+ * returning, dispose should chain up to the dispose method of the parent
+ * class.
+ * @param [in,out] obj GObject
+ * \endif
+ */
 static void cxp_profile_dispose (GObject * obj)
 {
 	CxpProfile *self = CXP_PROFILE (obj);
@@ -175,6 +246,20 @@
 	G_OBJECT_CLASS (parent_class)->dispose (obj);
 }
 
+/**
+ * \if japanese
+ * インスタンスの終了処理を行う関数で、メソッド dispose で開始したインスタンス
+ * の終了処理を完了させ、親クラスのメソッド finalize を連鎖的に呼び出す必要が
+ * ある
+ * @param [in,out] obj GObject
+ * \endif
+ * \if english
+ * instance finalization function, should finish the finalization of the
+ * instance begun in dispose and chain up to the finalize method of the parent
+ * class.
+ * @param [in,out] obj GObject
+ * \endif
+ */
 static void cxp_profile_finalize (GObject * obj)
 {
 	CxpProfilePrivate *priv = CXP_PROFILE_GET_PRIVATE(obj);
@@ -186,18 +271,32 @@
 	G_OBJECT_CLASS (parent_class)->finalize (obj);
 }
 
-static void cxp_profile_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
+/**
+ * \if japanese
+ * GObjectClass の関数 get_property のオーバーライド
+ * @param [in] object GObject
+ * @param [out] property_id 関数 g_object_class_install_property() で登録したプロパティの識別番号
+ * @param [out] value 取得したプロパティの値を格納した GValue
+ * @param [out] pspec 取得したプロパティの GParamSpec
+ * \endif
+ * \if english
+ * Override of function set_property of GObjectClass
+ * @param [in] object a GObject
+ * @param [out] property_id the numeric id under which the property was registered with g_object_class_install_property().
+ * @param [out] value a GValue to return the property value in
+ * @param [out] pspec the GParamSpec describing the property
+ * \endif
+ */
+static void cxp_profile_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
 {
 	CxpProfilePrivate *private = CXP_PROFILE_GET_PRIVATE(object);
 
 	switch (property_id) {
 		case CXP_PROFILE_APPNAME:
-			g_free (private->appname);
-			private->appname = g_value_dup_string (value);
+			g_value_set_string (value, private->appname);
 			break;
 		case CXP_PROFILE_SECTION:
-			g_free (private->section);
-			private->section = g_value_dup_string (value);
+			g_value_set_string (value, private->section);
 			break;
 		default:
 			/* We don't have any other property... */
@@ -206,16 +305,34 @@
 	}
 }
 
-static void cxp_profile_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec)
+/**
+ * \if japanese
+ * @param [in] GObjectClass の関数 set_property をオーバーライド
+ * @param [in] object GObject
+ * @param [in] property_id 関数 g_object_class_install_property() で登録したプロパティの識別番号
+ * @param [in] value プロパティの新しい値
+ * @param [in] pspec プロパティの GParamSpec
+ * \endif
+ * \if english
+ * Override of function get_property of GObjectClass
+ * @param [in] object a GObject
+ * @param [in] property_id the numeric id under which the property was registered with g_object_class_install_property().
+ * @param [in] value the new value for the property
+ * @param [in] pspec the GParamSpec describing the property
+ * \endif
+ */
+static void cxp_profile_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec)
 {
 	CxpProfilePrivate *private = CXP_PROFILE_GET_PRIVATE(object);
 
 	switch (property_id) {
 		case CXP_PROFILE_APPNAME:
-			g_value_set_string (value, private->appname);
+			g_free (private->appname);
+			private->appname = g_value_dup_string (value);
 			break;
 		case CXP_PROFILE_SECTION:
-			g_value_set_string (value, private->section);
+			g_free (private->section);
+			private->section = g_value_dup_string (value);
 			break;
 		default:
 			/* We don't have any other property... */
@@ -224,6 +341,20 @@
 	}
 }
 
+/**
+ * \if japanese
+ * CxpProfileを生成します。
+ * @param [in] appname アプリケーション名
+ * @param [in] section セクション名
+ * @return 新しいCxpProfile
+ * \endif
+ * \if english
+ * CxpProfile is generated. 
+ * @param [in] appname Application name
+ * @param [in] section Section name
+ * @return New CxpProfile
+ * \endif
+ */
 CxpProfile *cxp_profile_new (const gchar * appname, const gchar * section)
 {
 	CxpProfile *profile;
@@ -253,6 +384,20 @@
 	return profile;
 }
 
+/**
+ * \if japanese
+ * 設定名から、設定値を整数型で得ます。
+ * @param [in] profile CxpProfile
+ * @param [in] name 設定名
+ * @return 設定値。未定義の場合は、0を返す。
+ * \endif
+ * \if english
+ * A set value is obtained from a set name by the integer type. 
+ * @param [in] profile CxpProfile
+ * @param [in] name a set name
+ * @return Set value. 0 is returned in case of undefined. 
+ * \endif
+ */
 gint cxp_profile_get_integer (CxpProfile * profile, const gchar * name)
 {
 	gint retval;
@@ -274,6 +419,20 @@
 	return retval;
 }
 
+/**
+ * \if japanese
+ * 設定名から、設定値を文字列で得ます。
+ * @param [in] profile CxpProfile
+ * @param [in] name 設定名
+ * @return 設定値。未定義の場合は、NULLを返す。
+ * \endif
+ * \if english
+ * A set value is obtained from a set name by the character string. 
+ * @param [in] profile CxpProfile
+ * @param [in] name a set name
+ * @return Set value. NULL is returned in case of undefined. 
+ * \endif
+ */
 gchar *cxp_profile_get_string (CxpProfile * profile, const gchar * name)
 {
 	gchar *value;
@@ -284,6 +443,21 @@
 	return g_strdup (value);
 }
 
+/**
+ * \if japanese
+ * 設定名に整数値を割り当てます。内部的には、文字列に変換されます。
+ * @param [in] profile CxpProfile
+ * @param [in] key 設定名
+ * @param [in] value 整数値
+ * \endif
+ * \if english
+ * The integer value is allocated in a set name. Internally, it is converted
+ * into the character string.
+ * @param [in] profile CxpProfile
+ * @param [in] key a set name
+ * @param [in] value the integer value
+ * \endif
+ */
 void cxp_profile_set_integer (CxpProfile * profile, const gchar * key,
 			      gint value)
 {
@@ -293,6 +467,20 @@
 			      g_strdup_printf ("%d", value));
 }
 
+/**
+ * \if japanese
+ * 設定名に文字列を割り当てます。
+ * @param [in] profile CxpProfile
+ * @param [in] key 設定名
+ * @param [in] value 整数値
+ * \endif
+ * \if english
+ * The character string is allocated in a set name. 
+ * @param [in] profile CxpProfile
+ * @param [in] key a set name
+ * @param [in] value the string
+ * \endif
+ */
 void cxp_profile_set_string (CxpProfile * profile, const gchar * key,
 			     const gchar * value)
 {
@@ -302,7 +490,16 @@
 			      g_strdup (value));
 }
 
-
+/**
+ * \if japanese
+ * 設定ファイルを読み込みます。
+ * @param [in] profile CxpProfile
+ * \endif
+ * \if english
+ * The configuration file is loaded.
+ * @param [in] profile CxpProfile
+ * \endif
+ */
 static void cxp_profile_load_file (CxpProfile * profile)
 {
 	gchar *filename;
@@ -348,6 +545,16 @@
 	g_free (filename);
 }
 
+/**
+ * \if japanese
+ * 設定ファイルを保存します。
+ * @param [in] profile CxpProfile
+ * \endif
+ * \if english
+ * The configuration file is saved.
+ * @param [in] profile CxpProfile
+ * \endif
+ */
 static void cxp_profile_save_file (gpointer key, gpointer value,
 				   gpointer channel)
 {


Cxplorer-cvs メーリングリストの案内
Back to archive index