lookup

lookup

Synopsis




                    RLookupTable;
                    RPairTable;
gint                r_lookup_table_str2enum             (RLookupTable *table,
                                                         gchar *str);
gchar*              r_lookup_table_enum2str             (RLookupTable *table,
                                                         gint value);
gchar*              r_lookup_table_str2lbl              (RLookupTable *table,
                                                         gchar *str);
gchar*              r_lookup_table_enum2lbl             (RLookupTable *table,
                                                         gint value);
gint                r_lookup_table_get_pair_left        (RPairTable *table,
                                                         gint item);
gint                r_lookup_table_get_pair_right       (RPairTable *table,
                                                         gint item);
gchar*              r_lookup_table_pair2str             (RPairTable *table,
                                                         gint item);

Description

Details

RLookupTable

typedef struct {
  gchar* str;       /* a string                             */
  gchar* lbl;       /* the string translation               */
  gint   val;       /* the value associated to the string   */
} RLookupTable;


RPairTable

typedef struct {
  gchar* str;       /* a string                       */
  gint   left;      /* first value associated to str  */
  gint   right;     /* second value associated to str */
} RPairTable;


r_lookup_table_str2enum ()

gint                r_lookup_table_str2enum             (RLookupTable *table,
                                                         gchar *str);

look for the value associated to the given string

table :

a RLookupTable

str :

a gchar*

Returns :

a gint

r_lookup_table_enum2str ()

gchar*              r_lookup_table_enum2str             (RLookupTable *table,
                                                         gint value);

look for the string associated to the given value

table :

a RLookupTable

value :

a gint

Returns :

a string

r_lookup_table_str2lbl ()

gchar*              r_lookup_table_str2lbl              (RLookupTable *table,
                                                         gchar *str);

look for the localization associated to the given string

table :

a RLookupTable

str :

a gchar*

Returns :

a gchar*

r_lookup_table_enum2lbl ()

gchar*              r_lookup_table_enum2lbl             (RLookupTable *table,
                                                         gint value);

look for the localization associated to the given value

table :

a RLookupTable

value :

a gint

Returns :

a gchar*

r_lookup_table_get_pair_left ()

gint                r_lookup_table_get_pair_left        (RPairTable *table,
                                                         gint item);

look for the value associated to the given item in the table

table :

a RPairTable

item :

a gint (the right value in the table)

Returns :

a gint

r_lookup_table_get_pair_right ()

gint                r_lookup_table_get_pair_right       (RPairTable *table,
                                                         gint item);

look for the value associated to the given item in the table

table :

a RPairTable

item :

a gint (the left value in the table)

Returns :

a gint

r_lookup_table_pair2str ()

gchar*              r_lookup_table_pair2str             (RPairTable *table,
                                                         gint item);

look for the string associated to the given item in the table

table :

a RPairTable

item :

a gint

Returns :

a gchar*