Sirikata
|
00001 // Copyright (c) 2012 Sirikata Authors. All rights reserved. 00002 // Use of this source code is governed by a BSD-style license that can 00003 // be found in the LICENSE file. 00004 00005 #ifndef _SIRIKATA_LIBCORE_COMMAND_COMMAND_HPP_ 00006 #define _SIRIKATA_LIBCORE_COMMAND_COMMAND_HPP_ 00007 00008 #include <sirikata/core/util/Platform.hpp> 00009 #include <json_spirit/json_spirit.h> 00010 00011 namespace Sirikata { 00012 00016 namespace Command { 00017 00018 class Commander; 00019 00025 typedef String CommandKey; 00026 00030 typedef uint32 CommandID; 00031 00037 typedef json_spirit::Value Command; 00038 bool SIRIKATA_FUNCTION_EXPORT CommandIsValid(const Command& cmd); 00039 void SIRIKATA_FUNCTION_EXPORT CommandSetName(Command& cmd, const String& name); 00040 00041 // Some additional helper typedefs. 00042 typedef json_spirit::Value::String String; 00043 typedef json_spirit::Array Array; 00044 typedef json_spirit::Object Object; 00045 00050 typedef json_spirit::Value Result; 00051 inline Result EmptyResult() { 00052 Command::Object empty_; 00053 return Result(empty_); 00054 } 00055 00063 typedef std::tr1::function<void(const Command&, Commander*, CommandID)> CommandHandler; 00064 00065 00066 00067 } // namespace Command 00068 } // namespace Sirikata 00069 00070 #endif //_SIRIKATA_LIBCORE_COMMAND_COMMAND_HPP_