Home | Develop | Download | Contact
pdscstring.h
1 /*
2  * pdscstring.h
3  *
4  * Copyright 2011 Fernando Pujaico Rivera <fernando.pujaico.rivera@gmail.com>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19  * MA 02110-1301, USA.
20  *
21  */
22 
30 #ifndef __PDSCSTRING_H__
31 #define __PDSCSTRING_H__
32 
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 #include <stdio.h>
39 
40 #ifndef TRUE
41  #define TRUE 1
42 #endif
43 
44 #ifndef FALSE
45  #define FALSE 0
46 #endif
47 
66 typedef struct
67 {
68  char **data;
69  int Ncell;
71 
86 
87 
95 
97 
98 
113 
114 
123 int pds_cell_string_all_fprintf(FILE* fd,const PdsCellString *C);
124 
126 
127 
143 int pds_cell_string_add(PdsCellString *C,const char* string_data);
144 
145 
160 
162 
178 int pds_cell_string_write(PdsCellString *C,int id,const char* string_data);
179 
180 
190 int pds_cell_string_read(const PdsCellString* C,int id,char** string_data);
191 
192 
203 
205 
206 
221 
222 
232 
242 char * pds_cell_string_joint(const PdsCellString *C);
243 
244 
258 char * pds_cell_string_joint_with_end(const PdsCellString *C,char s);
259 
260 
262 
277 int pds_cell_string_save(const char* pathname,const PdsCellString *C);
278 
286 PdsCellString *pds_cell_string_new_load(const char*filepath);
287 
289 
309 
311 
327 int pds_cell_string_find(const PdsCellString *C,const char *str);
328 
329 
339 int pds_cell_string_findci(const PdsCellString *C,const char *str);
340 
341 
342 
353 int pds_cell_string_findci_and_add(PdsCellString *C,const char* string_data);
354 
355 
364 int pds_cell_string_find_and_remove(PdsCellString *C,const char *str);
365 
366 
376 int pds_cell_string_findci_and_remove(PdsCellString *C,const char *str);
377 
379 
393 
394 
402 
404 
405 
410 #ifdef __cplusplus
411 }
412 #endif
413 
414 #endif /* __PDSCSTRING_H__ */
415 
int pds_cell_string_get_ncell(const PdsCellString *C)
Cuenta la cantidad de células incluyendo las vacías.
int pds_cell_string_add(PdsCellString *C, const char *string_data)
Agrega un elemento en la ultima posición vacía(NULL) del arreglo de células. O agrega un nuevo regist...
int pds_cell_string_save(const char *pathname, const PdsCellString *C)
Imprime en el archivo los datos del arreglo de células de tipo puntero PdsCellString. Escribe un dato por cada linea.
int pds_cell_string_findci(const PdsCellString *C, const char *str)
Retorna el id de la primera ocurrencia de la cadena str en el arreglo de células C. La función es case-insensitive.
int pds_cell_string_find(const PdsCellString *C, const char *str)
Retorna el id de la primera ocurrencia de la cadena str en el arreglo de células C.
int pds_cell_string_all_printf(const PdsCellString *C)
Imprime en pantalla los datos del arreglo de células de tipo puntero PdsCellString. Escribe un dato por cada linea.
int pds_cell_string_findci_and_remove(PdsCellString *C, const char *str)
Procura todas las células con cadenas igual a str y las remueve.
int pds_cell_string_filter_orinc(PdsCellString *C, const PdsCellString *pattern)
Remueve las células que no cumplen con por lo menos un patrón especificado por pattern.
int pds_cell_string_get_last_empty(const PdsCellString *C)
Retorna el id de la última célula libre (osea con NULL).
void pds_cell_string_destroy(PdsCellString **C)
Libera un arreglo de células de tipo puntero PdsCellString y carga con NULL.
void pds_cell_string_free(PdsCellString *C)
Libera un arreglo de células de tipo puntero PdsCellString.
int pds_cell_string_find_and_remove(PdsCellString *C, const char *str)
Procura todas las células con cadenas igual a str y las remueve.
PdsCellString * pds_cell_string_new_copy(const PdsCellString *Cin)
Crea un arreglo de células de tipo PdsCellString copiando los datos de otra.
int pds_cell_string_add_cell_string(PdsCellString *C, const PdsCellString *Cin)
Agrega un conjunto de elementos a partir de la última posición vacía (NULL) del arreglo de células (Y...
int pds_cell_string_read(const PdsCellString *C, int id, char **string_data)
Lee una cadena de texto, en la posición id del arreglo de células.
char ** data
Definition: pdscstring.h:68
PdsCellString * pds_cell_string_new(int N)
Crea un arreglo de células de tipo PdsCellString con N elementos vacíos (NULL).
PdsCellString * pds_cell_string_new_load(const char *filepath)
Crea un arreglo de células de tipo PdsCellString con los datos de cada linea del archivo.
int pds_cell_string_remove(PdsCellString *C, int id)
Remueve la célula de posición id.
Una estructura tipo PdsCellString . Esta estructura genera un arreglo de células con de cadenas te te...
Definition: pdscstring.h:66
char * pds_cell_string_joint_with_end(const PdsCellString *C, char s)
Retorna una nueva cadena de texto con los valores de la PdsCellString concatenados agregando el delim...
int pds_cell_string_findci_and_add(PdsCellString *C, const char *string_data)
Agrega un nuevo registro de memoria si la cadena string_data no existe en la estructura *C...
char * pds_cell_string_joint(const PdsCellString *C)
Retorna una nueva cadena de texto con los valores de la PdsCellString concatenados.
int pds_cell_string_write(PdsCellString *C, int id, const char *string_data)
Escribe un dato de tipo char* en el elemento id del arreglo de células.
int pds_cell_string_all_fprintf(FILE *fd, const PdsCellString *C)
Imprime en el descriptor de fichero los datos del arreglo de células de tipo puntero PdsCellString...

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed