#include <userver/formats/common/conversion_stack.hpp>
Used in the implementation of functions that convert between different formats, e.g. formats::yaml::Value to formats::json::Value, etc.
Does not use recursion, so stack overflow will never happen with deeply nested or wide objects or arrays.
| ValueFrom | the Value type, FROM which we convert, e.g. formats::yaml::Value | 
| ValueToBuilder | the ValueBuilder type, TO which we convert, e.g. formats::json::ValueBuilder | 
How to build the conversion function:
ValueFrom!IsParsed:GetNextFromValueFromGetParsedSee the implementation of PerformMinimalFormatConversion as an example.
Definition at line 47 of file conversion_stack.hpp.
Public Member Functions | |
| ConversionStack (ValueFrom value) | |
Start the conversion from value.   | |
| ConversionStack (ConversionStack &&)=delete | |
| ConversionStack & | operator= (ConversionStack &&)=delete | 
| bool | IsParsed () const | 
| Check whether the whole source ValueFrom has been parsed.   | |
| ValueToBuilder && | GetParsed () && | 
Get the parsing result, precondition: IsParsed().   | |
| const ValueFrom & | GetNextFrom () const | 
Get the current sub-ValueFrom to convert.   | |
| template<typename T > | |
| void | CastCurrentPrimitive () | 
| template<typename T > | |
| void | SetCurrent (T &&value) | 
| void | EnterItems () | 
Use for when an object or an array ValueFrom is encountered.   | |
      
  | 
  inlineexplicit | 
Start the conversion from value. 
Definition at line 50 of file conversion_stack.hpp.
      
  | 
  inline | 
Use for when it's discovered that the current ValueFrom type is available and has the same semantics in ValueFrom and ValueToBuilder, e.g. std::int64_t, std::string, etc. 
Definition at line 81 of file conversion_stack.hpp.
      
  | 
  inline | 
Use for when an object or an array ValueFrom is encountered. 
Definition at line 98 of file conversion_stack.hpp.
      
  | 
  inline | 
Get the current sub-ValueFrom to convert. 
Definition at line 67 of file conversion_stack.hpp.
      
  | 
  inline | 
Get the parsing result, precondition: IsParsed(). 
Definition at line 61 of file conversion_stack.hpp.
      
  | 
  inline | 
Check whether the whole source ValueFrom has been parsed.
Definition at line 58 of file conversion_stack.hpp.
      
  | 
  inline | 
Use for when it's discovered that the current ValueFrom type is not directly convertible to ValueToBuilder, but can be converted manually (this might be an inexact conversion). For example, ValueFrom could have a special representation for datetime, and we manually convert it to string using some arbitrary format. 
Definition at line 92 of file conversion_stack.hpp.