Use NList class instead of Zune class (big speed improvement).
[AROS-Contrib.git] / libini / include / ini.h
blobe9ea585d40e624cca8dbcd78b55f90328dfd355f
1 /**********************************************************************************
2 * ini.h
4 * Include file for libini.a. Coding? Include this and link against libini.a.
7 **************************************************
8 * This code was created by Peter Harvey @ CodeByDesign.
9 * Released under LGPL 28.JAN.99
11 * Contributions from...
12 * -----------------------------------------------
13 * Peter Harvey - pharvey@codebydesign.com
14 **************************************************/
16 #ifndef INCLUDED_INI_H
17 #define INCLUDED_INI_H
19 /*********[ CONSTANTS AND TYPES ]**************************************************/
20 #include <stdlib.h>
21 #include <stdio.h>
22 #include <ctype.h>
23 #include <string.h>
25 #ifndef TRUE
26 #define TRUE 1
27 #endif
29 #ifndef FALSE
30 #define FALSE 0
31 #endif
33 #define INI_NO_DATA 2
34 #define INI_SUCCESS 1
35 #define INI_ERROR 0
37 #define INI_MAX_LINE 1000
38 #define INI_MAX_OBJECT_NAME INI_MAX_LINE
39 #define INI_MAX_PROPERTY_NAME INI_MAX_LINE
40 #define INI_MAX_PROPERTY_VALUE INI_MAX_LINE
42 #if HAVE_LIMITS_H
43 #include <limits.h>
44 #endif
46 #ifdef PATH_MAX
47 #define ODBC_FILENAME_MAX PATH_MAX
48 #elif MAXPATHLEN
49 #define ODBC_FILENAME_MAX MAXPATHLEN
50 #else
51 #define ODBC_FILENAME_MAX FILENAME_MAX
52 #endif
54 /********************************************
55 * tINIPROPERTY
57 * Each property line has Name=Value pair.
58 * They are stored in this structure and linked together to provide a list
59 * of all properties for a given Object.
60 ********************************************/
62 typedef struct tINIPROPERTY
64 struct tINIPROPERTY *pNext;
65 struct tINIPROPERTY *pPrev;
67 char szName[INI_MAX_PROPERTY_NAME+1];
68 char szValue[INI_MAX_PROPERTY_VALUE+1];
70 } INIPROPERTY, *HINIPROPERTY;
72 /********************************************
73 * tINIOBJECT
75 * Each object line has just an object name. This structure
76 * stores the object name and its subordinate information.
77 * The lines that follow are considered to be properties
78 * and are stored in a list of tINIPROPERTY.
79 ********************************************/
81 typedef struct tINIOBJECT
83 struct tINIOBJECT *pNext;
84 struct tINIOBJECT *pPrev;
86 char szName[INI_MAX_OBJECT_NAME+1];
88 HINIPROPERTY hFirstProperty;
89 HINIPROPERTY hLastProperty;
90 int nProperties;
92 } INIOBJECT, *HINIOBJECT;
94 /********************************************
95 * tINI
97 * Each INI file contains a list of objects. This
98 * structure stores each object in a list of tINIOBJECT.
99 ********************************************/
101 typedef struct tINI
103 char szFileName[ODBC_FILENAME_MAX+1]; /* FULL INI FILE NAME */
104 char cComment; /* COMMENT CHAR MUST BE IN FIRST COLUMN */
105 char cLeftBracket; /* BRACKETS DELIMIT THE OBJECT NAME, THE LEFT BRACKET MUST BE IN COLUMN ONE */
106 char cRightBracket;
107 char cEqual; /* SEPERATES THE PROPERTY NAME FROM ITS VALUE */
108 int bChanged; /* IF true, THEN THE WHOLE FILE IS OVERWRITTEN UPON iniCommit */
109 int bReadOnly; /* TRUE IF AT LEAST ONE CALL HAS BEEN MADE TO iniAppend() */
111 HINIOBJECT hFirstObject;
112 HINIOBJECT hLastObject;
113 HINIOBJECT hCurObject;
114 int nObjects;
116 HINIPROPERTY hCurProperty;
118 } INI, *HINI;
120 /********************************************
121 * tINIBOOKMARK
123 * Used to store the current Object and Property pointers so
124 * that the caller can quickly return to some point in the
125 * INI data.
126 ********************************************/
128 typedef struct tINIBOOKMARK
130 HINI hIni;
131 HINIOBJECT hCurObject;
132 HINIPROPERTY hCurProperty;
134 } INIBOOKMARK, *HINIBOOKMARK;
136 #if defined(__cplusplus)
137 extern "C" {
138 #endif
140 /*********[ PRIMARY INTERFACE ]*****************************************************/
142 #include "ini_stubs.h"
144 #if defined(__cplusplus)
146 #endif
148 #endif