PageRenderTime 172ms CodeModel.GetById 0ms RepoModel.GetById 1ms app.codeStats 0ms

/mordor/yaml.h

http://github.com/mozy/mordor
C Header | 46 lines | 26 code | 12 blank | 8 comment | 0 complexity | e4b49f72398bc5aee27d1ab6eb2ee3f6 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. #ifndef __MORDOR_YAML_H__
  2. #define __MORDOR_YAML_H__
  3. // Copyright (c) 2010 - Mozy, Inc.
  4. #include <string>
  5. #include <boost/shared_ptr.hpp>
  6. #include "exception.h"
  7. #include "json.h"
  8. namespace Mordor {
  9. class Stream;
  10. namespace YAML {
  11. struct Exception : virtual Mordor::Exception
  12. {
  13. public:
  14. Exception(const char *problem, const char *context)
  15. : m_problem(problem),
  16. m_context(context)
  17. {}
  18. const char *what() const throw() { return m_problem; }
  19. private:
  20. const char *m_problem;
  21. const char *m_context;
  22. };
  23. /// @note YAML parser tags all scalar node as a string if not specified explicitly
  24. /// it could parse scalar node to a particular type if type info is explicitly specified, e.g.
  25. /// @verbatim
  26. /// name: !!str "John"
  27. /// price: !!float "0.278"
  28. /// quantity: !!int "500"
  29. /// @endverbatim
  30. JSON::Value parse(const std::string &string);
  31. JSON::Value parse(Stream &stream);
  32. JSON::Value parse(boost::shared_ptr<Stream> stream);
  33. }}
  34. #endif