/* I'd rather have overloads with different slots, but that creates an
ambiguity because slots have template constructors. */
-BooleanEvaluator::BooleanEvaluator(const Slot &s, bool allow_compare):
- slot(s),
+BooleanEvaluator::BooleanEvaluator(const Function &f, bool allow_compare):
+ func(f),
ops(allow_compare ? "&|!=^" : "&|!")
{ }
op_stack.pop_back();
string var = var_stack.back();
var_stack.pop_back();
- bool value = (slot(var, &buf) == (op=='='));
+ bool value = (func(var, &buf) == (op=='='));
value_stack.push_back(value);
}
else
{
string var = var_stack.back();
var_stack.pop_back();
- return slot(var, 0);
+ return func(var, 0);
}
else if(!value_stack.empty())
{
#ifndef BOOLEANEVALUATOR_H_
#define BOOLEANEVALUATOR_H_
+#include <functional>
#include <string>
#include <vector>
-#include <sigc++/slot.h>
class BooleanEvaluator
{
public:
- typedef sigc::slot<bool, const std::string &, const std::string *> Slot;
+ using Function = std::function<bool(const std::string &, const std::string *)>;
private:
- Slot slot;
+ Function func;
std::string ops;
std::vector<std::string> var_stack;
std::vector<unsigned char> value_stack;
bool last_was_op;
public:
- BooleanEvaluator(const Slot &, bool = true);
+ BooleanEvaluator(const Function &, bool = true);
bool evaluate(const std::string &);
private:
void ArchitectureConditional::if_arch(const string &cond)
{
- BooleanEvaluator eval(sigc::hide<1>(sigc::mem_fun(&builder.get_current_arch(), &Architecture::match_name)), false);
+ const Architecture &arch = builder.get_current_arch();
+ BooleanEvaluator eval([&arch](const string &value, const string *){ return arch.match_name(value); }, false);
bool match = eval.evaluate(cond);
builder.get_logger().log("configure", format("%s: arch %s %smatched", log_prefix, cond, (match ? "" : "not ")));
if(match)
void FeatureConditional::if_feature(const string &cond)
{
- BooleanEvaluator eval(sigc::mem_fun(&package, &SourcePackage::match_feature));
+ BooleanEvaluator eval([this](const string &feat, const string *value){ return package.match_feature(feat, value); });
bool match = eval.evaluate(cond);
package.get_builder().get_logger().log("configure", format("%s: feature %s %smatched", log_prefix, cond, (match ? "" : "not ")));
if(match)