/* $ 17:59 4.10.2008
 *
 * Tiny ConfigFile Parser (TCPF) 0.0.1 PRE ALPHA
 *
 * Author: Tiiffi
 *
 * Contact: http://tiiffi.ath.cx
 *          tiiffi @ Quakenet
 *          tiiffi -> gmail.com 
 *
 *
 * file:        tcfp_parser.h
 * description: tcfp parser headers.       
 *
 * =============================================================================
 *
 * This file is part of Tiny ConfigFile Parser (TCPF).
 *
 * Tiny ConfigFile Parser (TCPF) is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Tiny ConfigFile Parser (TCPF) is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Tiny ConfigFile Parser (TCPF).  If not, see <http://www.gnu.org/licenses/>.
 *
 * =============================================================================
 */



#ifndef _CFG_PARSER_H_
#define _CFG_PARSER_H_

#ifdef __cplusplus
extern "C"{
#endif


#define VER "0.0.1 PRE-ALPHA"

#define TCFP_config_value   _TCFP_config_value_t
#define TCFP_config_data    _TCFP_config_data_t


/* debug mode (under development) */
#if TCFP_ERROR_STRINGS
enum
{
    /* global errors */
    TCFP_UNKNOWN_ERROR  = -999,

    /* getConfig errors */
    TCFP_NOT_FOUND      = -10,
    TCFP_NO_DELIMITER   = -11,
    TCFP_CFG_EMPTY      = -12,
    TCFP_ALLOC_FAILURE  = -13
};
#endif

#define TCFP_NO_ERROR  0
#define TCFP_ERROR     1


/* cfg data struct */
typedef char _TCFP_config_data_t;

/* cfg item struct */
typedef char _TCFP_config_value_t;




/* get config data from file */
_TCFP_config_data_t *TCFP_load_config(char *cFilename);

/* free config data */ 
void TCFP_free_config_data(_TCFP_config_data_t *config_data);


/* get key value from buffer */
_TCFP_config_value_t *TCFP_get_value(const char *config_data, const char *key, const char delimiter);

/* free key value*/
void TCFP_free_config_value(_TCFP_config_value_t *setdata);




/* debug mode (under development) */
#if TCFP_ERROR_STRINGS
char *TCFP_error_string(int error);
#endif


#ifdef __cplusplus
}
#endif

#endif /* _CFG_PARSER */


/* EOF */