ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/dclient/src/backend/communicator/command_parser/msg.h
Revision: 1.1
Committed: Sun Oct 17 08:15:04 2010 UTC (15 years, 11 months ago) by sf-pippijn
Content type: text/plain
Branch: MAIN
Log Message:
initial import

File Contents

# User Rev Content
1 sf-pippijn 1.1 #include <json/json.h>
2    
3     void
4     command_parser::on_msg (std::istream &args)
5     {
6     Json::Reader reader;
7     Json::Value ext;
8     if (!reader.parse (args, ext, false))
9     throw std::runtime_error ("error parsing input: " + reader.getFormatedErrorMessages ());
10    
11     if (ext.type () == Json::arrayValue)
12     emit msg (ext[0u].asUInt (), ext[1u].asString (), ext[2u].asString ());
13     // TODO: other json types
14     }