Sha256: 77e74e289d7fd0aa5daec7d0f9101ef4057eb7ef5c0e7c2d50169955df4a220c

Contents?: true

Size: 1014 Bytes

Versions: 5

Compression:

Stored size: 1014 Bytes

Contents

//
//  refract/ComparableVisitor.cc
//  librefract
//
//  Created by Jiri Kratochvil on 21/05/15.
//  Copyright (c) 2015 Apiary Inc. All rights reserved.
//
#include "Element.h"
#include "ComparableVisitor.h"

namespace refract
{

    ComparableVisitor::ComparableVisitor(const std::string& str, const int compare) : compare_to(str), result(false), compare(compare)
    {
    }

    void ComparableVisitor::operator()(const MemberElement& e)
    {
        ComparableVisitor v(compare_to);
        Visitor visitor(v);

        if (compare == key && e.value.first) {
            e.value.first->content(visitor);
        }
        else if (e.value.second) {
            e.value.second->content(visitor);
        }

        result = v.get();
    }

    void ComparableVisitor::operator()(const IElement& e)
    {
        throw LogicError("Fallback impl - behavioration for Base class IElement is not defined");
    }

    bool ComparableVisitor::get() const
    {
        return result;
    }

}; // namespace refract

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
lounge_lizard-0.1.4 ext/drafter/src/refract/ComparableVisitor.cc
lounge_lizard-0.1.3 ext/drafter/src/refract/ComparableVisitor.cc
lounge_lizard-0.1.2 ext/drafter/src/refract/ComparableVisitor.cc
lounge_lizard-0.1.1 ext/drafter/src/refract/ComparableVisitor.cc
lounge_lizard-0.1.0 ext/drafter/src/refract/ComparableVisitor.cc