Пример #1
0
void Feature::Visit(IVisitable& visitable)
{
    if (m_pLanguage != nullptr) visitable.Accept(*m_pLanguage);
    visitable.Accept(Tags());
    visitable.Accept(*this);
    if (m_pBackground != nullptr) {
        m_pBackground->Visit(visitable);
    }

    for (ScenarioDefinition* scenario : m_ScenarioDefinitions)
    {
        scenario->Visit(visitable);
    }
}
Пример #2
0
/*
 * main
 */
int main()
{
    GoVisitor v;

    IVisitable * h = new Human;
    IVisitable * f = new Fish;
    IVisitable * b = new Bird;

    h->accept( v );  // Human::walk
    f->accept( v );  // Fish::swim
    b->accept( v );  // Bird::fly

    delete b;
    delete f;
    delete h;
}
Пример #3
0
 bool IsMatch(const IVisitable& o)
 {
   matched_ = nullptr;
   o.Accept(*this);
   return matched_ != nullptr;
 }
Пример #4
0
 PrivateVisitor(IVisitable& v) { v.Accept(*this); }
Пример #5
0
void Example::Visit(IVisitable& visitable)
{
    visitable.Accept(*this);
}