SchemaParser.hpp 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2017 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef _CONFIG2_CONFIGPARSER_HPP_
  14. #define _CONFIG2_CONFIGPARSER_HPP_
  15. #include <string>
  16. #include <memory>
  17. #include <vector>
  18. #include "SchemaItem.hpp"
  19. #include "Status.hpp"
  20. #include "platform.h"
  21. class DECL_EXPORT SchemaParser
  22. {
  23. public:
  24. SchemaParser(std::shared_ptr<SchemaItem> &pSchema) : m_pSchemaItem(pSchema) { };
  25. virtual ~SchemaParser() { };
  26. virtual bool parse(const std::string &configPath, const std::string &masterConfigFile, const std::vector<std::string> &cfgParms);
  27. const std::string getLastMessage() const { return m_message; }
  28. protected:
  29. virtual bool doParse(const std::string &configPath, const std::string &masterConfigFile, const std::vector<std::string> &cfgParms) = 0;
  30. SchemaParser() { };
  31. std::vector<std::string> split(const std::string &input, const std::string &delim);
  32. protected:
  33. std::shared_ptr<SchemaItem> m_pSchemaItem;
  34. std::string m_message; // a place where a message can be stored and retrieved, such as for a parse error
  35. };
  36. #endif // _CONFIG2_CONFIGPARSER_HPP_