Add libwx-perl
[pkg-perl] / deb-src / libwx-perl / libwx-perl-0.96 / XS / Config.xs
1 #############################################################################
2 ## Name:        XS/Config.xs
3 ## Purpose:     XS for Wx::*Config*
4 ## Author:      Mattia Barbon
5 ## Modified by:
6 ## Created:     13/12/2001
7 ## RCS-ID:      $Id: Config.xs 2299 2007-11-25 17:30:04Z mbarbon $
8 ## Copyright:   (c) 2001-2002, 2004, 2007 Mattia Barbon
9 ## Licence:     This program is free software; you can redistribute it and/or
10 ##              modify it under the same terms as Perl itself
11 #############################################################################
12
13 #include <wx/confbase.h>
14
15 MODULE=Wx PACKAGE=Wx::ConfigBase
16
17 void
18 wxConfigBase::Destroy()
19   CODE:
20     delete THIS;
21
22 wxConfigBase*
23 Create()
24   CODE:
25     RETVAL = wxConfigBase::Create();
26   OUTPUT:
27     RETVAL
28
29 void
30 DontCreateOnDemand()
31   CODE:
32     wxConfigBase::DontCreateOnDemand();
33
34 bool
35 wxConfigBase::DeleteAll()
36
37 bool
38 wxConfigBase::DeleteEntry( key, deleteGroupIfEmpty = true )
39     wxString key
40     bool deleteGroupIfEmpty
41
42 bool
43 wxConfigBase::DeleteGroup( key )
44     wxString key
45
46 bool
47 wxConfigBase::Exists( key )
48     wxString key
49
50 bool
51 wxConfigBase::Flush( currentOnly = false )
52     bool currentOnly
53
54 wxConfigBase*
55 Get( createOnDemand = true )
56     bool createOnDemand
57   CODE:
58     RETVAL = wxConfigBase::Get( createOnDemand );
59   OUTPUT:
60     RETVAL
61
62 wxString
63 wxConfigBase::GetAppName()
64
65 EntryType
66 wxConfigBase::GetEntryType( name )
67     wxString name
68
69 void
70 wxConfigBase::GetFirstEntry()
71   PREINIT:
72     wxString name;
73     long index;
74     bool ret;
75   PPCODE:
76     ret = THIS->GetFirstEntry( name, index );
77     EXTEND( SP, 3 );
78     PUSHs( sv_2mortal( newSViv( ret ) ) );
79     SV* tmp = newSViv( 0 );
80     WXSTRING_OUTPUT( name, tmp );
81     PUSHs( sv_2mortal( tmp ) );
82     PUSHs( sv_2mortal( newSViv( index ) ) );
83
84 void
85 wxConfigBase::GetFirstGroup()
86   PREINIT:
87     wxString name;
88     long index;
89     bool ret;
90   PPCODE:
91     ret = THIS->GetFirstGroup( name, index );
92     EXTEND( SP, 3 );
93     PUSHs( sv_2mortal( newSViv( ret ) ) );
94     SV* tmp = newSViv( 0 );
95     WXSTRING_OUTPUT( name, tmp );
96     PUSHs( sv_2mortal( tmp ) );
97     PUSHs( sv_2mortal( newSViv( index ) ) );
98
99 void
100 wxConfigBase::GetNextEntry( index )
101     long index
102   PREINIT:
103     wxString name;
104     bool ret;
105   PPCODE:
106     ret = THIS->GetNextEntry( name, index );
107     EXTEND( SP, 3 );
108     PUSHs( sv_2mortal( newSViv( ret ) ) );
109     SV* tmp = newSViv( 0 );
110     WXSTRING_OUTPUT( name, tmp );
111     PUSHs( sv_2mortal( tmp ) );
112     PUSHs( sv_2mortal( newSViv( index ) ) );
113
114 void
115 wxConfigBase::GetNextGroup( index )
116     long index
117   PREINIT:
118     wxString name;
119     bool ret;
120   PPCODE:
121     ret = THIS->GetNextGroup( name, index );
122     EXTEND( SP, 3 );
123     PUSHs( sv_2mortal( newSViv( ret ) ) );
124     SV* tmp = newSViv( 0 );
125     WXSTRING_OUTPUT( name, tmp );
126     PUSHs( sv_2mortal( tmp ) );
127     PUSHs( sv_2mortal( newSViv( index ) ) );
128
129 unsigned int
130 wxConfigBase::GetNumberOfEntries( recursive = false )
131     bool recursive
132
133 unsigned int
134 wxConfigBase::GetNumberOfGroups( recursive = false )
135     bool recursive
136
137 wxString
138 wxConfigBase::GetPath()
139
140 wxString
141 wxConfigBase::GetVendorName()
142
143 bool
144 wxConfigBase::HasEntry( name )
145     wxString name
146
147 bool
148 wxConfigBase::HasGroup( name )
149     wxString name
150
151 bool
152 wxConfigBase::IsExpandingEnvVars()
153
154 bool
155 wxConfigBase::IsRecordingDefaults()
156
157 wxString
158 wxConfigBase::Read( key, def = wxEmptyString )
159     wxString key
160     wxString def
161   CODE:
162     THIS->Read( key, &RETVAL, def );
163   OUTPUT:
164     RETVAL
165
166 long
167 wxConfigBase::ReadInt( key, def = 0 )
168     wxString key
169     long def
170   CODE:
171     THIS->Read( key, &RETVAL, def );
172   OUTPUT:
173     RETVAL
174
175 #if WXPERL_W_VERSION_GE( 2, 9, 0 )
176
177 long
178 wxConfigBase::ReadLong( key, def = 0 )
179     wxString key
180     long def
181
182 double
183 wxConfigBase::ReadDouble( key, def = 0.0 )
184     wxString key
185     double def
186
187 bool
188 wxConfigBase::ReadBool( key, def = false )
189     wxString key
190     bool def
191
192 #else
193
194 bool
195 wxConfigBase::ReadBool( key, def = false )
196     wxString key
197     bool def
198   CODE:
199     THIS->Read( key, &RETVAL, def );
200   OUTPUT:
201     RETVAL
202
203 #endif
204
205 #if WXPERL_W_VERSION_GE( 2, 9, 0 ) && wxUSE_BASE64
206
207 SV*
208 wxConfigBase::ReadBinary( key )
209     wxString key
210   CODE:
211     wxMemoryBuffer data;
212     THIS->Read( key, &data );
213     RETVAL = newSVpvn( (const char*)data.GetData(), data.GetDataLen() );
214   OUTPUT:
215     RETVAL
216
217 #endif
218
219 bool
220 wxConfigBase::RenameEntry( oldName, newName )
221      wxString oldName
222      wxString newName
223
224 bool
225 wxConfigBase::RenameGroup( oldName, newName )
226      wxString oldName
227      wxString newName
228
229 void
230 Set( config )
231     wxConfigBase* config
232   CODE:
233     wxConfigBase::Set( config );
234
235 void
236 wxConfigBase::SetExpandEnvVars( doIt = true )
237     bool doIt
238
239 void
240 wxConfigBase::SetPath( path )
241     wxString path
242
243 void
244 wxConfigBase::SetRecordDefaults( doIt = true )
245     bool doIt
246
247 void
248 wxConfigBase::Write( key, value )
249     wxString key
250     wxString value
251   CODE:
252     THIS->Write( key, value );
253
254 void
255 wxConfigBase::WriteInt( key, value )
256     wxString key
257     long value
258   CODE:
259     THIS->Write( key, value );
260
261 void
262 wxConfigBase::WriteFloat( key, value )
263     wxString key
264     double value
265   CODE:
266     THIS->Write( key, value );
267
268 void
269 wxConfigBase::WriteBool( key, value )
270     wxString key
271     bool value
272   CODE:
273     THIS->Write( key, value );
274
275 #if WXPERL_W_VERSION_GE( 2, 9, 0 ) && wxUSE_BASE64
276
277 void
278 wxConfigBase::WriteBinary( key, value )
279     wxString key
280     SV* value
281   CODE:
282     STRLEN len;
283     char* buffer = SvPV( value, len );
284     wxMemoryBuffer data( len );
285     data.SetDataLen( len );
286     memcpy( data.GetData(), buffer, len );
287     THIS->Write( key, data );
288
289 #endif
290
291 MODULE=Wx PACKAGE=Wx::RegConfig
292
293 #if defined(__WXMSW__)
294
295 #include <wx/msw/regconf.h>
296
297 wxConfigBase*
298 wxRegConfig::new( appName = wxEmptyString, vendorName = wxEmptyString, localFilename = wxEmptyString, globalFilename = wxEmptyString, style = 0 )
299     wxString appName
300     wxString vendorName
301     wxString localFilename
302     wxString globalFilename
303     long style
304
305 #endif
306
307 MODULE=Wx PACKAGE=Wx::FileConfig
308
309 #include <wx/fileconf.h>
310
311 wxConfigBase*
312 wxFileConfig::new( appName = wxEmptyString, vendorName = wxEmptyString, localFilename = wxEmptyString, globalFilename = wxEmptyString, style = 0 )
313     wxString appName
314     wxString vendorName
315     wxString localFilename
316     wxString globalFilename
317     long style
318
319 void
320 wxFileConfig::SetUmask( mode )
321     int mode