1#ifndef V2_NIM_INTERNAL_H
2#define V2_NIM_INTERNAL_H
4#if defined(WIN32) || defined(_WIN32)
16 if (!pair.first.empty()) {
17 detail.emplace(std::move(pair));
102 uint32_t duration) = 0;
108 uint32_t height) = 0;
113 int32_t subType) = 0;
132 auto* sdkHandle = ::LoadLibraryA(sdkName);
133 if (sdkHandle ==
nullptr) {
134 throw std::runtime_error(
"LoadLibraryA error: " + std::to_string(::GetLastError()));
136 auto* instanceFunction = ::GetProcAddress(
static_cast<HMODULE
>(sdkHandle), functionName);
137 if (instanceFunction ==
nullptr) {
138 throw std::runtime_error(
"GetProcAddress error: " + std::to_string(::GetLastError()));
141 auto* sdkHandle = dlopen(sdkName, RTLD_LAZY);
142 if (sdkHandle ==
nullptr) {
143 throw std::runtime_error(
"dlopen error: " + std::string(dlerror()));
145 auto* instanceFunction = dlsym(sdkHandle, functionName);
146 if (instanceFunction ==
nullptr) {
147 throw std::runtime_error(
"dlsym error: " + std::string(dlerror()));
150 return reinterpret_cast<T (*)()
>(instanceFunction)();
Definition: ne_stl_continuous_container.h:15
Definition: ne_stl_smart_ptr.h:30
Definition: ne_stl_string.h:19
static nstd::optional< V2NIMChatroomMessage > createTextMessage(nstd::string text)
创建文本消息
Definition: v2_nim_internal.hpp:204
static nstd::optional< V2NIMChatroomMessage > createCustomMessageWithAttachment(nstd::shared_ptr< V2NIMMessageCustomAttachment > attachment, int32_t subType)
创建群聊自定义消息
Definition: v2_nim_internal.hpp:241
static nstd::optional< V2NIMChatroomMessage > createLocationMessage(double latitude, double longitude, nstd::string address)
创建位置消息
Definition: v2_nim_internal.hpp:233
static nstd::optional< V2NIMChatroomMessage > createFileMessage(nstd::string filePath, nstd::string name, nstd::string sceneName)
创建文件消息
Definition: v2_nim_internal.hpp:228
static nstd::optional< V2NIMChatroomMessage > createTipsMessage(nstd::string text)
创建提示消息
Definition: v2_nim_internal.hpp:246
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:207
static nstd::optional< V2NIMChatroomMessage > createForwardMessage(V2NIMChatroomMessage message)
创建转发消息
Definition: v2_nim_internal.hpp:249
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:220
static nstd::optional< V2NIMChatroomMessage > createCustomMessage(nstd::string rawAttachment)
创建自定义消息
Definition: v2_nim_internal.hpp:238
static nstd::optional< V2NIMChatroomMessage > createAudioMessage(nstd::string audioPath, nstd::string name, nstd::string sceneName, uint32_t duration)
创建音频消息
Definition: v2_nim_internal.hpp:214
static V2NIMClientAntispamResult checkTextAntispam(nstd::string text, nstd::string replace)
文本本地反垃圾
Definition: v2_nim_internal.hpp:284
static nstd::string superTeamConversationId(const nstd::string &superTeamId)
获取超级群会话ID
Definition: v2_nim_internal.hpp:275
static V2NIMConversationType parseConversationType(const nstd::string &conversationId)
获取会话ID对应的会话类型
Definition: v2_nim_internal.hpp:278
static nstd::string p2pConversationId(const nstd::string &accountId)
获取点对点会话ID
Definition: v2_nim_internal.hpp:269
static nstd::string teamConversationId(const nstd::string &teamId)
获取群组会话ID
Definition: v2_nim_internal.hpp:272
static nstd::string parseConversationTargetId(const nstd::string &conversationId)
获取会话ID对应的目标ID
Definition: v2_nim_internal.hpp:281
static nstd::shared_ptr< V2NIMMessageLocationAttachment > createLocationMessageAttachment(double latitude, double longitude, const nstd::string &address)
构造地理位置消息附件
Definition: v2_nim_internal.hpp:264
static nstd::optional< nstd::string > messageSerialization(const V2NIMMessage &message)
将 V2NIMMessage 序列化为字符串
Definition: v2_nim_internal.hpp:252
static nstd::optional< V2NIMMessage > messageDeserialization(const nstd::string &messageString)
将字符串反序列化为 V2NIMMessage
Definition: v2_nim_internal.hpp:255
static nstd::optional< V2NIMMessage > createCustomMessage(nstd::string text, nstd::string rawAttachment)
创建自定义消息
Definition: v2_nim_internal.hpp:183
static nstd::optional< V2NIMMessage > createFileMessage(nstd::string filePath, nstd::string name, nstd::string sceneName)
创建文件消息
Definition: v2_nim_internal.hpp:177
static nstd::optional< V2NIMMessage > createAudioMessage(nstd::string audioPath, nstd::string name, nstd::string sceneName, uint32_t duration)
创建音频消息
Definition: v2_nim_internal.hpp:163
static nstd::optional< V2NIMMessage > createImageMessage(nstd::string imagePath, nstd::string name, nstd::string sceneName, uint32_t width, uint32_t height)
创建图片消息
Definition: v2_nim_internal.hpp:156
static nstd::optional< V2NIMMessage > createLocationMessage(double latitude, double longitude, nstd::string address)
创建位置消息
Definition: v2_nim_internal.hpp:180
static nstd::optional< V2NIMMessage > createVideoMessage(nstd::string videoPath, nstd::string name, nstd::string sceneName, uint32_t duration, uint32_t width, uint32_t height)
创建视频消息
Definition: v2_nim_internal.hpp:169
static nstd::optional< V2NIMMessage > createTipsMessage(nstd::string text)
创建提示消息
Definition: v2_nim_internal.hpp:190
static nstd::optional< V2NIMMessage > createCustomMessageWithAttachment(nstd::shared_ptr< V2NIMMessageCustomAttachment > attachment, int32_t subType)
创建群聊自定义消息
Definition: v2_nim_internal.hpp:186
static nstd::optional< V2NIMMessage > createCallMessage(int32_t type, const nstd::string &channelId, int32_t status, const nstd::vector< V2NIMMessageCallDuration > &durations, const nstd::string &text)
构造话单消息
Definition: v2_nim_internal.hpp:196
static nstd::optional< V2NIMMessage > createForwardMessage(V2NIMMessage message)
创建转发消息
Definition: v2_nim_internal.hpp:193
static nstd::optional< V2NIMMessage > createTextMessage(nstd::string text)
创建文本消息
Definition: v2_nim_internal.hpp:153
static nstd::string videoCoverUrl(const nstd::string &url, int32_t offset, int32_t thumbSize, const nstd::string &type)
获取视频封面
Definition: v2_nim_internal.hpp:261
static nstd::string imageThumbUrl(const nstd::string &url, int32_t thumbSize)
获取图片缩略图
Definition: v2_nim_internal.hpp:258
Definition: v2_nim_internal.hpp:91
virtual nstd::optional< V2NIMChatroomMessage > createForwardMessage(V2NIMChatroomMessage message)=0
virtual nstd::optional< V2NIMChatroomMessage > createLocationMessage(double latitude, double longitude, nstd::string address)=0
virtual nstd::optional< V2NIMChatroomMessage > createTextMessage(nstd::string text)=0
virtual nstd::optional< V2NIMChatroomMessage > createCustomMessageWithAttachment(nstd::shared_ptr< V2NIMMessageCustomAttachment > attachment, int32_t subType)=0
virtual nstd::optional< V2NIMChatroomMessage > createFileMessage(nstd::string filePath, nstd::string name, nstd::string sceneName)=0
virtual nstd::optional< V2NIMChatroomMessage > createImageMessage(nstd::string imagePath, nstd::string name, nstd::string sceneName, uint32_t width, uint32_t height)=0
virtual nstd::optional< V2NIMChatroomMessage > createVideoMessage(nstd::string videoPath, nstd::string name, nstd::string sceneName, uint32_t duration, uint32_t width, uint32_t height)=0
virtual nstd::optional< V2NIMChatroomMessage > createCustomMessage(nstd::string rawAttachment)=0
virtual nstd::optional< V2NIMChatroomMessage > createTipsMessage(nstd::string text)=0
virtual nstd::optional< V2NIMChatroomMessage > createAudioMessage(nstd::string audioPath, nstd::string name, nstd::string sceneName, uint32_t duration)=0
Definition: v2_nim_internal.hpp:35
virtual V2NIMClientAntispamResult checkTextAntispam(nstd::string text, nstd::string replace)=0
Definition: v2_nim_internal.hpp:42
virtual nstd::string p2pConversationId(const nstd::string &accountId)=0
virtual nstd::string teamConversationId(const nstd::string &teamId)=0
virtual nstd::string parseConversationTargetId(const nstd::string &conversationId)=0
virtual nstd::string superTeamConversationId(const nstd::string &superTeamId)=0
virtual V2NIMConversationType parseConversationType(const nstd::string &conversationId)=0
Definition: v2_nim_internal.hpp:53
virtual nstd::string imageThumbUrl(const nstd::string &url, int32_t thumbSize)=0
virtual nstd::optional< V2NIMMessage > createCustomMessageWithAttachment(nstd::shared_ptr< V2NIMMessageCustomAttachment > attachment, int32_t subType)=0
virtual nstd::optional< V2NIMMessage > createLocationMessage(double latitude, double longitude, nstd::string address)=0
virtual nstd::optional< V2NIMMessage > createTextMessage(nstd::string text)=0
virtual nstd::optional< V2NIMMessage > createAudioMessage(nstd::string audioPath, nstd::string name, nstd::string sceneName, uint32_t duration)=0
virtual nstd::optional< V2NIMMessage > createCustomMessage(nstd::string text, nstd::string rawAttachment)=0
virtual nstd::optional< V2NIMMessage > createForwardMessage(V2NIMMessage message)=0
virtual nstd::optional< V2NIMMessage > createFileMessage(nstd::string filePath, nstd::string name, nstd::string sceneName)=0
virtual nstd::optional< V2NIMMessage > createTipsMessage(nstd::string text)=0
virtual nstd::shared_ptr< V2NIMMessageLocationAttachment > createLocationMessageAttachment(double latitude, double longitude, const nstd::string &address)=0
virtual nstd::optional< V2NIMMessage > messageDeserialization(const nstd::string &message)=0
virtual nstd::string videoCoverUrl(const nstd::string &url, int32_t offset, int32_t thumbSize, const nstd::string &type)=0
virtual nstd::optional< V2NIMMessage > createImageMessage(nstd::string imagePath, nstd::string name, nstd::string sceneName, uint32_t width, uint32_t height)=0
virtual nstd::optional< V2NIMMessage > createVideoMessage(nstd::string videoPath, nstd::string name, nstd::string sceneName, uint32_t duration, uint32_t width, uint32_t height)=0
virtual nstd::optional< V2NIMMessage > createCallMessage(int32_t type, const nstd::string &channelId, int32_t status, const nstd::vector< V2NIMMessageCallDuration > &durations, const nstd::string &text)=0
virtual nstd::optional< nstd::string > messageSerialization(const V2NIMMessage &message)=0
phmap::priv::Pair< const K, V > Pair
Definition: ne_stl_map.h:11
static const char * NIM_SDK_NAME
Definition: v2_nim_internal.hpp:126
V2NIMClientAntispamUtilInternal * internalClientAntispamUtil
Definition: v2_nim_internal.hpp:39
V2NIMChatroomMessageUtilInternal * internalChatroomMessageUtil
Definition: v2_nim_internal.hpp:117
V2NIMMessageUtilInternal * internalMessageUtil
Definition: v2_nim_internal.hpp:88
V2NIMConversationIdUtilInternal * internalConversationIdUtil
Definition: v2_nim_internal.hpp:50
@ V2_NIM_CHATROOM_MESSAGE_UTIL
Definition: v2_nim_internal.hpp:32
@ V2_NIM_CHATROOM_SDK_EXPORT
Definition: v2_nim_internal.hpp:31
T callSdkFunction(const char *sdkName, const char *functionName)
Definition: v2_nim_internal.hpp:130
@ V2_NIM_INTERNEL_INSTANCE
Definition: v2_nim_internal.hpp:25
@ V2_NIM_INTERNEL_CONVERSATION_ID_UTIL
Definition: v2_nim_internal.hpp:27
@ V2_NIM_INTERNEL_CLIENT_ANTI_SPAM_UTIL
Definition: v2_nim_internal.hpp:26
@ V2_NIM_INTERNEL_MESSAGE_UTIL
Definition: v2_nim_internal.hpp:28
static const char * NIM_CHATROOM_SDK_NAME
Definition: v2_nim_internal.hpp:127
Definition: v2_nim_ai_service.hpp:4
static const std::map< uint32_t, const char *const > V2NIM_ERROR_DESC_MAPPING
Definition: v2_nim_def_enum.hpp:559
V2NIMConversationType
Definition: v2_nim_def_enum.hpp:909
Definition: ne_stl_optional.h:16
Definition: v2_nim_def_struct.hpp:1856
Definition: v2_nim_def_struct.hpp:919
uint32_t code
错误码, 详见 V2NIMErrorCode
Definition: v2_nim_def_struct.hpp:9
nstd::string & operator[](const nstd::string &key)
Definition: v2_nim_internal.hpp:20
nstd::map< nstd::string, nstd::string > detail
错误详情
Definition: v2_nim_def_struct.hpp:13
nstd::string desc
错误描述
Definition: v2_nim_def_struct.hpp:11
Definition: v2_nim_def_struct.hpp:643