NIM 跨平台 C++ SDK
载入中...
搜索中...
未找到
nim_robot_helper.h
浏览该文件的文档.
1
7#ifndef _NIM_SDK_CPP_ROBOT_HELPER_H_
8#define _NIM_SDK_CPP_ROBOT_HELPER_H_
9
10#include <assert.h>
11#include <list>
12#include <string>
14#include "nim_define_include.h"
20namespace nim {
23public:
25 void SetAccid(const std::string& accid) { robot_info_[kNIMRobotInfoKeyAccid] = accid; }
26
28 std::string GetAccid() const { return robot_info_[kNIMRobotInfoKeyAccid].asString(); }
29
31 void SetName(const std::string& name) { robot_info_[kNIMRobotInfoKeyName] = name; }
32
34 std::string GetName() const { return robot_info_[kNIMRobotInfoKeyName].asString(); }
35
37 void SetIcon(const std::string& icon) { robot_info_[kNIMRobotInfoKeyIcon] = icon; }
38
40 std::string GetIcon() const { return robot_info_[kNIMRobotInfoKeyIcon].asString(); }
41
43 void SetIntro(const std::string& intro) { robot_info_[kNIMRobotInfoKeyIntro] = intro; }
44
46 std::string GetIntro() const { return robot_info_[kNIMRobotInfoKeyIntro].asString(); }
47
49 void SetRobotID(const std::string& id) { robot_info_[kNIMRobotInfoKeyRobotId] = id; }
50
52 std::string GetRobotID() const { return robot_info_[kNIMRobotInfoKeyRobotId].asString(); }
53
55 void SetCreateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyCreateTime] = time; }
56
58 uint64_t GetCreateTime() const { return robot_info_[kNIMRobotInfoKeyCreateTime].asUInt64(); }
59
61 void SetUpdateTime(const uint64_t time) { robot_info_[kNIMRobotInfoKeyUpdateTime] = time; }
62
64 uint64_t GetUpdateTime() const { return robot_info_[kNIMRobotInfoKeyUpdateTime].asUInt64(); }
65
66private:
68};
69
70typedef std::list<RobotInfo> RobotInfos;
71
78NIM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfosStringToRobotInfos(const std::string& infos_json, RobotInfos& infos);
79
86NIM_SDK_CPPWRAPPER_DLL_API bool ParseRobotInfoStringToRobotInfo(const std::string& info_json, RobotInfo& info);
87
88} // namespace nim
89
90#endif //_NIM_SDK_CPP_ROBOT_HELPER_H_
Represents a JSON value.
Definition value.h:196
namespace nim
bool ParseRobotInfoStringToRobotInfo(const std::string &info_json, RobotInfo &info)
解析机器人信息
Definition nim_robot_helper.cpp:24
std::list< RobotInfo > RobotInfos
Definition nim_robot_helper.h:70
bool ParseRobotInfosStringToRobotInfos(const std::string &infos_json, RobotInfos &infos)
解析机器人信息
Definition nim_robot_helper.cpp:10
static const char * kNIMRobotInfoKeyAccid
string 帐号
Definition nim_chatroom_def.h:921
static const char * kNIMRobotInfoKeyRobotId
string 机器人ID
Definition nim_chatroom_def.h:929
static const char * kNIMRobotInfoKeyIcon
string 头像
Definition nim_chatroom_def.h:925
static const char * kNIMRobotInfoKeyIntro
string 介绍
Definition nim_chatroom_def.h:927
static const char * kNIMRobotInfoKeyName
string 名字
Definition nim_chatroom_def.h:923
static const char * kNIMRobotInfoKeyCreateTime
long 创建时间戳 毫秒
Definition nim_chatroom_def.h:931
static const char * kNIMRobotInfoKeyUpdateTime
long 更新时间戳 毫秒
Definition nim_chatroom_def.h:933
NIM 公共数据类型定义总的包含文件
JSON辅助方法
定义导出宏
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition nim_sdk_cpp_wrapper.h:38
机器人信息
Definition nim_robot_helper.h:22
std::string GetRobotID() const
Definition nim_robot_helper.h:52
void SetName(const std::string &name)
Definition nim_robot_helper.h:31
std::string GetName() const
Definition nim_robot_helper.h:34
void SetRobotID(const std::string &id)
Definition nim_robot_helper.h:49
uint64_t GetCreateTime() const
Definition nim_robot_helper.h:58
nim_cpp_wrapper_util::Json::Value robot_info_
Definition nim_robot_helper.h:67
std::string GetIntro() const
Definition nim_robot_helper.h:46
void SetAccid(const std::string &accid)
Definition nim_robot_helper.h:25
std::string GetAccid() const
Definition nim_robot_helper.h:28
uint64_t GetUpdateTime() const
Definition nim_robot_helper.h:64
void SetCreateTime(const uint64_t time)
Definition nim_robot_helper.h:55
void SetIcon(const std::string &icon)
Definition nim_robot_helper.h:37
void SetIntro(const std::string &intro)
Definition nim_robot_helper.h:43
std::string GetIcon() const
Definition nim_robot_helper.h:40
void SetUpdateTime(const uint64_t time)
Definition nim_robot_helper.h:61