=== modified file 'src/composite-test.cc'
@@ -26,6 +26,7 @@
#include "log.h"
using std::string;
+using std::map;
const string CompositeTest::model_view_matrix_name_("modelview");
const string CompositeTest::projection_matrix_name_("projection");
@@ -219,3 +220,30 @@
{
program_.stop();
}
+
+bool
+CompositeTest::set_option(const string &opt, const string &val)
+{
+ map<string, Option>::iterator iter = options_.find(opt);
+
+ if (iter == options_.end())
+ return false;
+
+ iter->second.value = val;
+
+ return true;
+}
+
+void
+CompositeTest::reset_options()
+{
+ for (map<string, Option>::iterator iter = options_.begin();
+ iter != options_.end();
+ iter++)
+ {
+ Option &opt = iter->second;
+
+ opt.value = opt.default_value;
+ }
+}
+
=== modified file 'src/composite-test.h'
@@ -26,6 +26,7 @@
#include <string>
#include <list>
+#include <map>
#include "stack.h"
#include "program.h"
#include "composite-window.h"
@@ -44,6 +45,21 @@
virtual void cleanup();
virtual void reshape(int width, int height);
const std::string& name() const { return name_; }
+
+ struct Option {
+ Option(const std::string &name, const std::string &val, const std::string &desc) :
+ name(name), value(val), default_value(val), description(desc) {}
+ Option() {}
+ std::string name;
+ std::string value;
+ std::string default_value;
+ std::string description;
+ };
+
+ bool set_option(const std::string &opt, const std::string &val);
+ void reset_options();
+ const std::map<std::string, Option> &options() { return options_; }
+
protected:
CompositeTest();
//
@@ -55,6 +71,7 @@
//
int num_visible_windows(std::list<CompositeWindow *> &window_list);
std::string name_;
+ std::map<std::string, Option> options_;
Program program_;
std::string vertex_shader_;
std::string fragment_shader_;