]> git.stg.codes - stg.git/blobdiff - projects/stargazer/plugins/other/smux/smux.cpp
Code deduplication (plugin creation via template PLUGIN_CREATOR)
[stg.git] / projects / stargazer / plugins / other / smux / smux.cpp
index 14f47da3c5e5b21b2f11b9e0a4d3d6fba2982ed6..4629aeab236b97777e051bd09890918922938b27 100644 (file)
 #include <algorithm>
 
 #include "stg/common.h"
+#include "stg/plugin_creator.h"
 
 #include "smux.h"
 #include "utils.h"
 
-class SMUX_CREATOR
-{
-private:
-    SMUX * smux;
-
-public:
-    SMUX_CREATOR() : smux(new SMUX()) {}
-    ~SMUX_CREATOR() { delete smux; }
-
-    SMUX * GetPlugin() { return smux; }
-};
-
-SMUX_CREATOR sac;
+PLUGIN_CREATOR<SMUX> sac;
 
 PLUGIN * GetPlugin()
 {
 return sac.GetPlugin();
 }
 
-int ParseIntInRange(const std::string & str,
-                    int min,
-                    int max,
-                    int * val)
-{
-if (str2x(str.c_str(), *val))
-    {
-    return -1;
-    }
-if (*val < min || *val > max)
-    {
-    return -1;
-    }
-return 0;
-}
-
 SMUX_SETTINGS::SMUX_SETTINGS()
     : ip(0),
       port(0)