gimme-alpha 0.1

textfile_common.h

Go to the documentation of this file.
00001 /*
00002 ** textfile_common.h
00003 * Common routines we want to use when dealing with textfiles.
00004 ** 
00005 ** Made by Johnny Q. Hacker
00006 ** Login   <solarion@borkborkbork>
00007 ** 
00008 
00009     Copyright (C) 2008 Joseph Pingenot
00010 
00011     This program is free software: you can redistribute it and/or modify
00012     it under the terms of the GNU Affero General Public License as published by
00013     the Free Software Foundation, either version 3 of the License, or
00014     (at your option) any later version.
00015 
00016     This program is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU Affero General Public License for more details.
00020 
00021     You should have received a copy of the GNU Affero General Public License
00022     along with this program.  If not, see <http://www.gnu.org/licenses/>.
00023 
00024 ** Started on  Mon Sep 29 16:22:26 2008 Johnny Q. Hacker
00025 ** Last update Mon Sep 29 16:26:10 2008 Johnny Q. Hacker
00026 */
00027 
00028 #ifndef     TEXTFILE_COMMON_H_
00029 # define    TEXTFILE_COMMON_H_
00030 
00031 #include <glib.h>
00032 #include <gio/gio.h>
00033 #include "gimme_alpha_types.h"
00034 
00035 void prettify_line(char *line, char comment);
00036 
00037 GList *get_key_value_pairs(char* s, const char *delim);
00038 
00039 /*Return a list contaning hashes with the column titles as keys.
00040  *ARGS:
00041  *  istream   input stream to read data from (the first line is the
00042  *              title line, which provides titles to be used in the
00043  *              hashes.  The columns are separated by whitespace.
00044  *              Multiple whitespaces are ignored (i.e. all columns
00045  *              MUST have a value in them.
00046  *  err       pointer to a pointer to hold any error that might occur
00047  *  titles    pointer to a pointer to a GList where the list of titles
00048  *              will be kept.  These are required to get the data out
00049  *              of the hashes.
00050  *RETURNS:
00051  *  a pointer to a GList of hashes which contain the values (double
00052  *     precision float); the keys are the respective column title.
00053  * OR
00054  *  NULL if reading failed.
00055  */
00056 GList* read_titled_whitespaced_data(GInputStream *istream, GError **err, GList **titles, char comment, enum data_types t);
00057 
00058 #endif      /* !TEXTFILE_COMMON_H_ */
 All Classes Files Functions Variables Enumerations Enumerator Defines