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 | 4a58ce6 | 2020-05-14 17:58:10 +0200 | [diff] [blame^] | 13 | |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 14 | struct ParserContext { |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 15 | 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] | 16 | schemaPath_ currentSchemaPath(); |
| 17 | dataPath_ currentDataPath(); |
| 18 | void clearPath(); |
| 19 | void pushPathFragment(const dataNode_& node); |
| 20 | void pushPathFragment(const schemaNode_& node); |
| 21 | void resetPath(); |
| 22 | |
Václav Kubernát | 48fc383 | 2018-05-28 14:21:22 +0200 | [diff] [blame] | 23 | const Schema& m_schema; |
Václav Kubernát | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 24 | const dataPath_ m_curPathOrig; |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 25 | const std::shared_ptr<const DataQuery> m_dataquery; |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 26 | boost::optional<std::string> m_curModule; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 27 | std::string m_errorMsg; |
| 28 | std::string m_tmpListName; |
Václav Kubernát | 744f57f | 2018-06-29 22:46:26 +0200 | [diff] [blame] | 29 | bool m_topLevelModulePresent = false; |
Václav Kubernát | 7707cae | 2020-01-16 12:04:53 +0100 | [diff] [blame] | 30 | |
| 31 | struct { |
| 32 | schemaPath_ m_location; |
| 33 | ModuleNodePair m_node; |
| 34 | } m_tmpListKeyLeafPath; |
Václav Kubernát | 3a99f00 | 2020-03-31 02:27:41 +0200 | [diff] [blame] | 35 | |
Václav Kubernát | 43908fb | 2020-01-02 19:05:51 +0100 | [diff] [blame] | 36 | std::map<std::string, leaf_data_> m_tmpListKeys; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 37 | bool m_errorHandled = false; |
Václav Kubernát | ac035d6 | 2019-02-18 10:59:08 +0100 | [diff] [blame] | 38 | bool m_completing = false; |
Václav Kubernát | cb3af40 | 2020-02-12 16:49:17 +0100 | [diff] [blame] | 39 | |
| 40 | std::set<Completion> m_suggestions; |
Václav Kubernát | 4108e0d | 2018-10-29 13:32:22 +0100 | [diff] [blame] | 41 | // Iterator pointing to where suggestions were created |
Václav Kubernát | 1ed4aa3 | 2020-01-23 13:13:28 +0100 | [diff] [blame] | 42 | boost::optional<std::string::const_iterator> m_completionIterator; |
Václav Kubernát | 72749c6 | 2020-01-03 16:47:34 +0100 | [diff] [blame] | 43 | |
| 44 | private: |
| 45 | boost::variant<dataPath_, schemaPath_> m_curPath; |
Václav Kubernát | 195eeea | 2018-05-18 13:52:36 +0200 | [diff] [blame] | 46 | }; |