summaryrefslogtreecommitdiff
path: root/project2/cgi
diff options
context:
space:
mode:
authorrandomdan <randomdan@localhost>2011-12-16 19:44:00 +0000
committerrandomdan <randomdan@localhost>2011-12-16 19:44:00 +0000
commit6d0464b7c44084a7a9f28f3becc5f1585b697bf0 (patch)
tree05af7babef544e4832c293d149aa7a33e3181b03 /project2/cgi
parentRemove straggling references to XML and configuration from recent changes (diff)
downloadproject2-6d0464b7c44084a7a9f28f3becc5f1585b697bf0.tar.bz2
project2-6d0464b7c44084a7a9f28f3becc5f1585b697bf0.tar.xz
project2-6d0464b7c44084a7a9f28f3becc5f1585b697bf0.zip
Improvements to the handling of command line arguments
Diffstat (limited to 'project2/cgi')
-rw-r--r--project2/cgi/cgiEnvironment.cpp6
-rw-r--r--project2/cgi/cgiEnvironment.h1
-rw-r--r--project2/cgi/testCgi.cpp16
3 files changed, 22 insertions, 1 deletions
diff --git a/project2/cgi/cgiEnvironment.cpp b/project2/cgi/cgiEnvironment.cpp
index ae7ad52..7b2b254 100644
--- a/project2/cgi/cgiEnvironment.cpp
+++ b/project2/cgi/cgiEnvironment.cpp
@@ -120,6 +120,12 @@ HostnamePlatformIdentifier::reset() const
}
}
+bool
+HostnamePlatformIdentifier::paramRequired() const
+{
+ return true;
+}
+
void
HostnamePlatformIdentifier::consume(const Glib::ustring & p, const Glib::ustring & r) const
{
diff --git a/project2/cgi/cgiEnvironment.h b/project2/cgi/cgiEnvironment.h
index 654f772..28e47d3 100644
--- a/project2/cgi/cgiEnvironment.h
+++ b/project2/cgi/cgiEnvironment.h
@@ -15,6 +15,7 @@ class HostnamePlatformIdentifier : public Options::Target {
HostnamePlatformIdentifier();
virtual ~HostnamePlatformIdentifier();
void reset() const;
+ bool paramRequired() const;
void consume(const Glib::ustring &, const Glib::ustring &) const;
const Glib::ustring & derivedPlatform() const;
private:
diff --git a/project2/cgi/testCgi.cpp b/project2/cgi/testCgi.cpp
index c2e8d4e..855e59b 100644
--- a/project2/cgi/testCgi.cpp
+++ b/project2/cgi/testCgi.cpp
@@ -10,6 +10,20 @@
(name, Options::value(optStore.insert(OptStore::value_type(name, new std::string())).first->second, def), desc)
class TestInput : public cgicc::CgiInput {
public:
+ class TestConfigConsumer : public ConfigConsumer {
+ public:
+ TestConfigConsumer(const Options * os) : o(os) {
+ }
+ void operator()(const Glib::ustring & n, const Glib::ustring & p, const Glib::ustring & v) const {
+ o->consume(n, p, v);
+ }
+ const Options::Option * get(const Glib::ustring &) const {
+ return NULL;
+ }
+ private:
+ const Options * o;
+ };
+
typedef std::string * StrPtr;
typedef std::map<std::string, StrPtr> OptStore;
OptStore optStore;
@@ -45,7 +59,7 @@ class TestInput : public cgicc::CgiInput {
;
FileOptions fo(".testCgi.settings");
opts.reset();
- fo.loadInto(boost::bind(&Options::consume, &opts, _1, _2, _3));
+ fo.loadInto(TestConfigConsumer(&opts));
}
const Options * options() const {