| 35 | BOOST_PARSER_DEFINE_RULES(quoted_string, employee_p); |
| 36 | |
| 37 | int main() |
| 38 | { |
| 39 | std::cout << "Enter employee record. "; |
| 40 | std::string input; |
| 41 | std::getline(std::cin, input); |
| 42 | |
| 43 | static_assert(std::is_aggregate_v<std::decay_t<employee &>>); |
| 44 | |
| 45 | auto const result = bp::parse(input, employee_p, bp::ws); |
| 46 | |
| 47 | if (result) { |
| 48 | std::cout << "You entered:\nage: " << result->age |
| 49 | << "\nsurname: " << result->surname |
| 50 | << "\nforename: " << result->forename |
| 51 | << "\nsalary : " << result->salary << "\n"; |
| 52 | } else { |
| 53 | std::cout << "Parse failure.\n"; |
| 54 | } |
| 55 | } |
| 56 | //] |