branches/gmyth-0.1b/src/gmyth_stringlist.h
author rosfran
Wed Feb 07 20:39:10 2007 +0000 (2007-02-07)
branchtrunk
changeset 334 e326033fb048
permissions -rw-r--r--
[svn r336] More fixes on disposing GObjects.
     1 /**
     2  * GMyth Library
     3  *
     4  * @file gmyth/gmyth_stringlist.h
     5  * 
     6  * @brief <p> This component contains functions for dealing with the stringlist
     7  * format of the mythprotocol.
     8  * 
     9  * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    10  * @author Hallyson Luiz de Morais Melo <hallyson.melo@indt.org.br>
    11  *
    12  *//*
    13  * 
    14  * This program is free software; you can redistribute it and/or modify
    15  * it under the terms of the GNU Lesser General Public License as published by
    16  * the Free Software Foundation; either version 2 of the License, or
    17  * (at your option) any later version.
    18  *
    19  * This program is distributed in the hope that it will be useful,
    20  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    22  * GNU General Public License for more details.
    23  *
    24  * You should have received a copy of the GNU Lesser General Public License
    25  * along with this program; if not, write to the Free Software
    26  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    27  */
    28 
    29 #ifndef GMYTH_STRING_LIST_H_
    30 #define GMYTH_STRING_LIST_H_
    31 
    32 #include <glib-object.h>
    33 
    34 #include <stdio.h>
    35 #include <stdlib.h>
    36 #include <string.h>
    37 #include <netdb.h>
    38 #include <sys/socket.h>
    39 #include <unistd.h>
    40 
    41 G_BEGIN_DECLS
    42 
    43 #define GMYTH_STRING_LIST_TYPE               (gmyth_string_list_get_type ())
    44 #define GMYTH_STRING_LIST(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_STRING_LIST_TYPE, GMythStringList))
    45 #define GMYTH_STRING_LIST_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_STRING_LIST_TYPE, GMythStringListClass))
    46 #define IS_GMYTH_STRING_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_STRING_LIST_TYPE))
    47 #define IS_GMYTH_STRING_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_STRING_LIST_TYPE))
    48 #define GMYTH_STRING_LIST_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_STRING_LIST_TYPE, GMythStringListClass))
    49 
    50 
    51 typedef struct _GMythStringList         GMythStringList;
    52 typedef struct _GMythStringListClass    GMythStringListClass;
    53 
    54 struct _GMythStringListClass
    55 {
    56   GObjectClass parent_class;
    57 
    58   /* callbacks */
    59   /* no one for now */
    60 };
    61 
    62 struct _GMythStringList
    63 {
    64     GObject parent;
    65 
    66     /* string list */
    67     GList *glist;  
    68 };
    69 
    70 
    71 GType               gmyth_string_list_get_type (void);
    72 
    73 GMythStringList *   gmyth_string_list_new (void);
    74 
    75 void                gmyth_string_list_clear_all (GMythStringList *strlist);
    76 int                 gmyth_string_list_length (GMythStringList *strlist);
    77 
    78 GString *           gmyth_string_list_append_int (GMythStringList *strlist, 
    79                                                   const gint value);
    80 GString *           gmyth_string_list_append_uint64 (GMythStringList *strlist, 
    81                                                      const guint64 value);
    82 
    83 GString *           gmyth_string_list_append_int64 (GMythStringList *strlist, 
    84                                                      const gint64 value);
    85 
    86 GString *           gmyth_string_list_append_char_array (GMythStringList *strlist, 
    87                                                          const char* value);
    88 GString *           gmyth_string_list_append_string (GMythStringList *strlist, 
    89                                                      GString *value);
    90 
    91 int                 gmyth_string_list_get_int (GMythStringList *strlist, const gint index);
    92 guint64             gmyth_string_list_get_uint64 (GMythStringList *strlist, const gint index);
    93 gint64             gmyth_string_list_get_int64 (GMythStringList *strlist, const gint index);
    94 GString *           gmyth_string_list_get_string (GMythStringList *strlist, const gint index);
    95 
    96 #define gmyth_string_list_get_char_array(strlist, index) \
    97             (gmyth_string_list_get_string(strlist, index))->str
    98 
    99 G_END_DECLS
   100 
   101 #endif /*GMYTH_STRING_LIST_H_*/