PageRenderTime 102ms CodeModel.GetById 61ms app.highlight 2ms RepoModel.GetById 38ms 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
 1#ifndef __MORDOR_YAML_H__
 2#define __MORDOR_YAML_H__
 3// Copyright (c) 2010 - Mozy, Inc.
 4
 5#include <string>
 6
 7#include <boost/shared_ptr.hpp>
 8
 9#include "exception.h"
10#include "json.h"
11
12namespace Mordor {
13class Stream;
14
15namespace YAML {
16
17struct Exception : virtual Mordor::Exception
18{
19public:
20    Exception(const char *problem, const char *context)
21        : m_problem(problem),
22          m_context(context)
23    {}
24
25    const char *what() const throw() { return m_problem; }
26
27private:
28    const char *m_problem;
29    const char *m_context;
30};
31
32/// @note YAML parser tags all scalar node as a string if not specified explicitly
33/// it could parse scalar node to a particular type if type info is explicitly specified, e.g.
34/// @verbatim
35/// name: !!str "John"
36/// price: !!float "0.278"
37/// quantity: !!int "500"
38/// @endverbatim
39
40JSON::Value parse(const std::string &string);
41JSON::Value parse(Stream &stream);
42JSON::Value parse(boost::shared_ptr<Stream> stream);
43
44}}
45
46#endif