Skip to content

Commit

Permalink
[YAMLIO] Add the ability to map with context.
Browse files Browse the repository at this point in the history
mapping a yaml field to an object in code has always been
a stateless operation.  You could still pass state by using the
`setContext` function of the YAMLIO object, but this represented
global state for the entire yaml input.  In order to have
context-sensitive state, it is necessary to pass this state in
at the granularity of an individual mapping.

This patch adds support for this type of context-sensitive state.
You simply pass an additional argument of type T to the
`mapRequired` or `mapOptional` functions, and provided you have
specialized a `MappingContextTraits<U, T>` class with the
appropriate mapping function, you can pass this context into
the mapping function.

Reviewed By: chandlerc
Differential Revision: https://reviews.llvm.org/D24162

llvm-svn: 280977
  • Loading branch information
Zachary Turner committed Sep 8, 2016
1 parent ba7c5cf commit 35377f8
Show file tree
Hide file tree
Showing 3 changed files with 263 additions and 102 deletions.

0 comments on commit 35377f8

Please sign in to comment.