branches/gmyth-0.1b/src/gmyth_stringlist.h
branchtrunk
changeset 337 60bfeabc0af6
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/branches/gmyth-0.1b/src/gmyth_stringlist.h	Thu Feb 08 20:57:31 2007 +0000
     1.3 @@ -0,0 +1,101 @@
     1.4 +/**
     1.5 + * GMyth Library
     1.6 + *
     1.7 + * @file gmyth/gmyth_stringlist.h
     1.8 + * 
     1.9 + * @brief <p> This component contains functions for dealing with the stringlist
    1.10 + * format of the mythprotocol.
    1.11 + * 
    1.12 + * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia.
    1.13 + * @author Hallyson Luiz de Morais Melo <hallyson.melo@indt.org.br>
    1.14 + *
    1.15 + *//*
    1.16 + * 
    1.17 + * This program is free software; you can redistribute it and/or modify
    1.18 + * it under the terms of the GNU Lesser General Public License as published by
    1.19 + * the Free Software Foundation; either version 2 of the License, or
    1.20 + * (at your option) any later version.
    1.21 + *
    1.22 + * This program is distributed in the hope that it will be useful,
    1.23 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    1.24 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    1.25 + * GNU General Public License for more details.
    1.26 + *
    1.27 + * You should have received a copy of the GNU Lesser General Public License
    1.28 + * along with this program; if not, write to the Free Software
    1.29 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    1.30 + */
    1.31 +
    1.32 +#ifndef GMYTH_STRING_LIST_H_
    1.33 +#define GMYTH_STRING_LIST_H_
    1.34 +
    1.35 +#include <glib-object.h>
    1.36 +
    1.37 +#include <stdio.h>
    1.38 +#include <stdlib.h>
    1.39 +#include <string.h>
    1.40 +#include <netdb.h>
    1.41 +#include <sys/socket.h>
    1.42 +#include <unistd.h>
    1.43 +
    1.44 +G_BEGIN_DECLS
    1.45 +
    1.46 +#define GMYTH_STRING_LIST_TYPE               (gmyth_string_list_get_type ())
    1.47 +#define GMYTH_STRING_LIST(obj)               (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_STRING_LIST_TYPE, GMythStringList))
    1.48 +#define GMYTH_STRING_LIST_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_STRING_LIST_TYPE, GMythStringListClass))
    1.49 +#define IS_GMYTH_STRING_LIST(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GMYTH_STRING_LIST_TYPE))
    1.50 +#define IS_GMYTH_STRING_LIST_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), GMYTH_STRING_LIST_TYPE))
    1.51 +#define GMYTH_STRING_LIST_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GMYTH_STRING_LIST_TYPE, GMythStringListClass))
    1.52 +
    1.53 +
    1.54 +typedef struct _GMythStringList         GMythStringList;
    1.55 +typedef struct _GMythStringListClass    GMythStringListClass;
    1.56 +
    1.57 +struct _GMythStringListClass
    1.58 +{
    1.59 +  GObjectClass parent_class;
    1.60 +
    1.61 +  /* callbacks */
    1.62 +  /* no one for now */
    1.63 +};
    1.64 +
    1.65 +struct _GMythStringList
    1.66 +{
    1.67 +    GObject parent;
    1.68 +
    1.69 +    /* string list */
    1.70 +    GList *glist;  
    1.71 +};
    1.72 +
    1.73 +
    1.74 +GType               gmyth_string_list_get_type (void);
    1.75 +
    1.76 +GMythStringList *   gmyth_string_list_new (void);
    1.77 +
    1.78 +void                gmyth_string_list_clear_all (GMythStringList *strlist);
    1.79 +int                 gmyth_string_list_length (GMythStringList *strlist);
    1.80 +
    1.81 +GString *           gmyth_string_list_append_int (GMythStringList *strlist, 
    1.82 +                                                  const gint value);
    1.83 +GString *           gmyth_string_list_append_uint64 (GMythStringList *strlist, 
    1.84 +                                                     const guint64 value);
    1.85 +
    1.86 +GString *           gmyth_string_list_append_int64 (GMythStringList *strlist, 
    1.87 +                                                     const gint64 value);
    1.88 +
    1.89 +GString *           gmyth_string_list_append_char_array (GMythStringList *strlist, 
    1.90 +                                                         const char* value);
    1.91 +GString *           gmyth_string_list_append_string (GMythStringList *strlist, 
    1.92 +                                                     GString *value);
    1.93 +
    1.94 +int                 gmyth_string_list_get_int (GMythStringList *strlist, const gint index);
    1.95 +guint64             gmyth_string_list_get_uint64 (GMythStringList *strlist, const gint index);
    1.96 +gint64             gmyth_string_list_get_int64 (GMythStringList *strlist, const gint index);
    1.97 +GString *           gmyth_string_list_get_string (GMythStringList *strlist, const gint index);
    1.98 +
    1.99 +#define gmyth_string_list_get_char_array(strlist, index) \
   1.100 +            (gmyth_string_list_get_string(strlist, index))->str
   1.101 +
   1.102 +G_END_DECLS
   1.103 +
   1.104 +#endif /*GMYTH_STRING_LIST_H_*/