Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 CESNET, https://photonics.cesnet.cz/ |
| 3 | * Copyright (C) 2018 FIT CVUT, https://fit.cvut.cz/ |
| 4 | * |
| 5 | * Written by Václav Kubernát <kubervac@fit.cvut.cz> |
| 6 | * |
| 7 | */ |
Václav Kubernát | 7a2f396 | 2020-02-14 16:50:26 +0100 | [diff] [blame] | 8 | #pragma once |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 9 | |
Václav Kubernát | cb3af40 | 2020-02-12 16:49:17 +0100 | [diff] [blame] | 10 | #include "completion.hpp" |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 11 | #include "data_query.hpp" |
Václav Kubernát | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 12 | #include "schema.hpp" |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 13 | struct ParserContext { |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 14 | ParserContext(const Schema& schema, const std::shared_ptr<const DataQuery> dataQuery, const dataPath_& curDir); |
Václav Kubernát | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 15 | schemaPath_ currentSchemaPath(); |
| 16 | dataPath_ currentDataPath(); |
| 17 | void clearPath(); |
| 18 | void pushPathFragment(const dataNode_& node); |
| 19 | void pushPathFragment(const schemaNode_& node); |
| 20 | void resetPath(); |
| 21 | |
Václav Kubernát | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 22 | const Schema& m_schema; |
Václav Kubernát | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 23 | const dataPath_ m_curPathOrig; |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 24 | const std::shared_ptr<const DataQuery> m_dataquery; |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 25 | boost::optional<std::string> m_curModule; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 26 | std::string m_errorMsg; |
| 27 | std::string m_tmpListName; |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 28 | bool m_topLevelModulePresent = false; |
Václav Kubernát | 7707cae | 2020-01-16 12:04:53 +0100 | [diff] [blame] | 29 | |
| 30 | struct { |
| 31 | schemaPath_ m_location; |
| 32 | ModuleNodePair m_node; |
| 33 | } m_tmpListKeyLeafPath; |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 34 | std::map<std::string, leaf_data_> m_tmpListKeys; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 35 | bool m_errorHandled = false; |
Václav Kubernát | ac035d6 | 2019-02-18 10:59:08 +0100 | [diff] [blame] | 36 | bool m_completing = false; |
Václav Kubernát | cb3af40 | 2020-02-12 16:49:17 +0100 | [diff] [blame] | 37 | |
| 38 | std::set<Completion> m_suggestions; |
Václav Kubernát | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 39 | // Iterator pointing to where suggestions were created |
Václav Kubernát | 1ed4aa3 | 2020-01-23 13:13:28 +0100 | [diff] [blame] | 40 | boost::optional<std::string::const_iterator> m_completionIterator; |
Václav Kubernát | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 41 | |
| 42 | private: |
| 43 | boost::variant<dataPath_, schemaPath_> m_curPath; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 44 | }; |