NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
v2::V2NIMChatroomMessageCreator类 参考

聊天室消息创建器 更多...

#include <v2_nim_utilities.hpp>

静态 Public 成员函数

static nstd::optional< V2NIMChatroomMessagecreateTextMessage (nstd::string text)
 创建文本消息
 
static nstd::optional< V2NIMChatroomMessagecreateImageMessage (nstd::string imagePath, nstd::string name, nstd::string sceneName, uint32_t width, uint32_t height)
 创建图片消息
 
static nstd::optional< V2NIMChatroomMessagecreateAudioMessage (nstd::string audioPath, nstd::string name, nstd::string sceneName, uint32_t duration)
 创建音频消息
 
static nstd::optional< V2NIMChatroomMessagecreateVideoMessage (nstd::string videoPath, nstd::string name, nstd::string sceneName, uint32_t duration, uint32_t width, uint32_t height)
 创建视频消息
 
static nstd::optional< V2NIMChatroomMessagecreateFileMessage (nstd::string filePath, nstd::string name, nstd::string sceneName)
 创建文件消息
 
static nstd::optional< V2NIMChatroomMessagecreateLocationMessage (double latitude, double longitude, nstd::string address)
 创建位置消息
 
static nstd::optional< V2NIMChatroomMessagecreateCustomMessage (nstd::string rawAttachment)
 创建自定义消息
 
static nstd::optional< V2NIMChatroomMessagecreateTipsMessage (nstd::string text)
 创建提示消息
 
static nstd::optional< V2NIMChatroomMessagecreateForwardMessage (V2NIMChatroomMessage message)
 创建转发消息
 

详细描述

聊天室消息创建器

成员函数说明

◆ createAudioMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createAudioMessage ( nstd::string  audioPath,
nstd::string  name,
nstd::string  sceneName,
uint32_t  duration 
)
inlinestatic

创建音频消息

参数
audioPath音频路径
name文件显示名称, 为空则使用文件名
sceneName文件存储场景
duration音频时长
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
if(!audioMessage) {
// create audio message failed
}
static const char * V2NIM_STORAGE_SCENE_NAME_DEFAULT_IM
Definition: v2_nim_def_enum.hpp:1606
static nstd::optional< V2NIMChatroomMessage > createAudioMessage(nstd::string audioPath, nstd::string name, nstd::string sceneName, uint32_t duration)
创建音频消息
Definition: v2_nim_internal.hpp:201

◆ createCustomMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createCustomMessage ( nstd::string  rawAttachment)
inlinestatic

创建自定义消息

参数
attachment附件
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
auto customMessage = V2NIMChatroomMessageCreator::createCustomMessage(R"({"key": "value"})");
if(!customMessage) {
// create custom message failed
}
static nstd::optional< V2NIMChatroomMessage > createCustomMessage(nstd::string rawAttachment)
创建自定义消息
Definition: v2_nim_internal.hpp:225

◆ createFileMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createFileMessage ( nstd::string  filePath,
nstd::string  name,
nstd::string  sceneName 
)
inlinestatic

创建文件消息

参数
filePath文件路径
name文件显示名称, 为空则使用文件名
sceneName文件存储场景
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
if(!fileMessage) {
// create file message failed
}
static nstd::optional< V2NIMChatroomMessage > createFileMessage(nstd::string filePath, nstd::string name, nstd::string sceneName)
创建文件消息
Definition: v2_nim_internal.hpp:215

◆ createForwardMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createForwardMessage ( V2NIMChatroomMessage  message)
inlinestatic

创建转发消息

参数
message原消息
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
if(!forwardMessage) {
// create forward message failed
}
static nstd::optional< V2NIMChatroomMessage > createForwardMessage(V2NIMChatroomMessage message)
创建转发消息
Definition: v2_nim_internal.hpp:231

◆ createImageMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createImageMessage ( nstd::string  imagePath,
nstd::string  name,
nstd::string  sceneName,
uint32_t  width,
uint32_t  height 
)
inlinestatic

创建图片消息

参数
imagePath图片路径
name文件显示名称, 为空则使用文件名
sceneName文件存储场景
width图片宽度
height图片高度
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
100); if(!imageMessage) {
// create image message failed
}
static nstd::optional< V2NIMChatroomMessage > createImageMessage(nstd::string imagePath, nstd::string name, nstd::string sceneName, uint32_t width, uint32_t height)
创建图片消息
Definition: v2_nim_internal.hpp:194

◆ createLocationMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createLocationMessage ( double  latitude,
double  longitude,
nstd::string  address 
)
inlinestatic

创建位置消息

参数
latitude纬度
longitude经度
address详细位置信息
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
auto locationMessage = V2NIMChatroomMessageCreator::createLocationMessage(100, 100, "address");
if(!locationMessage) {
// create location message failed
}
static nstd::optional< V2NIMChatroomMessage > createLocationMessage(double latitude, double longitude, nstd::string address)
创建位置消息
Definition: v2_nim_internal.hpp:220

◆ createTextMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createTextMessage ( nstd::string  text)
inlinestatic

创建文本消息

参数
text文本内容
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
auto textMessage = V2NIMChatroomMessageCreator::createTextMessage("hello world");
if(!textMessage) {
// create text message failed
}
static nstd::optional< V2NIMChatroomMessage > createTextMessage(nstd::string text)
创建文本消息
Definition: v2_nim_internal.hpp:191

◆ createTipsMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createTipsMessage ( nstd::string  text)
inlinestatic

创建提示消息

参数
text文本内容
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
if(!tipMessage) {
// create tip message failed
}
static nstd::optional< V2NIMChatroomMessage > createTipsMessage(nstd::string text)
创建提示消息
Definition: v2_nim_internal.hpp:228

◆ createVideoMessage()

nstd::optional< V2NIMChatroomMessage > v2::V2NIMChatroomMessageCreator::createVideoMessage ( nstd::string  videoPath,
nstd::string  name,
nstd::string  sceneName,
uint32_t  duration,
uint32_t  width,
uint32_t  height 
)
inlinestatic

创建视频消息

参数
videoPath视频路径
name文件显示名称, 为空则使用文件名
sceneName文件存储场景
duration视频时长
width视频宽度
height视频高度
返回
nstd::optional<V2NIMChatroomMessage>
示例代码
auto videoMessage = V2NIMChatroomMessageCreator::createVideoMessage("videoPath", "videoName", V2NIM_STORAGE_SCENE_NAME_DEFAULT_IM, 100, 100,
100); if (!videoMessage) {
// create video message failed
}
static nstd::optional< V2NIMChatroomMessage > createVideoMessage(nstd::string videoPath, nstd::string name, nstd::string sceneName, uint32_t duration, uint32_t width, uint32_t height)
创建视频消息
Definition: v2_nim_internal.hpp:207

该类的文档由以下文件生成: