aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/swig/swconfig.i
diff options
context:
space:
mode:
authordanglassey <danglassey>2002-08-14 09:57:17 +0000
committerdanglassey <danglassey>2002-08-14 09:57:17 +0000
commitdaa67ff1f728c07f2a116ee9a9f4505479ca6808 (patch)
treec224a537d30480002ae0560cc9104b543b4d1b5e /bindings/swig/swconfig.i
parent6d6973e035aac5ec1676efccd5b8ada70c40b639 (diff)
downloadsword-sf-cvs-import-1.1.1.tar.gz
Initial import from crosswire CVS for syncingimport-1.1.1
Diffstat (limited to 'bindings/swig/swconfig.i')
-rw-r--r--bindings/swig/swconfig.i42
1 files changed, 42 insertions, 0 deletions
diff --git a/bindings/swig/swconfig.i b/bindings/swig/swconfig.i
new file mode 100644
index 0000000..a934ffc
--- /dev/null
+++ b/bindings/swig/swconfig.i
@@ -0,0 +1,42 @@
+%{
+ #include <stdio.h>
+ #include <string>
+ #include <map>
+ #include <defs.h>
+ #include <multimapwdef.h>
+
+ #include "swconfig.h"
+%}
+
+%include "stl.i"
+%include "std_vector.i"
+%include "std_string.i"
+%include "typemaps.i"
+
+
+typedef multimapwithdefault < string, string, less < string > > ConfigEntMap;
+typedef map < string, ConfigEntMap, less < string > > SectionMap;
+
+class SWConfig {
+public:
+ //member data
+ string filename;
+ SectionMap Sections;
+
+ //member functions
+ SWConfig(const char *ifilename);
+ virtual ~ SWConfig();
+
+ virtual void Load();
+ virtual void Save();
+
+%extend {
+ void set(const char* group, const char* entry, const char* value) {
+ self->Sections[group][entry] = value;
+ };
+ const char* get(const char* group, const char* entry) {
+ return self->Sections[group][entry].c_str();
+ };
+}
+
+};