]> git.xonotic.org Git - xonotic/netradiant.git/blobdiff - include/preferencesystem.h
Initial python support
[xonotic/netradiant.git] / include / preferencesystem.h
index 45678024ffd8ec0a6df23e509a7d708fc8ed5369..6479ec91d32e7adabafc1d654d5b85611717754c 100644 (file)
 #define INCLUDED_PREFERENCESYSTEM_H
 
 #include "generic/constant.h"
-#include "generic/callbackfwd.h"
+#include "generic/callback.h"
+#include "property.h"
 
-typedef Callback1<const char*> StringImportCallback;
-typedef Callback1<const StringImportCallback&> StringExportCallback;
-
-class PreferenceSystem
-{
+class PreferenceSystem {
 public:
-INTEGER_CONSTANT( Version, 1 );
-STRING_CONSTANT( Name, "preferences" );
+       INTEGER_CONSTANT(Version, 1);
+       STRING_CONSTANT(Name, "preferences");
 
-virtual void registerPreference( const char* name, const StringImportCallback& importer, const StringExportCallback& exporter ) = 0;
+       virtual void registerPreference(const char *name, const Property<const char *> &cb) = 0;
 };
 
+template<class Self>
+Property<const char *> make_property_string(Self &it) {
+       return make_property<PropertyAdaptor<Self, const char *>>(it);
+}
+
+template<class I, class Self>
+Property<const char *> make_property_string(Self &it) {
+       return make_property_chain<PropertyImpl<detail::propertyimpl_other<I>, const char *>, I>(it);
+}
+
+template<class I>
+Property<const char *> make_property_string() {
+       return make_property_chain<PropertyImpl<detail::propertyimpl_other_free<I>, const char *>, I>();
+}
+
 #include "modulesystem.h"
 
 template<typename Type>