Skip to content

jeromerg/NVisitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

74 Commits
 
 
 
 
 
 

Repository files navigation

Status:

Build status NuGet

NVisitor

Framework to develop modular extendable visitors

With NVisitor, you

  • Define visitors for a class family without renouncing to extend the family itself
  • Can pause the visit to process the intermediate result
  • Implement visitors without instrumentalizing the visited class family

NVisitor is entirely type-safe even if it performs lookup by reflection to perform visitor dispatching.

See the initial problem solved by NVisitor: nvisitor-released.

NVisitor is at the core of the test case generator NCase.

Supported type of visitors

Name Visit Signature
ActionVisitor void Visit(Node node)
ActionPayloadVisitor void Visit(Node node, TPayload payload)
FuncVisitor TResult Visit(Node node)
FuncPayloadVisitor TResult Visit(Node node, TPayload payload)
ActionPairVisitor void Visit(Car c, Driver d)
ActionPairPayloadVisitor void Visit(Car c, Driver d, TPayload payload)
FuncPairVisitor TResult Visit(Car c, Driver d)
FuncPayloadPairVisitor TResult Visit(Car c, Driver d, TPayload payload)
LazyVisitor IEnumerable<Pause> Visit(Node node)

Installation

NuGet

Install package : https://www.nuget.org/packages/NVisitor.

GitHub

  • Clone locally this github repository
  • Build the NVisitor.sln solution

Usage

See demo-unit-tests:

Extend it!

The core of NVisitor is the VisitFactory, which resolves the visitor, creates the visit-delegates and caches them. It has been developed with focus on extendability and re-usability. You can easily re-use it to implement alternative visitors, i.e. passing arguments or returning collections...

About

Lightweight Framework to develop modular extendable visitors

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages