Project

General

Profile

1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
<html xmlns="http://www.w3.org/1999/xhtml">
3
<head>
4
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
5
<title>keyfile: Main Page</title>
6
<link href="tabs.css" rel="stylesheet" type="text/css"/>
7
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
8
</head>
9
<body>
10
<!-- Generated by Doxygen 1.6.3 -->
11
<div class="navigation" id="top">
12
  <div class="tabs">
13
    <ul>
14
      <li class="current"><a href="main.html"><span>Main&nbsp;Page</span></a></li>
15
      <li><a href="annotated.html"><span>Classes</span></a></li>
16
      <li><a href="files.html"><span>Files</span></a></li>
17
    </ul>
18
  </div>
19
</div>
20
<div class="contents">
21
<h1>gKeyfile Documentation</h1></div>
22
<p>gKeyFile is a Scol library based from GLib 2.24 / 2.26.<br />
23
Supported platforms : GNU / Linux and Microsoft Windows</p>
24

    
25
<h2>Installation</h2>
26
<ol>
27
<li>Download the library (MS Windows : <em>gkeyfile.dll</em>, 
28
GNU/Linux : <em>gkeyfile.so</em>) : 
29
</li>
30
<li>Copy it to your scol's plugins directory</li>
31
<li>Edit the <em>usm.ini</em> file and add this line :
32
<div class="fragment"><pre class="fragment">plugin plugins/gkeyfile.dll SCOLloadGKEYFILE SCOLfreeGKEYFILE</pre></div> if you
33
are on MS Windows, or<br />
34
<div class="fragment"><pre class="fragment">plugin ./plugins/gkeyfile.so SCOLloadGKEYFILE SCOLfreeGKEYFILE</pre></div> if you
35
are on GNU/linux.</li>
36
<li>(Re)Launch Scol.</li>
37
</ol>
38
<p>You must have the GLib 2.24 or + library installed on your system. 
39
Only the GLib. <br />
40
More information <a href="http://trac.scolring.org/projects/lib2dgtk/wiki/Installation">here</a> (section : GTK+)</p>
41

    
42
<p>To uninstall, comment or remove the line to the <em>usm.ini</em> file. You can
43
safely delete the *.dll or *.so if you want.</p>
44

    
45
<h2>Introduction</h2>
46
<p>It reads and write a <em>key file</em>, typically a configuration file.</p>
47
<p>This key file can contain groups, keys, values, list of values and localization
48
for each key. It is possible to read and write any comments.<br />
49
Here is an example :</p>
50

    
51
<div class="fragment"><pre class="fragment">
52
# This is an example key-value file
53

    
54
[userconf]
55
# The default value of Name
56
Name=Your pseudo
57
# The french value of Name
58
Name[fr]=Votre pseudonyme
59
# The german value of Name
60
Name[de]=Ihr Spitzname
61
# His/her password
62
Pass=Your passeword
63
Pass[fr]=Votre mot de passe
64
Pass[es]=Contraseña
65
# Identification
66
Login=iri
67
Pwd=1%f5]mfé
68
# Number of connexion, success, fail
69
Conn=12;11;1
70

    
71
# Skin configuration
72
[skin]
73
Name=red
74
Path=app/themes/red/
75
Others=blue;yellow;green;black
76
Position=50;120
77

    
78
# Personnal values
79
[personnal]
80
# integer
81
value=12;4;589;-12;4
82
# float
83
valuef=0.25;4.52
84
</pre></div>
85

    
86
<p>The complete API can be found <a href="scol__glib__keyfile_8c.html#_details">here</a></p>
87

    
88
<p>Here a basic example (with the key file above)</p>
89
<div class="fragment"><pre class="fragment">
90
typeof Ini = ObjKeyFile;;
91

    
92
fun extrcatIniSub (list)=
93
	if list == nil then
94
		0
95
	else
96
		let hd list -> [key value] in
97
		(
98
		_fooS strcatn ".... " :: key :: " : " :: value :: nil;
99
		extrcatIniSub tl list
100
		);;
101

    
102
fun extrcatIni (list)=
103
	if list == nil then
104
		0
105
	else
106
		let hd list -> [group sublist] in
107
		(
108
		_fooS strcat ".. " group;
109
		extrcatIniSub sublist;
110
		extrcatIni tl list
111
		);;
112

    
113
fun main ()=
114
	_showconsole;
115
	
116
	// flag = 3 : we need the localization and the comments
117
	set Ini = _gkeyFileLoadP _channel _checkpack "tests/gkeyfile/test.ini" nil 3;
118
	if Ini == nil then
119
	(
120
		_fooS "The key file could not be loaded !";
121
		0
122
	else
123
	(
124
		// What structure is contained in this file ? It will be displayed in the console
125
		extrcatIni _gkeyFileGetDatas Ini;
126
		// Get somevalues ...
127
		_fooS gkeyFileGetValue Ini "username" "Name" GKF_VALUE_STRING;
128
		_fooS gkeyFileGetLocaleValue Ini "username" "Name" "fr";
129
		// We add a key and few localized values
130
		set Ini = _gkeyFileSetValue Ini "username" "hi" "Welcome" GKF_VALUE_STRING;
131
		set Ini = _gkeyFileSetLocaleValue Ini "username" "hi" "Bonjour !" "fr";
132
		set Ini = _gkeyFileSetLocaleValue Ini "username" "hi" "Benvenuti !" "it";
133
		// We save the strcuture to the key file (it will be overwritten)
134
		_fooId _gkeyFileSave Ini _getmodifypack "tests/gkeyfile/test.ini";
135
		0
136
	);;
137
</pre></div>
138

    
139

    
140
<hr class="footer"/><address style="text-align: right;"><small>Generated on Thu Mar 10 12:50:51 2011 for keyfile by&nbsp;
141
<a href="http://www.doxygen.org/index.html">
142
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
143
</body>
144
</html>
(24-24/45)