| 2620 | } |
| 2621 | |
| 2622 | std::set<std::string> Parser::GetIncludedFilesRecursive( |
| 2623 | const std::string &file_name) const { |
| 2624 | std::set<std::string> included_files; |
| 2625 | std::list<std::string> to_process; |
| 2626 | |
| 2627 | if (file_name.empty()) return included_files; |
| 2628 | to_process.push_back(file_name); |
| 2629 | |
| 2630 | while (!to_process.empty()) { |
| 2631 | std::string current = to_process.front(); |
| 2632 | to_process.pop_front(); |
| 2633 | included_files.insert(current); |
| 2634 | |
| 2635 | // Workaround the lack of const accessor in C++98 maps. |
| 2636 | auto &new_files = |
| 2637 | (*const_cast<std::map<std::string, std::set<std::string>> *>( |
| 2638 | &files_included_per_file_))[current]; |
| 2639 | for (auto it = new_files.begin(); it != new_files.end(); ++it) { |
| 2640 | if (included_files.find(*it) == included_files.end()) |
| 2641 | to_process.push_back(*it); |
| 2642 | } |
| 2643 | } |
| 2644 | |
| 2645 | return included_files; |
| 2646 | } |
| 2647 | |
| 2648 | // Schema serialization functionality: |
| 2649 |
no test coverage detected