plibsys 0.0.5
pinifile.h
Go to the documentation of this file.
1/*
2 * The MIT License
3 *
4 * Copyright (C) 2012-2016 Alexander Saprykin <saprykin.spb@gmail.com>
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining
7 * a copy of this software and associated documentation files (the
8 * 'Software'), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sublicense, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
24 */
25
94#if !defined (PLIBSYS_H_INSIDE) && !defined (PLIBSYS_COMPILATION)
95# error "Header files shouldn't be included directly, consider using <plibsys.h> instead."
96#endif
97
98#ifndef PLIBSYS_HEADER_PINIFILE_H
99#define PLIBSYS_HEADER_PINIFILE_H
100
101#include <pmacros.h>
102#include <ptypes.h>
103#include <plist.h>
104#include <perror.h>
105
107
109typedef struct PIniFile_ PIniFile;
110
118
125
134 PError **error);
135
143
154
166 const pchar *section);
167
177 const pchar *section,
178 const pchar *key);
179
193 const pchar *section,
194 const pchar *key,
195 const pchar *default_val);
196
208 const pchar *section,
209 const pchar *key,
210 pint default_val);
211
223 const pchar *section,
224 const pchar *key,
225 double default_val);
238 const pchar *section,
239 const pchar *key,
240 pboolean default_val);
241
256 const pchar *section,
257 const pchar *key);
258
260
261#endif /* PLIBSYS_HEADER_PINIFILE_H */
Error report system.
struct PError_ PError
Opaque data structure for an error object.
Definition perror.h:68
P_LIB_API PList * p_ini_file_sections(const PIniFile *file)
Gets all the sections from a given file.
P_LIB_API double p_ini_file_parameter_double(const PIniFile *file, const pchar *section, const pchar *key, double default_val)
Gets specified parameter's value as a floating point.
P_LIB_API PIniFile * p_ini_file_new(const pchar *path)
Creates a new PIniFile for parsing.
P_LIB_API pint p_ini_file_parameter_int(const PIniFile *file, const pchar *section, const pchar *key, pint default_val)
Gets specified parameter's value as an integer.
P_LIB_API pboolean p_ini_file_is_parsed(const PIniFile *file)
Checks whether PIniFile was already parsed or not.
P_LIB_API pboolean p_ini_file_parse(PIniFile *file, PError **error)
Parses given PIniFile.
P_LIB_API pboolean p_ini_file_is_key_exists(const PIniFile *file, const pchar *section, const pchar *key)
Checks whether a key exists.
struct PIniFile_ PIniFile
INI file opaque data structure.
Definition pinifile.h:109
P_LIB_API pchar * p_ini_file_parameter_string(const PIniFile *file, const pchar *section, const pchar *key, const pchar *default_val)
Gets specified parameter's value as a string.
P_LIB_API PList * p_ini_file_parameter_list(const PIniFile *file, const pchar *section, const pchar *key)
Gets specified parameter's value as a list of strings separated with the spaces or tabs.
P_LIB_API PList * p_ini_file_keys(const PIniFile *file, const pchar *section)
Gets all the keys from a given section.
P_LIB_API void p_ini_file_free(PIniFile *file)
Frees memory and allocated resources of PIniFile.
P_LIB_API pboolean p_ini_file_parameter_boolean(const PIniFile *file, const pchar *section, const pchar *key, pboolean default_val)
Gets specified parameter's value as a boolean.
Singly linked list.
Miscellaneous macros.
#define P_BEGIN_DECLS
Starts .h file declarations to be exported as C functions.
Definition pmacros.h:298
#define P_END_DECLS
Closes .h file declarations to be exported as C functions, should be always used after P_BEGIN_DECLS.
Definition pmacros.h:299
#define P_LIB_API
Exports a symbol from a shared library.
Definition pmacros.h:138
Types definitions.
char pchar
Type for a char.
Definition ptypes.h:116
int pint
Type for an int.
Definition ptypes.h:120
signed int pboolean
Type for a bool.
Definition ptypes.h:114
Node for a singly linked list.
Definition plist.h:96