Created
December 5, 2018 06:10
-
-
Save fuzz-ai/3b5d09d95700ded0aa2ceb5795812401 to your computer and use it in GitHub Desktop.
fc::json::stringFromStream snippet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| template<typename T> | |
| fc::string stringFromStream( T& in ) | |
| ... | |
| while( true ) | |
| { | |
| switch( c = in.peek() ) | |
| { | |
| case '\\': | |
| token << parseEscape( in ); | |
| break; | |
| case 0x04: | |
| FC_THROW_EXCEPTION( parse_error_exception, "EOF before closing '\"' in string '${token}'", | |
| ("token", token.str() ) ); | |
| case '"': | |
| in.get(); | |
| return token.str(); | |
| default: | |
| token << c; | |
| in.get(); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment