Debian Codegraph @

swig/Fl_Preferences.i

raw
1 /* File : Fl_Preferences.i */
2 //%module Fl_Preferences
3
4 %feature("docstring") ::Fl_Preferences
5 """
6 Fl_Preferences provides methods to store user setting between application
7 starts. It is similar to the Registry on WIN32 and Preferences on MacOS,
8 and provides a simple configuration mechanism for UNIX.
9
10 Fl_Preferences uses a hierarchy to store data. It bundles similar data into
11 groups and manages entries into those groups as name/value pairs.
12
13 Preferences are stored in text files that can be edited manually. The file
14 format is easy to read and relatively forgiving. Preferences files are the
15 same on all platforms. User comments in preference files are preserved.
16 Filenames are unique for each application by using a vendor/application
17 naming scheme. The user must provide default values for all entries to
18 ensure proper operation should preferences be corrupted or not yet exist.
19
20 Entries can be of any length. However, the size of each preferences file
21 should be kept under 100k for performance reasons. One application can
22 have multiple preferences files. Extensive binary data however should be
23 stored in seperate files; see the getUserdataPath() method.
24 """ ;
25
26 %{
27 #include "FL/Fl_Preferences.H"
28 %}
29
30 %ignore Fl_Preferences::Fl_Preferences( Fl_Preferences*, const char *group );
31 %ignore Fl_Preferences::Fl_Preferences( const char *path, const char *vendor, const char *application );
32 %ignore Fl_Preferences::set( const char *entry, float value );
33
34 //%include "FL/Fl_Preferences.H"
35
36 %include "cstring.i"
37
38 //%cstring_bounded_output(char *value, 1024);
39 //%apply char *STRING {char *value};
40
41
42 // typemap to map output of Fl_Button.value from char to int
43 %typemap(out) char {
44 $result = PyInt_FromLong( (long)$1);
45 }
46 class FL_EXPORT Fl_Preferences
47 {
48
49 public:
50
51 enum Root { SYSTEM=0, USER };
52 // enum Type { win32, macos, fltk };
53
54 Fl_Preferences( Root root, const char *vendor, const char *application );
55 Fl_Preferences( const char *path, const char *vendor, const char *application );
56 Fl_Preferences( Fl_Preferences&, const char *group );
57 //Fl_Preferences( Fl_Preferences*, const char *group );
58 ~Fl_Preferences();
59
60 int groups();
61 const char *group( int );
62 char groupExists( const char *group );
63 char deleteGroup( const char *group );
64
65 int entries();
66 const char *entry( int );
67 char entryExists( const char *entry );
68 char deleteEntry( const char *entry );
69
70 char set( const char *entry, int value );
71 char set( const char *entry, float value );
72 char set( const char *entry, float value, int precision );
73 char set( const char *entry, double value );
74 char set( const char *entry, double value, int precision );
75 char set( const char *entry, const char *cvalue );
76 char set( const char *entry, const void *cvalue, int size );
77
78 char get( const char *entry, int &OUTPUT, int defaultValue );
79 char get( const char *entry, float &OUTPUT, float defaultValue );
80 char get( const char *entry, double &OUTPUT, double defaultValue );
81 %cstring_bounded_output(char *value, 1024);
82 //char get( const char *entry, char *&value, const char *defaultValue );
83 char get( const char *entry, char *value, const char *defaultValue, int maxSize );
84 //char get( const char *entry, void *&value, const void *defaultValue, int defaultSize );
85 char get( const char *entry, void *value, const void *defaultValue, int defaultSize, int maxSize );
86
87 int size( const char *entry );
88
89
90 %cstring_output_maxsize(char *path, int pathlen);
91 char getUserdataPath( char *path, int pathlen );
92
93 void flush();
94 };
95
96
97 // clear the typemap for char
98 %typemap(out) char;