|
k-dot-p 0.1
|
00001 /* 00002 00003 00004 Copyright (C) 2009 Joseph Pingenot 00005 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU Affero General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU Affero General Public License for more details. 00015 00016 You should have received a copy of the GNU Affero General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00021 #include <glib.h> 00022 00023 #ifndef KEY_VALUES_HXX__ 00024 #define KEY_VALUES_HXX__ 00025 00026 namespace kdotp { 00027 namespace libmodelxx{ 00028 namespace grid { 00029 00030 00031 00032 enum value_type { 00033 STRING, 00034 INT, 00035 FLOAT, 00036 VECTOR, 00037 VECTOR_SET, 00038 SHAPE 00039 }; 00040 00041 union value { 00042 char* s; 00043 int i; 00044 double d; 00045 GList* l; 00046 struct shape_tree* st; 00047 }; 00048 00049 struct key_value { 00050 char* key; 00051 enum value_type t; 00052 union value value; 00053 }; 00054 00055 /** 00056 *Pretty-prints a vector to stderr 00057 *\param l GList storing the vector (data is pointer to double) 00058 */ 00059 void print_vector(GList* l); 00060 00061 /** 00062 *Pretty-prints a list of vectors to stderr 00063 *\param l GList storing the list of vectors (data is pointer to GList of doubles) 00064 */ 00065 void print_vector_list(GList* l); 00066 00067 00068 /** 00069 *Pretty-prints a key/value pair 00070 *\param kvi pointer to key_value struct holding the key/value pair 00071 */ 00072 void print_key_value(const struct key_value* kvi); 00073 00074 /** 00075 *Pretty-prints a list of key/value pairs 00076 *\param l GList storing the list of key/value pairs (data is 00077 *pointer to GList of struct key/value pairs) 00078 */ 00079 void print_key_value_list(GList* l); 00080 00081 /** 00082 *Frees a key/value struct and its data. 00083 */ 00084 void key_value_free(struct key_value *kv); 00085 00086 00087 00088 00089 00090 00091 } 00092 } 00093 } 00094 #endif