Main Page   Modules   Compound List   File List   Compound Members   File Members  

xlv_config.h

Go to the documentation of this file.
00001 /*
00002  * xlv_config.h
00003  *
00004  * Copyright (C) 2001 Guilhem Lavaux
00005  *
00006  * This file is part of XLV, a free middleware audio-video stream coder/decoder.
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * XLV is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016  * GNU General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021  */
00022 
00028 #ifndef _XLV_CONFIG_H
00029 #define _XLV_CONFIG_H
00030 
00031 #include <glib.h>
00032 #include <stdio.h>
00033 
00034 #define XLV_CONFIG_HOME_DIR ".xlv"
00035 #define XLV_CONFIG_ETC_DIR "xlv"
00036 
00042 typedef struct _XLV_ConfigSection XLV_ConfigSection;
00044 typedef struct _XLV_ConfigKey XLV_ConfigKey;
00046 typedef struct _XLV_Config XLV_Config;
00047 
00049 typedef struct _XLV_ConfigOptions XLV_ConfigOptions;
00051 typedef struct _XLV_ConfigOptions_Section XLV_ConfigOptions_Section;
00053 typedef struct _XLV_ConfigOptions_Key XLV_ConfigOptions_Key;
00054 
00057 struct _XLV_Config {
00058     gchar *m_filename;
00059     FILE *m_fd;
00060     GList *m_sections;
00061 };
00062 
00065 struct _XLV_ConfigSection {
00066     XLV_Config *m_config;
00067     XLV_ConfigSection *m_next_section;
00068 
00070     gchar *m_section_name;
00071     GList *m_keys;
00072 };
00073 
00076 struct _XLV_ConfigKey {
00077     XLV_ConfigSection *m_section;
00081     XLV_ConfigKey *m_next_key;
00083     guint8 *m_keyname;
00085     guint8 m_keytype;
00086 
00088     union {
00090         gpointer data;
00092         guint32 i;
00094         gfloat f;
00095     } m_keydata;
00096 #define XLV_CONFIG_KEY_STRING 0
00097 #define XLV_CONFIG_KEY_INT    1
00098 #define XLV_CONFIG_KEY_FLOAT  2
00099 #define XLV_CONFIG_KEY_UNDEF  3
00100 };
00101 
00102 struct _XLV_ConfigOptions_Key {
00103     const gchar *m_key_name;
00104     guint8 m_type_expected;
00105     gpointer m_data;
00106 };
00107 
00108 struct _XLV_ConfigOptions_Section {
00109     const gchar *m_section_name;
00110     XLV_ConfigOptions_Key *m_keys;
00111 };
00112 
00113 struct _XLV_ConfigOptions {
00114     XLV_ConfigOptions_Section *m_sections;
00115 };
00116 
00117 #ifdef __cplusplus
00118 extern "C" {
00119 #endif
00120 
00127     gchar *xlv_config_check_file (const gchar * filename,
00128                                   gboolean force_local);
00129 
00137     XLV_Config *xlv_config_file_new (const gchar * filename);
00138 
00145     void xlv_config_release (XLV_Config * config, gboolean flush);
00146 
00156     XLV_ConfigSection *xlv_config_get_section (XLV_Config * config,
00157                                                const guint8 * section_name);
00158 
00166     XLV_ConfigKey *xlv_config_get_key (XLV_ConfigSection * section,
00167                                        const guint8 * section_key);
00168 
00180     XLV_ConfigSection *xlv_config_next_section (XLV_Config * config,
00181                                                 XLV_ConfigSection * section);
00182 
00193     XLV_ConfigKey *xlv_config_next_key (XLV_ConfigSection * section,
00194                                         XLV_ConfigKey * key);
00195 
00201     void xlv_config_get_options (XLV_Config * config,
00202                                  XLV_ConfigOptions * options);
00203 
00204 #ifdef __cplusplus
00205 }
00206 #endif
00207 
00210 #endif

Generated on Mon Jul 1 19:39:05 2002 for XLV by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002