Sha256: 7177701ff2b37de02f137bb9e05ff2e3f984ca2e515919afac0521b8b72e0b03

Contents?: true

Size: 1.3 KB

Versions: 2

Compression:

Stored size: 1.3 KB

Contents

//          Copyright Joakim Karlsson & Kim Gräsman 2010-2012.
// Distributed under the Boost Software License, Version 1.0.
//    (See accompanying file LICENSE_1_0.txt or copy at
//          http://www.boost.org/LICENSE_1_0.txt)

#ifndef IGLOO_OREXPRESSION_H
#define IGLOO_OREXPRESSION_H

#include "./expression_fwd.h"
       
namespace snowhouse {

  template< typename LeftExpression, typename RightExpression >
  struct OrExpression : Expression< OrExpression<LeftExpression, RightExpression> >
  {
    OrExpression(const LeftExpression& left, const RightExpression& right)
      : m_left(left)
      , m_right(right)
    {
    }

    template< typename ActualType >
    bool operator()(const ActualType& actual) const
    {
      return (m_left(actual) || m_right(actual));
    }

    LeftExpression m_left;
    RightExpression m_right;
  };

  template< typename LeftExpression, typename RightExpression >
  struct Stringizer< OrExpression<LeftExpression, RightExpression> >
  {
    static std::string ToString(const OrExpression<LeftExpression, RightExpression>& expression)
    {
      std::ostringstream builder;
	  builder << snowhouse::Stringize(expression.m_left) << " or " << snowhouse::Stringize(expression.m_right);

      return builder.str();
    }
  };
}

#endif

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tree-sitter-0.1.0 ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/orexpression.h
tree-sitter-0.0.1 ext/tree-sitter/tree-sitter/externals/bandit/bandit/assertion_frameworks/snowhouse/snowhouse/constraints/expressions/orexpression.h