From 12c281ffb3cc3befb9a9c4a81b73516785646462 Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Tue, 23 Jan 2024 23:00:44 +0800 Subject: [PATCH 01/13] feat: change callback --- .gitignore | 3 + build_dll.bat | 6 + build_so.sh | 3 + c_cpp_wrapper/build_dll.bat | 5 - c_cpp_wrapper/build_run_test.bat | 2 - c_cpp_wrapper/build_so.sh | 9 - c_cpp_wrapper/build_test.bat | 1 - c_cpp_wrapper/constant.go | 77 -- c_cpp_wrapper/event_listener/listener.go | 1 - c_cpp_wrapper/gen_ios_dylib.sh | 8 - c_cpp_wrapper/go.mod | 38 - c_cpp_wrapper/openimsdk.h | 316 ------- c_cpp_wrapper/openimsdkcc.cc | 866 ------------------ c_cpp_wrapper/openimsdkcc.h | 323 ------- c_cpp_wrapper/protocol.go | 106 --- c_cpp_wrapper/test.c | 66 -- c_cpp_wrapper/test.cc | 44 - c_cpp_wrapper/tools.go | 32 - c_cpp_wrapper/wrapp_cpp_function.inc | 301 ------ c_cpp_wrapper/export.go => export.go | 787 ++++++++-------- .../gen_android_so.bat => gen_android_so.bat | 0 gen_ios_dylib.sh | 8 + c_cpp_wrapper/go.sum => go.sum | 0 message.go | 88 ++ protocol.go | 16 + c_cpp_wrapper/run_test.sh => run_test.sh | 0 26 files changed, 548 insertions(+), 2558 deletions(-) create mode 100644 build_dll.bat create mode 100644 build_so.sh delete mode 100644 c_cpp_wrapper/build_dll.bat delete mode 100644 c_cpp_wrapper/build_run_test.bat delete mode 100755 c_cpp_wrapper/build_so.sh delete mode 100644 c_cpp_wrapper/build_test.bat delete mode 100644 c_cpp_wrapper/constant.go delete mode 100644 c_cpp_wrapper/event_listener/listener.go delete mode 100644 c_cpp_wrapper/gen_ios_dylib.sh delete mode 100644 c_cpp_wrapper/go.mod delete mode 100644 c_cpp_wrapper/openimsdk.h delete mode 100644 c_cpp_wrapper/openimsdkcc.cc delete mode 100644 c_cpp_wrapper/openimsdkcc.h delete mode 100644 c_cpp_wrapper/protocol.go delete mode 100644 c_cpp_wrapper/test.c delete mode 100644 c_cpp_wrapper/test.cc delete mode 100644 c_cpp_wrapper/tools.go delete mode 100644 c_cpp_wrapper/wrapp_cpp_function.inc rename c_cpp_wrapper/export.go => export.go (54%) rename c_cpp_wrapper/gen_android_so.bat => gen_android_so.bat (100%) create mode 100644 gen_ios_dylib.sh rename c_cpp_wrapper/go.sum => go.sum (100%) create mode 100644 message.go create mode 100644 protocol.go rename c_cpp_wrapper/run_test.sh => run_test.sh (100%) mode change 100755 => 100644 diff --git a/.gitignore b/.gitignore index 259148f..4c67d8d 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,6 @@ *.exe *.out *.app +/vendor +/openimsdk.h +/openimsdk.dll diff --git a/build_dll.bat b/build_dll.bat new file mode 100644 index 0000000..ab04da2 --- /dev/null +++ b/build_dll.bat @@ -0,0 +1,6 @@ +set CGO_ENABLED=1 +go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openimsdk.dll export.go protocol.go message.go + + + +@REM g++ -shared -fPIC -o openimsdkcc.dll openimsdkcc.cc openimsdk.dll \ No newline at end of file diff --git a/build_so.sh b/build_so.sh new file mode 100644 index 0000000..d4877bb --- /dev/null +++ b/build_so.sh @@ -0,0 +1,3 @@ +#!/bin/bash +rm ./openimsdk.so ./openimsdk.h +go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openimsdk.so export.go protocol.go message.go diff --git a/c_cpp_wrapper/build_dll.bat b/c_cpp_wrapper/build_dll.bat deleted file mode 100644 index 41fd9af..0000000 --- a/c_cpp_wrapper/build_dll.bat +++ /dev/null @@ -1,5 +0,0 @@ -go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openimsdk.dll export.go constant.go protocol.go tools.go - - - -g++ -shared -fPIC -o openimsdkcc.dll openimsdkcc.cc openimsdk.dll \ No newline at end of file diff --git a/c_cpp_wrapper/build_run_test.bat b/c_cpp_wrapper/build_run_test.bat deleted file mode 100644 index e8fdc3c..0000000 --- a/c_cpp_wrapper/build_run_test.bat +++ /dev/null @@ -1,2 +0,0 @@ -gcc -o test.exe -L. openimsdk.dll test.c -test.exe \ No newline at end of file diff --git a/c_cpp_wrapper/build_so.sh b/c_cpp_wrapper/build_so.sh deleted file mode 100755 index dc1c3e9..0000000 --- a/c_cpp_wrapper/build_so.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -rm ./openimsdk.so ./openimsdk.h -go build -buildmode=c-shared -trimpath -ldflags="-s -w" -o openimsdk.so export.go constant.go protocol.go tools.go - - -# build cpp sdk -rm ./openimsdkcc.so -g++ -fPIC -shared -o openimsdkcc.so openimsdkcc.cc ./openimsdk.so \ No newline at end of file diff --git a/c_cpp_wrapper/build_test.bat b/c_cpp_wrapper/build_test.bat deleted file mode 100644 index 3950e23..0000000 --- a/c_cpp_wrapper/build_test.bat +++ /dev/null @@ -1 +0,0 @@ -gcc -o test.exe -L. openimsdk.dll test.c \ No newline at end of file diff --git a/c_cpp_wrapper/constant.go b/c_cpp_wrapper/constant.go deleted file mode 100644 index 1798166..0000000 --- a/c_cpp_wrapper/constant.go +++ /dev/null @@ -1,77 +0,0 @@ -package main - -/* -#include -*/ -import "C" - -var ( - NO_ERR = C.int(0) - NO_ERR_MSG = C.CString("") - NO_DATA = C.CString("") - NO_PROGRESS = C.int(0) -) - -const ( - CONNECTING = iota - CONNECT_SUCCESS - CONNECT_FAILED - KICKED_OFFLINE - USER_TOKEN_EXPIRED - JOINED_GROUP_ADDED - JOINED_GROUP_DELETED - GROUP_MEMBER_ADDED - GROUP_MEMBER_DELETED - GROUP_APPLICATION_ADDED - GROUP_APPLICATION_DELETED - GROUP_INFO_CHANGED - GROUP_DISMISSED - GROUP_MEMBER_INFO_CHANGED - GROUP_APPLICATION_ACCEPTED - GROUP_APPLICATION_REJECTED - FRIEND_APPLICATION_ADDED - FRIEND_APPLICATION_DELETED - FRIEND_APPLICATION_ACCEPTED - FRIEND_APPLICATION_REJECTED - FRIEND_ADDED - FRIEND_DELETED - FRIEND_INFO_CHANGED - BLACK_ADDED - BLACK_DELETED - SYNC_SERVER_START - SYNC_SERVER_FINISH - SYNC_SERVER_PROGRESS - SYNC_SERVER_FAILED - NEW_CONVERSATION - CONVERSATION_CHANGED - TOTAL_UNREAD_MESSAGE_COUNT_CHANGED - RECV_NEW_MESSAGE - RECV_C2C_READ_RECEIPT - RECV_GROUP_READ_RECEIPT - NEW_RECV_MESSAGE_REVOKED - RECV_MESSAGE_EXTENSIONS_CHANGED - RECV_MESSAGE_EXTENSIONS_DELETED - RECV_MESSAGE_EXTENSIONS_ADDED - RECV_OFFLINE_NEW_MESSAGE - MSG_DELETED - - RECV_NEW_MESSAGES - RECV_OFFLINE_NEW_MESSAGES - - SELF_INFO_UPDATED - USER_STATUS_CHANGED - - RECV_CUSTOM_BUSINESS_MESSAGE - - - MESSAGE_KV_INFO_CHANGED - - UPLOAD_FILE_CALLBACK_OPEN - UPLOAD_FILE_CALLBACK_PART_SIZE - UPLOAD_FILE_CALLBACK_HASH_PART_PROGRESS - UPLOAD_FILE_CALLBACK_HASH_PART_COMPLETE - UPLOAD_FILE_CALLBACK_UPLOAD_ID - UPLOAD_FILE_CALLBACK_UPLOAD_PART_COMPLETE - UPLOAD_FILE_CALLBACK_UPLOAD_COMPLETE - UPLOAD_FILE_CALLBACK_COMPLETE -) diff --git a/c_cpp_wrapper/event_listener/listener.go b/c_cpp_wrapper/event_listener/listener.go deleted file mode 100644 index 0d2d4a9..0000000 --- a/c_cpp_wrapper/event_listener/listener.go +++ /dev/null @@ -1 +0,0 @@ -package event_listener diff --git a/c_cpp_wrapper/gen_ios_dylib.sh b/c_cpp_wrapper/gen_ios_dylib.sh deleted file mode 100644 index 152773e..0000000 --- a/c_cpp_wrapper/gen_ios_dylib.sh +++ /dev/null @@ -1,8 +0,0 @@ -export GOOS=darwin -export GOARCH=arm64 -export CGO_ENABLED=1 -export CC=clang - -go build -buildmode=c-shared -o libopenimsdk.dylib export.go constant.go protocol.go tools.go - - diff --git a/c_cpp_wrapper/go.mod b/c_cpp_wrapper/go.mod deleted file mode 100644 index b475ae7..0000000 --- a/c_cpp_wrapper/go.mod +++ /dev/null @@ -1,38 +0,0 @@ -module github.com/openimsdk/openim-sdk-cpp - -go 1.20 - -require github.com/openimsdk/openim-sdk-core/v3 v3.4.0 - -require ( - github.com/OpenIMSDK/protocol v0.0.23 // indirect - github.com/OpenIMSDK/tools v0.0.5 // indirect - github.com/bwmarrin/snowflake v0.3.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/gorilla/websocket v1.4.2 // indirect - github.com/jinzhu/copier v0.3.5 // indirect - github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.5 // indirect - github.com/klauspost/compress v1.16.5 // indirect - github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect - github.com/lestrrat-go/strftime v1.0.6 // indirect - github.com/mattn/go-sqlite3 v1.14.12 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect - github.com/pkg/errors v0.9.1 // indirect - github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20220106031843-2efeb10ca2f6 // indirect - go.uber.org/atomic v1.7.0 // indirect - go.uber.org/multierr v1.6.0 // indirect - go.uber.org/zap v1.24.0 // indirect - golang.org/x/image v0.9.0 // indirect - golang.org/x/net v0.11.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/text v0.11.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect - google.golang.org/grpc v1.56.2 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gorm.io/driver/sqlite v1.3.6 // indirect - gorm.io/gorm v1.23.8 // indirect - nhooyr.io/websocket v1.8.7 // indirect -) diff --git a/c_cpp_wrapper/openimsdk.h b/c_cpp_wrapper/openimsdk.h deleted file mode 100644 index a63ab57..0000000 --- a/c_cpp_wrapper/openimsdk.h +++ /dev/null @@ -1,316 +0,0 @@ -/* Code generated by cmd/cgo; DO NOT EDIT. */ - -/* package command-line-arguments */ - - -#line 1 "cgo-builtin-export-prolog" - -#include - -#ifndef GO_CGO_EXPORT_PROLOGUE_H -#define GO_CGO_EXPORT_PROLOGUE_H - -#ifndef GO_CGO_GOSTRING_TYPEDEF -typedef struct { const char *p; ptrdiff_t n; } _GoString_; -#endif - -#endif - -/* Start of preamble from import "C" comments. */ - - -#line 3 "export.go" - -#include -typedef void (*CB_S)(char *); -typedef void (*CB_I_S)(int,char *); -typedef void (*CB_S_I_S_S)(char *,int,char *,char *); -typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int); -extern void Call_CB_S(CB_S func,char* data); -extern void Call_CB_I_S(CB_I_S func,int event,char* data); -extern void Call_CB_S_I_S_S(CB_S_I_S_S func,char *,int errCode,char* errMsg,char* data); -extern void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char *,int errCode,char* errMsg,char* data,int progress); -extern CB_S DebugPrint; - - -#line 1 "cgo-generated-wrapper" - - -/* End of preamble from import "C" comments. */ - - -/* Start of boilerplate cgo prologue. */ -#line 1 "cgo-gcc-export-header-prolog" - -#ifndef GO_CGO_PROLOGUE_H -#define GO_CGO_PROLOGUE_H - -typedef signed char GoInt8; -typedef unsigned char GoUint8; -typedef short GoInt16; -typedef unsigned short GoUint16; -typedef int GoInt32; -typedef unsigned int GoUint32; -typedef long long GoInt64; -typedef unsigned long long GoUint64; -typedef GoInt64 GoInt; -typedef GoUint64 GoUint; -typedef size_t GoUintptr; -typedef float GoFloat32; -typedef double GoFloat64; -#ifdef _MSC_VER -#include -typedef _Fcomplex GoComplex64; -typedef _Dcomplex GoComplex128; -#else -typedef float _Complex GoComplex64; -typedef double _Complex GoComplex128; -#endif - -/* - static assertion to make sure the file is being used on architecture - at least with matching size of GoInt. -*/ -typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; - -#ifndef GO_CGO_GOSTRING_TYPEDEF -typedef _GoString_ GoString; -#endif -typedef void *GoMap; -typedef void *GoChan; -typedef struct { void *t; void *v; } GoInterface; -typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; - -#endif - -/* End of boilerplate cgo prologue. */ - -#ifdef __cplusplus -extern "C" { -#endif - -extern void set_print(CB_S print); -extern void set_group_listener(CB_I_S cCallback); -extern void set_conversation_listener(CB_I_S cCallback); -extern void set_advanced_msg_listener(CB_I_S cCallback); -extern void set_batch_msg_listener(CB_I_S cCallback); -extern void set_user_listener(CB_I_S cCallback); -extern void set_friend_listener(CB_I_S cCallback); -extern void set_custom_business_listener(CB_I_S cCallback); -extern GoUint8 init_sdk(CB_I_S cCallback, char* operationID, char* config); -extern void un_init_sdk(char* operationID); -extern void login(CB_S_I_S_S cCallback, char* operationID, char* uid, char* token); -extern void logout(CB_S_I_S_S cCallback, char* operationID); -extern void set_app_background_status(CB_S_I_S_S cCallback, char* operationID, int isBackground); -extern void network_status_changed(CB_S_I_S_S cCallback, char* operationID); -extern GoInt get_login_status(char* operationID); -extern char* get_login_user(); -extern char* create_text_message(char* operationID, char* text); -extern char* create_advanced_text_message(char* operationID, char* text, char* messageEntityList); -extern char* create_text_at_message(char* operationID, char* text, char* atUserList, char* atUsersInfo, char* message); -extern char* create_location_message(char* operationID, char* description, double longitude, double latitude); -extern char* create_custom_message(char* operationID, char* data, char* extension, char* description); -extern char* create_quote_message(char* operationID, char* text, char* message); -extern char* create_advanced_quote_message(char* operationID, char* text, char* message, char* messageEntityList); -extern char* create_card_message(char* operationID, char* cardInfo); -extern char* create_video_message_from_full_path(char* operationID, char* videoFullPath, char* videoType, long long int duration, char* snapshotFullPath); -extern char* create_image_message_from_full_path(char* operationID, char* imageFullPath); -extern char* create_sound_message_from_full_path(char* operationID, char* soundPath, long long int duration); -extern char* create_file_message_from_full_path(char* operationID, char* fileFullPath, char* fileName); -extern char* create_image_message(char* operationID, char* imagePath); -extern char* create_image_message_by_url(char* operationID, char* sourcePath, char* sourcePicture, char* bigPicture, char* snapshotPicture); -extern char* create_sound_message_by_url(char* operationID, char* soundBaseInfo); -extern char* create_sound_message(char* operationID, char* soundPath, long long int duration); -extern char* create_video_message_by_url(char* operationID, char* videoBaseInfo); -extern char* create_video_message(char* operationID, char* videoPath, char* videoType, long long int duration, char* snapshotPath); -extern char* create_file_message_by_url(char* operationID, char* fileBaseInfo); -extern char* create_file_message(char* operationID, char* filePath, char* fileName); -extern char* create_merger_message(char* operationID, char* messageList, char* title, char* summaryList); -extern char* create_face_message(char* operationID, int index, char* data); -extern char* create_forward_message(char* operationID, char* m); -extern void get_all_conversation_list(CB_S_I_S_S cCallback, char* operationID); -extern void get_conversation_list_split(CB_S_I_S_S cCallback, char* operationID, int offset, int count); -extern void get_one_conversation(CB_S_I_S_S cCallback, char* operationID, int sessionType, char* sourceID); -extern void get_multiple_conversation(CB_S_I_S_S cCallback, char* operationID, char* conversationIDList); -extern void set_conversation_msg_destruct_time(CB_S_I_S_S cCallback, char* operationID, char* conversationID, long long int msgDestructTime); -extern void set_conversation_is_msg_destruct(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int isMsgDestruct); -extern void hide_conversation(CB_S_I_S_S cCallback, char* operationID, char* conversationID); -extern void get_conversation_recv_message_opt(CB_S_I_S_S cCallback, char* operationID, char* conversationIDList); -extern void set_conversation_draft(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* draftText); -extern void reset_conversation_group_at_type(CB_S_I_S_S cCallback, char* operationID, char* conversationID); -extern void pin_conversation(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int isPinned); -extern void set_conversation_private_chat(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int isPrivate); -extern void set_conversation_burn_duration(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int duration); -extern void set_conversation_recv_message_opt(CB_S_I_S_S cCallback, char* operationID, char* conversationID, int opt); -extern void get_total_unread_msg_count(CB_S_I_S_S cCallback, char* operationID); -extern char* get_at_all_tag(char* operationID); -extern char* get_conversation_id_by_session_type(char* operationID, char* sourceID, int sessionType); -extern void send_message(CB_S_I_S_S_I cCallback, char* operationID, char* message, char* recvID, char* groupID, char* offlinePushInfo); -extern void send_message_not_oss(CB_S_I_S_S_I cCallback, char* operationID, char* message, char* recvID, char* groupID, char* offlinePushInfo); -extern void find_message_list(CB_S_I_S_S cCallback, char* operationID, char* findMessageOptions); -extern void get_advanced_history_message_list(CB_S_I_S_S cCallback, char* operationID, char* getMessageOptions); -extern void get_advanced_history_message_list_reverse(CB_S_I_S_S cCallback, char* operationID, char* getMessageOptions); -extern void revoke_message(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* clientMsgID); -extern void typing_status_update(CB_S_I_S_S cCallback, char* operationID, char* recvID, char* msgTip); -extern void mark_conversation_message_as_read(CB_S_I_S_S cCallback, char* operationID, char* conversationID); -extern void delete_message_from_local_storage(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* clientMsgID); -extern void delete_message(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* clientMsgID); -extern void hide_all_conversations(CB_S_I_S_S cCallback, char* operationID); -extern void delete_all_msg_from_local_and_svr(CB_S_I_S_S cCallback, char* operationID); -extern void delete_all_msg_from_local(CB_S_I_S_S cCallback, char* operationID); -extern void clear_conversation_and_delete_all_msg(CB_S_I_S_S cCallback, char* operationID, char* conversationID); -extern void delete_conversation_and_delete_all_msg(CB_S_I_S_S cCallback, char* operationID, char* conversationID); -extern void insert_single_message_to_local_storage(CB_S_I_S_S cCallback, char* operationID, char* message, char* recvID, char* sendID); -extern void insert_group_message_to_local_storage(CB_S_I_S_S cCallback, char* operationID, char* message, char* groupID, char* sendID); -extern void search_local_messages(CB_S_I_S_S cCallback, char* operationID, char* searchParam); -extern void set_message_local_ex(CB_S_I_S_S cCallback, char* operationID, char* conversationID, char* clientMsgID, char* localEx); -extern void get_users_info(CB_S_I_S_S cCallback, char* operationID, char* userIDs); -extern void get_users_info_with_cache(CB_S_I_S_S cCallback, char* operationID, char* userIDs, char* groupID); -extern void get_users_info_from_srv(CB_S_I_S_S cCallback, char* operationID, char* userIDs); -extern void set_self_info(CB_S_I_S_S cCallback, char* operationID, char* userInfo); -extern void set_global_recv_message_opt(CB_S_I_S_S cCallback, char* operationID, int opt); -extern void get_self_user_info(CB_S_I_S_S cCallback, char* operationID); -extern void update_msg_sender_info(CB_S_I_S_S cCallback, char* operationID, char* nickname, char* faceURL); -extern void subscribe_users_status(CB_S_I_S_S cCallback, char* operationID, char* userIDs); -extern void unsubscribe_users_status(CB_S_I_S_S cCallback, char* operationID, char* userIDs); -extern void get_subscribe_users_status(CB_S_I_S_S cCallback, char* operationID); -extern void get_user_status(CB_S_I_S_S cCallback, char* operationID, char* userIDs); - -// =====================================================friend=============================================== -// -extern void get_specified_friends_info(CB_S_I_S_S cCallback, char* operationID, char* userIDList); -extern void get_friend_list(CB_S_I_S_S cCallback, char* operationID); -extern void get_friend_list_page(CB_S_I_S_S cCallback, char* operationID, int offset, int count); -extern void search_friends(CB_S_I_S_S cCallback, char* operationID, char* searchParam); -extern void check_friend(CB_S_I_S_S cCallback, char* operationID, char* userIDList); -extern void add_friend(CB_S_I_S_S cCallback, char* operationID, char* userIDReqMsg); -extern void set_friend_remark(CB_S_I_S_S cCallback, char* operationID, char* userIDRemark); -extern void delete_friend(CB_S_I_S_S cCallback, char* operationID, char* friendUserID); -extern void get_friend_application_list_as_recipient(CB_S_I_S_S cCallback, char* operationID); -extern void get_friend_application_list_as_applicant(CB_S_I_S_S cCallback, char* operationID); -extern void accept_friend_application(CB_S_I_S_S cCallback, char* operationID, char* userIDHandleMsg); -extern void refuse_friend_application(CB_S_I_S_S cCallback, char* operationID, char* userIDHandleMsg); -extern void add_black(CB_S_I_S_S cCallback, char* operationID, char* blackUserID); -extern void get_black_list(CB_S_I_S_S cCallback, char* operationID); -extern void remove_black(CB_S_I_S_S cCallback, char* operationID, char* removeUserID); - -// =====================================================group=============================================== -// CreateGroup creates a group -// -extern void create_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupReqInfo); - -// JoinGroup joins a group -// -extern void join_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cReqMsg, int cJoinSource); - -// QuitGroup quits a group -// -extern void quit_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID); - -// DismissGroup dismisses a group -// -extern void dismiss_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID); - -// ChangeGroupMute changes the mute status of a group -// -extern void change_group_mute(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cIsMute); - -// ChangeGroupMemberMute changes the mute status of a group member -// -extern void change_group_member_mute(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cUserID, int cMutedSeconds); - -// SetGroupMemberRoleLevel sets the role level of a group member -// -extern void set_group_member_role_level(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cUserID, int cRoleLevel); - -// SetGroupMemberInfo sets the information of a group member -// -extern void set_group_member_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupMemberInfo); - -// GetJoinedGroupList retrieves the list of joined groups -// -extern void get_joined_group_list(CB_S_I_S_S cCallback, char* operationID); - -// GetSpecifiedGroupsInfo retrieves the information of specified groups -// -extern void get_specified_groups_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupIDList); - -// SearchGroups searches for groups -// -extern void search_groups(CB_S_I_S_S cCallback, char* operationID, char* cSearchParam); - -// SetGroupInfo sets the information of a group -// -extern void set_group_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupInfo); - -// SetGroupVerification sets the verification mode of a group -// -extern void set_group_verification(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cVerification); - -// SetGroupLookMemberInfo sets the member information visibility of a group -// -extern void set_group_look_member_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cRule); - -// SetGroupApplyMemberFriend sets the friend rule for group applicants -// -extern void set_group_apply_member_friend(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cRule); - -// GetGroupMemberList retrieves the list of group members -// -extern void get_group_member_list(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cFilter, int cOffset, int cCount); - -// GetGroupMemberOwnerAndAdmin retrieves the owner and admin members of a group -// -extern void get_group_member_owner_and_admin(CB_S_I_S_S cCallback, char* operationID, char* cGroupID); - -// GetGroupMemberListByJoinTimeFilter retrieves the list of group members filtered by join time -// -extern void get_group_member_list_by_join_time_filter(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, int cOffset, int cCount, long long int cJoinTimeBegin, long long int cJoinTimeEnd, char* cFilterUserIDList); - -// GetSpecifiedGroupMembersInfo retrieves the information of specified group members -// -extern void get_specified_group_members_info(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cUserIDList); - -// KickGroupMember kicks group members -// -extern void kick_group_member(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cReason, char* cUserIDList); - -// TransferGroupOwner transfers the ownership of a group -// -extern void transfer_group_owner(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cNewOwnerUserID); - -// InviteUserToGroup invites users to a group -// -extern void invite_user_to_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cReason, char* cUserIDList); - -// GetGroupApplicationListAsRecipient retrieves the group application list as a recipient -// -extern void get_group_application_list_as_recipient(CB_S_I_S_S cCallback, char* operationID); - -// GetGroupApplicationListAsApplicant retrieves the group application list as an applicant -// -extern void get_group_application_list_as_applicant(CB_S_I_S_S cCallback, char* operationID); - -// AcceptGroupApplication accepts a group application -// -extern void accept_group_application(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cFromUserID, char* cHandleMsg); - -// RefuseGroupApplication refuses a group application -// -extern void refuse_group_application(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cFromUserID, char* cHandleMsg); - -// SetGroupMemberNickname sets the nickname of a group member -// -extern void set_group_member_nickname(CB_S_I_S_S cCallback, char* operationID, char* cGroupID, char* cUserID, char* cGroupMemberNickname); - -// SearchGroupMembers searches for group members -// -extern void search_group_members(CB_S_I_S_S cCallback, char* operationID, char* cSearchParam); - -// IsJoinGroup checks if the user has joined a group -// -extern void is_join_group(CB_S_I_S_S cCallback, char* operationID, char* cGroupID); - -#ifdef __cplusplus -} -#endif diff --git a/c_cpp_wrapper/openimsdkcc.cc b/c_cpp_wrapper/openimsdkcc.cc deleted file mode 100644 index 9d66546..0000000 --- a/c_cpp_wrapper/openimsdkcc.cc +++ /dev/null @@ -1,866 +0,0 @@ -#include "openimsdkcc.h" - -#include "wrapp_cpp_function.inc" - -namespace openim { - -// // ===================================================== init =============================================== -// must be called before use sdk - -// instance pattern -OpenIMManager& OpenIMManager::GetInstance() -{ - static OpenIMManager instance; - return instance; -} - -// must be called before use sdk -bool OpenIMManager::InitSDK(const std::function& cCallback, const std::string &operationID, const std::string &config) -{ - char *operationID_cs = const_cast(operationID.c_str()); - char *config_cs = const_cast(config.c_str()); - int ret=init_sdk(_wrapper_cpp_function(cCallback), operationID_cs, config_cs); - return (ret&1)==1; -} - - - -// release resouces used by SDK -void OpenIMManager::UnInitSDK(const std::string &operationID) -{ - // TODO: free all functions in function pool - - char *operationID_cs = const_cast(operationID.c_str()); - return un_init_sdk(operationID_cs); -} - -// // ===================================================== set listener =============================================== -// impl for set listener, this callback function will be keep in memory,until call SetXXXListener again - -// for debug -// void OpenIMManager::SetPrint(const std::function& printCallBack) -// { -// this->printCallBack = _wrapper_cpp_function(printCallBack); -// set_print((CB_S)((this->printCallBack).target())); -// } - -void OpenIMManager::SetAdvancedMsgListener(const std::function& advancedMsgListenerCallback) -{ - set_advanced_msg_listener(_wrapper_cpp_function(advancedMsgListenerCallback)); -} -void OpenIMManager::SetBatchMsgListener(const std::function& batchMsgListenerCallback) -{ - set_batch_msg_listener(_wrapper_cpp_function(batchMsgListenerCallback)); -} -void OpenIMManager::SetConversationListener(const std::function& conversationListenerCallback) -{ - set_conversation_listener(_wrapper_cpp_function(conversationListenerCallback)); -} -void OpenIMManager::SetCustomBusinessListener(const std::function& customBusinessListenerCallback) -{ - set_custom_business_listener(_wrapper_cpp_function(customBusinessListenerCallback)); -} -void OpenIMManager::SetFriendListener(const std::function& friendListenerCallback) -{ - set_friend_listener(_wrapper_cpp_function(friendListenerCallback)); -} -void OpenIMManager::SetGroupListener(const std::function& groupListenerCallback) -{ - set_group_listener(_wrapper_cpp_function(groupListenerCallback)); -} -void OpenIMManager::SetUserListener(const std::function& userListenerCallback) -{ - set_user_listener(_wrapper_cpp_function(userListenerCallback)); -} - -// // ===================================================== CallOnce Callback =============================================== -// callback function arg below will be free after call once, so we need to wrapp it to onetime -// // ===================================================== message =============================================== - -// // ===================================================== login logout =============================================== -void OpenIMManager::Login(const std::function& loginCallback, const std::string& operationID, const std::string& uid, const std::string& token) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* uid_cs=const_cast(uid.c_str()); - char* token_cs=const_cast(token.c_str()); - login(_wrapper_callonce_cpp_function(loginCallback),operationID_cs,uid_cs,token_cs); -} - -void OpenIMManager::Logout(const std::function& logoutCallback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - logout(_wrapper_callonce_cpp_function(logoutCallback),operationID_cs); -} - -GoInt OpenIMManager::GetLoginStatus(const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - return get_login_status(operationID_cs); -} - -std::string OpenIMManager::GetLoginUser() -{ - char* user=get_login_user(); - std::string user_str(user); - free(user); - return get_login_user(); -} - -void OpenIMManager::NetworkStatusChanged(const std::function& networkStatusCallback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - network_status_changed(_wrapper_callonce_cpp_function(networkStatusCallback),operationID_cs); -} - - -// // ===================================================== message =============================================== -// // - -// create text message -std::string OpenIMManager::CreateTextMessage(const std::string& operationID, const std::string& text) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* text_cs=const_cast(text.c_str()); - char* result_cs=create_text_message(operationID_cs,text_cs); - std::string result(result_cs); - // release dynamic c string memory - free(result_cs); - return result; -} - -// create advanced text message -std::string OpenIMManager::CreateAdvancedTextMessage(const std::string& operationID, const std::string& text, const std::string& messageEntityList) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* text_cs=const_cast(text.c_str()); - char* messageEntityList_cs=const_cast(messageEntityList.c_str()); - char* result_cs=create_advanced_text_message(operationID_cs,text_cs,messageEntityList_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create text at message -std::string OpenIMManager::CreateTextAtMessage(const std::string& operationID, const std::string& text, const std::string& atUserList, const std::string& atUsersInfo, const std::string& message) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* text_cs=const_cast(text.c_str()); - char* atUserList_cs=const_cast(atUserList.c_str()); - char* atUsersInfo_cs=const_cast(atUsersInfo.c_str()); - char* message_cs=const_cast(message.c_str()); - char* result_cs=create_text_at_message(operationID_cs,text_cs,atUserList_cs,atUsersInfo_cs,message_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create location message -std::string OpenIMManager::CreateLocationMessage(const std::string& operationID, const std::string& description, double longitude, double latitude) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* description_cs=const_cast(description.c_str()); - char* result_cs=create_location_message(operationID_cs,description_cs,longitude,latitude); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create custom message -std::string OpenIMManager::CreateCustomMessage(const std::string& operationID, const std::string& data, const std::string& extension, const std::string& description) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* data_cs=const_cast(data.c_str()); - char* extension_cs=const_cast(extension.c_str()); - char* description_cs=const_cast(description.c_str()); - char* result_cs=create_custom_message(operationID_cs,data_cs,extension_cs,description_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create quote message -std::string OpenIMManager::CreateQuoteMessage(const std::string& operationID, const std::string& text, const std::string& message) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* text_cs=const_cast(text.c_str()); - char* message_cs=const_cast(message.c_str()); - char* result_cs=create_quote_message(operationID_cs,text_cs,message_cs); - std::string result(result_cs); - free(result_cs); - return result; - -} - -// create advanced quote message -std::string OpenIMManager::CreateAdvancedQuoteMessage(const std::string& operationID, const std::string& text, const std::string& message, const std::string& messageEntityList) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* text_cs=const_cast(text.c_str()); - char* message_cs=const_cast(message.c_str()); - char* messageEntityList_cs=const_cast(messageEntityList.c_str()); - char* result_cs=create_advanced_quote_message(operationID_cs,text_cs,message_cs,messageEntityList_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create card message -std::string OpenIMManager::CreateCardMessage(const std::string& operationID, const std::string& cardInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* cardInfo_cs=const_cast(cardInfo.c_str()); - char* result_cs=create_card_message(operationID_cs,cardInfo_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create video message from full path -std::string OpenIMManager::CreateVideoMessageFromFullPath(const std::string& operationID, const std::string& videoFullPath, const std::string& videoType, long long int duration, const std::string& snapshotFullPath) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* videoFullPath_cs=const_cast(videoFullPath.c_str()); - char* videoType_cs=const_cast(videoType.c_str()); - char* snapshotFullPath_cs=const_cast(snapshotFullPath.c_str()); - char* result_cs=create_video_message_from_full_path(operationID_cs,videoFullPath_cs,videoType_cs,duration,snapshotFullPath_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create image message from full path -std::string OpenIMManager::CreateImageMessageFromFullPath(const std::string& operationID, const std::string& imageFullPath) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* imageFullPath_cs=const_cast(imageFullPath.c_str()); - char* result_cs=create_image_message_from_full_path(operationID_cs,imageFullPath_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create sound message from full path -std::string OpenIMManager::CreateSoundMessageFromFullPath(const std::string& operationID, const std::string& soundPath, long long int duration) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* soundPath_cs=const_cast(soundPath.c_str()); - char* result_cs=create_sound_message_from_full_path(operationID_cs,soundPath_cs,duration); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create file message from full path -std::string OpenIMManager::CreateFileMessageFromFullPath(const std::string& operationID, const std::string& fileFullPath, const std::string& fileName) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* fileFullPath_cs=const_cast(fileFullPath.c_str()); - char* fileName_cs=const_cast(fileName.c_str()); - char* result_cs=create_file_message_from_full_path(operationID_cs,fileFullPath_cs,fileName_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create image message -std::string OpenIMManager::CreateImageMessage(const std::string& operationID, const std::string& imagePath) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* imagePath_cs=const_cast(imagePath.c_str()); - char* result_cs=create_image_message(operationID_cs,imagePath_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create image message by URL -std::string OpenIMManager::CreateImageMessageByURL(const std::string& operationID,const std::string& sourcePath, const std::string& sourcePicture, const std::string& bigPicture, const std::string& snapshotPicture) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* sourcePath_cs=const_cast(sourcePath.c_str()); - char* sourcePicture_cs=const_cast(sourcePicture.c_str()); - char* bigPicture_cs=const_cast(bigPicture.c_str()); - char* snapshotPicture_cs=const_cast(snapshotPicture.c_str()); - char* result_cs=create_image_message_by_url(operationID_cs,sourcePath_cs,sourcePicture_cs,bigPicture_cs,snapshotPicture_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create sound message by URL -std::string OpenIMManager::CreateSoundMessageByURL(const std::string& operationID, const std::string& soundBaseInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* soundBaseInfo_cs=const_cast(soundBaseInfo.c_str()); - char* result_cs=create_sound_message_by_url(operationID_cs,soundBaseInfo_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create sound message -std::string OpenIMManager::CreateSoundMessage(const std::string& operationID, const std::string& soundPath, long long int duration) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* soundPath_cs=const_cast(soundPath.c_str()); - char* result_cs=create_sound_message(operationID_cs,soundPath_cs,duration); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create video message by URL -std::string OpenIMManager::CreateVideoMessageByURL(const std::string& operationID, const std::string& videoBaseInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* videoBaseInfo_cs=const_cast(videoBaseInfo.c_str()); - char* result_cs=create_video_message_by_url(operationID_cs,videoBaseInfo_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create video message -std::string OpenIMManager::CreateVideoMessage(const std::string& operationID, const std::string& videoPath, const std::string& videoType, long long int duration, const std::string& snapshotPath) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* videoPath_cs=const_cast(videoPath.c_str()); - char* videoType_cs=const_cast(videoType.c_str()); - char* snapshotPath_cs=const_cast(snapshotPath.c_str()); - char* result_cs=create_video_message(operationID_cs,videoPath_cs,videoType_cs,duration,snapshotPath_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create file message by URL -std::string OpenIMManager::CreateFileMessageByURL(const std::string& operationID, const std::string& fileBaseInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* fileBaseInfo_cs=const_cast(fileBaseInfo.c_str()); - char* result_cs=create_file_message_by_url(operationID_cs,fileBaseInfo_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create file message -std::string OpenIMManager::CreateFileMessage(const std::string& operationID, const std::string& filePath, const std::string& fileName) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* filePath_cs=const_cast(filePath.c_str()); - char* fileName_cs=const_cast(fileName.c_str()); - char* result_cs=create_file_message(operationID_cs,filePath_cs,fileName_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create merger message -std::string OpenIMManager::CreateMergerMessage(const std::string& operationID, const std::string& messageList, const std::string& title, const std::string& summaryList) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* messageList_cs=const_cast(messageList.c_str()); - char* title_cs=const_cast(title.c_str()); - char* summaryList_cs=const_cast(summaryList.c_str()); - char* result_cs=create_merger_message(operationID_cs,messageList_cs,title_cs,summaryList_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create face message -std::string OpenIMManager::CreateFaceMessage(const std::string& operationID, int index, const std::string& data) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* data_cs=const_cast(data.c_str()); - char* result_cs=create_face_message(operationID_cs,index,data_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// create forward message -std::string OpenIMManager::CreateForwardMessage(const std::string& operationID, const std::string& m) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* m_cs=const_cast(m.c_str()); - char* result_cs=create_forward_message(operationID_cs,m_cs); - std::string result(result_cs); - free(result_cs); - return result; -} - -// get all conversation list -void OpenIMManager::GetAllConversationList(const std::function& getAllConversationListCallback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_all_conversation_list(_wrapper_callonce_cpp_function(getAllConversationListCallback),operationID_cs); -} - -// get advanced history message list -void OpenIMManager::GetAdvancedHistoryMessageList(const std::function& getAdvancedHistoryCallback , const std::string& operationID, const std::string& getMessageOptions) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* getMessageOptions_cs=const_cast(getMessageOptions.c_str()); - get_advanced_history_message_list(_wrapper_callonce_cpp_function(getAdvancedHistoryCallback),operationID_cs,getMessageOptions_cs); -} - -// send message -void SendMessage(const std::function& sendMessageCallback, const std::string& operationID, const std::string& message,const std::string& recvID,const std::string& groupID,const std::string& offlinePushInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* message_cs=const_cast(message.c_str()); - char* recvID_cs=const_cast(recvID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* offlinePushInfo_cs=const_cast(offlinePushInfo.c_str()); - send_message(_wrapper_callonce_cpp_function(sendMessageCallback),operationID_cs,message_cs,recvID_cs,groupID_cs,offlinePushInfo_cs); -} - -// // ===================================================== user =============================================== -// // - -// get users info -void OpenIMManager::GetUsersInfo(const std::function& callback, const std::string& operationID, const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - get_users_info(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); -} - -// get users info from server -void OpenIMManager::GetUsersInfoFromServer(const std::function& callback, const std::string& operationID,const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - get_users_info_from_srv(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); -} - -// set self info -void OpenIMManager::SetSelfInfo(const std::function& callback,const std::string& operationID, const std::string& selfInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* selfInfo_cs=const_cast(selfInfo.c_str()); - set_self_info(_wrapper_callonce_cpp_function(callback),operationID_cs,selfInfo_cs); -} - -// get self user info -void OpenIMManager::GetSelfUserInfo(const std::function& callback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_self_user_info(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// update message sender info -void OpenIMManager::UpdateMessageSenderInfo(const std::function& callback, const std::string& operationID, const std::string& nickname,const std::string& faceURL) -{ - //TODO - char* operationID_cs=const_cast(operationID.c_str()); - char* nickname_cs=const_cast(nickname.c_str()); - char* faceURL_cs=const_cast(faceURL.c_str()); - update_msg_sender_info(_wrapper_callonce_cpp_function(callback),operationID_cs,nickname_cs,faceURL_cs); -} - -// subscribe users status -void OpenIMManager::SubscribeUsersStatus(const std::function& callback,const std::string& operationID, const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - subscribe_users_status(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); -} - -// unsubscribe users status -void OpenIMManager::UnsubscribeUsersStatus(const std::function& callback,const std::string& operationID, const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - unsubscribe_users_status(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); -} - -// get subscribe users status -void OpenIMManager::GetSubscribeUsersStatus(const std::function& callback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_subscribe_users_status(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// get user status -void OpenIMManager::GetUserStatus(const std::function& callback,const std::string& operationID, const std::string& userID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userID_cs=const_cast(userID.c_str()); - get_user_status(_wrapper_callonce_cpp_function(callback),operationID_cs,userID_cs); -} - -// // ===================================================== friend =============================================== -// // - -// get specified friends info -void OpenIMManager::GetSpecifiedFriendsInfo(const std::function& callback,const std::string& operationID, const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - get_specified_friends_info(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); -} - -// get friend list -void OpenIMManager::GetFriendList(const std::function& callback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_friend_list(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// get friend list page -void OpenIMManager::GetFriendListPage(const std::function& callback, const std::string& operationID, int offset, int count) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_friend_list_page(_wrapper_callonce_cpp_function(callback),operationID_cs,offset,count); -} - -// search friends -void OpenIMManager::SearchFriends(const std::function& callback,const std::string& operationID, const std::string& searchParam) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* searchParam_cs=const_cast(searchParam.c_str()); - search_friends(_wrapper_callonce_cpp_function(callback),operationID_cs,searchParam_cs); -} - -// check friend -void OpenIMManager::CheckFriend(const std::function& callback,const std::string& operationID, const std::string& userID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userID_cs=const_cast(userID.c_str()); - check_friend(_wrapper_callonce_cpp_function(callback),operationID_cs,userID_cs); -} - -// add friend -void OpenIMManager::AddFriend(const std::function& callback, const std::string& friendInfo, const std::string& addFriendExtraInfo) -{ - char* friendInfo_cs=const_cast(friendInfo.c_str()); - char* addFriendExtraInfo_cs=const_cast(addFriendExtraInfo.c_str()); - add_friend(_wrapper_callonce_cpp_function(callback),friendInfo_cs,addFriendExtraInfo_cs); -} - -// set friend remark -void OpenIMManager::SetFriendRemark(const std::function& callback, const std::string& userID, const std::string& remark) -{ - char* userID_cs=const_cast(userID.c_str()); - char* remark_cs=const_cast(remark.c_str()); - set_friend_remark(_wrapper_callonce_cpp_function(callback),userID_cs,remark_cs); -} - -// delete friend -void OpenIMManager::DeleteFriend(const std::function& callback, const std::string& userID, const std::string& deleteFriendExtraInfo) -{ - char* userID_cs=const_cast(userID.c_str()); - char* deleteFriendExtraInfo_cs=const_cast(deleteFriendExtraInfo.c_str()); - delete_friend(_wrapper_callonce_cpp_function(callback),userID_cs,deleteFriendExtraInfo_cs); -} - -// get friend application list as recipant -void OpenIMManager::GetFriendApplicationListAsRecipant(const std::function& callback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_friend_application_list_as_recipient(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// get friend application list as applicant -void OpenIMManager::GetFriendApplicationListAsApplicant(const std::function& callback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_friend_application_list_as_applicant(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// accept friend application -void OpenIMManager::AcceptFriendApplication(const std::function& callback, const std::string& friendApplicationID, const std::string& extraInfo) -{ - char* friendApplicationID_cs=const_cast(friendApplicationID.c_str()); - char* extraInfo_cs=const_cast(extraInfo.c_str()); - accept_friend_application(_wrapper_callonce_cpp_function(callback),friendApplicationID_cs,extraInfo_cs); -} - -// refuse friend application -void OpenIMManager::RefuseFriendApplication(const std::function& callback, const std::string& friendApplicationID, const std::string& extraInfo) -{ - char* friendApplicationID_cs=const_cast(friendApplicationID.c_str()); - char* extraInfo_cs=const_cast(extraInfo.c_str()); - refuse_friend_application(_wrapper_callonce_cpp_function(callback),friendApplicationID_cs,extraInfo_cs); -} - -// add black -void OpenIMManager::AddBlack(const std::function& callback,const std::string& operationID, const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - add_black(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); -} - -// get black list -void OpenIMManager::GetBlackList(const std::function& callback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_black_list(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// remove black -void OpenIMManager::RemoveBlack(const std::function& callback,const std::string& operationID, const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - remove_black(_wrapper_callonce_cpp_function(callback),operationID_cs,userIDs_cs); -} - -// // ===================================================== group =============================================== -// // - -// create group -void OpenIMManager::CreateGroup(const std::function& callback, const std::string& operationID, const std::string& groupReqInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupReqInfo_cs=const_cast(groupReqInfo.c_str()); - create_group(_wrapper_callonce_cpp_function(callback),operationID_cs,groupReqInfo_cs); -} - -// join group -void OpenIMManager::JoinGroup(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& reqMsg, int joinSource) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* reqMsg_cs=const_cast(reqMsg.c_str()); - join_group(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,reqMsg_cs,joinSource); -} - -// quit group -void OpenIMManager::QuitGroup(const std::function& callback, const std::string& groupID, const std::string& reqMsg) -{ - char* groupID_cs=const_cast(groupID.c_str()); - char* reqMsg_cs=const_cast(reqMsg.c_str()); - quit_group(_wrapper_callonce_cpp_function(callback),groupID_cs,reqMsg_cs); -} - -// dismiss group -void OpenIMManager::DismissGroup(const std::function& callback, const std::string& groupID, const std::string& reqMsg) -{ - char* groupID_cs=const_cast(groupID.c_str()); - char* reqMsg_cs=const_cast(reqMsg.c_str()); - dismiss_group(_wrapper_callonce_cpp_function(callback),groupID_cs,reqMsg_cs); -} - -// change group mute -void OpenIMManager::ChangeGroupMute(const std::function& callback,const std::string& operationID, const std::string& groupID, bool mute) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - change_group_mute(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,mute); -} - -// change group member mute -void OpenIMManager::ChangeGroupMemberMute(const std::function& callback,const std::string& operationID, const std::string& groupID, const std::string& memberID, int mutedSeconds) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* memberID_cs=const_cast(memberID.c_str()); - change_group_member_mute(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,memberID_cs,mutedSeconds); -} - - -// set the role level of a group member -void OpenIMManager::SetGroupMemberRoleLevel(const std::function& callback,const std::string& operationID, const std::string& groupID, const std::string& memberID, int roleLevel) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* memberID_cs=const_cast(memberID.c_str()); - set_group_member_role_level(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,memberID_cs,roleLevel); -} - -// set the information of a group member -void OpenIMManager::SetGroupMemberInfo(const std::function& callback, const std::string& operationID, const std::string& groupMemberInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupMemberInfo_cs=const_cast(groupMemberInfo.c_str()); - set_group_member_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupMemberInfo_cs); -} - -// get Joined Group List -void OpenIMManager::GetJoinedGroupList(const std::function& callback, const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_joined_group_list(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// get specified groups info -void OpenIMManager::GetSpecifiedGroupsInfo(const std::function& callback,const std::string& operationID, const std::string& groupIDList) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupIDList_cs=const_cast(groupIDList.c_str()); - get_specified_groups_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupIDList_cs); -} - -// search groups -void OpenIMManager::SearchGroups(const std::function& callback,const std::string& operationID, const std::string& searchParam) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* searchParam_cs=const_cast(searchParam.c_str()); - search_groups(_wrapper_callonce_cpp_function(callback),operationID_cs,searchParam_cs); -} - -// set group info -void OpenIMManager::SetGroupInfo(const std::function& callback,const std::string& operationID, const std::string& groupInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupInfo_cs=const_cast(groupInfo.c_str()); - set_group_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupInfo_cs); -} - -// set group verification -void OpenIMManager::SetGroupVerification(const std::function& callback,const std::string& operationID, const std::string& groupID, int verification) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - set_group_verification(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,verification); -} - -// set group look member info -void OpenIMManager::SetGroupLookMemberInfo(const std::function& callback,const std::string& operationID, const std::string& groupID, int lookInfo) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - set_group_look_member_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,lookInfo); -} - -// set group apply member friend -void OpenIMManager::SetGroupApplyMemberFriend(const std::function& callback,const std::string& operationID, const std::string& groupID, int rule) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - set_group_apply_member_friend(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,rule); -} - -// get group member list -void OpenIMManager::GetGroupMemberList(const std::function& callback,const std::string& operationID, const std::string& groupID,int filter,int offset,int count) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - get_group_member_list(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,filter,offset,count); -} - - -// get group member owner and admin -void OpenIMManager::GetGroupMemberOwnerAndAdmin(const std::function& callback, const std::string& operationID,const std::string& groupID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - get_group_member_owner_and_admin(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs); -} - -// get group application list -void OpenIMManager::GetGroupMemberListByJoinTimeFilter(const std::function& callback, const std::string& operationID, const std::string& groupID, int offset, int count, long long int joinTimeBegin, long long int joinTimeEnd, const std::string& filteruserIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* filteruserIDs_cs=const_cast(filteruserIDs.c_str()); - get_group_member_list_by_join_time_filter(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,offset,count,joinTimeBegin,joinTimeEnd,filteruserIDs_cs); -} - -// get specified group members info -void OpenIMManager::GetSpecifiedGroupMembersInfo(const std::function& callback, const std::string& operationID,const std::string& groupID, const std::string& memberIDList) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* memberIDList_cs=const_cast(memberIDList.c_str()); - get_specified_group_members_info(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,memberIDList_cs); -} - -// kick group members -void OpenIMManager::KickGroupMember(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& reason, const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* reason_cs=const_cast(reason.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - kick_group_member(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,reason_cs,userIDs_cs); -} - - -// transfers the ownership of a group -void OpenIMManager::TransferGroupOwner(const std::function& callback, const std::string& groupID, const std::string& memberID, const std::string& notifyMsg) -{ - char* groupID_cs=const_cast(groupID.c_str()); - char* memberID_cs=const_cast(memberID.c_str()); - char* notifyMsg_cs=const_cast(notifyMsg.c_str()); - transfer_group_owner(_wrapper_callonce_cpp_function(callback),groupID_cs,memberID_cs,notifyMsg_cs); -} - -// invites users to a group -void OpenIMManager::InviteUserToGroup(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& reason, const std::string& userIDs) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* reason_cs=const_cast(reason.c_str()); - char* userIDs_cs=const_cast(userIDs.c_str()); - invite_user_to_group(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,reason_cs,userIDs_cs); -} - -// retrives the group application list as a recipient -void OpenIMManager::GetGroupApplicationListAsRecipient(const std::function& callback,const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_group_application_list_as_recipient(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// retrives the group application list as an applicant -void OpenIMManager::GetGroupApplicationListAsApplicant(const std::function& callback,const std::string& operationID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - get_group_application_list_as_applicant(_wrapper_callonce_cpp_function(callback),operationID_cs); -} - -// accept a group application -void OpenIMManager::AcceptGroupApplication(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& fromUserID, const std::string& handleMsg) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* fromUserID_cs=const_cast(fromUserID.c_str()); - char* handleMsg_cs=const_cast(handleMsg.c_str()); - accept_group_application(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,fromUserID_cs,handleMsg_cs); -} - - -// refuses a group application -void OpenIMManager::RefuseGroupApplication(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& fromUserID, const std::string& handleMsg) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* fromUserID_cs=const_cast(fromUserID.c_str()); - char* handleMsg_cs=const_cast(handleMsg.c_str()); - refuse_group_application(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,fromUserID_cs,handleMsg_cs); -} - -// set group member nickname -void OpenIMManager::SetGroupMemberNickname(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& userID, const std::string& groupMemberNickname) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - char* userID_cs=const_cast(userID.c_str()); - char* groupMemberNickname_cs=const_cast(groupMemberNickname.c_str()); - set_group_member_nickname(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs,userID_cs,groupMemberNickname_cs); -} - -// search group members -void OpenIMManager::SearchGroupMembers(const std::function& callback, const std::string& operationID, const std::string& searchParam) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* searchParam_cs=const_cast(searchParam.c_str()); - search_group_members(_wrapper_callonce_cpp_function(callback),operationID_cs,searchParam_cs); -} - -// check if the user has joined a certain group -void OpenIMManager::IsJoinGroup(const std::function& callback,const std::string& operationID, const std::string& groupID) -{ - char* operationID_cs=const_cast(operationID.c_str()); - char* groupID_cs=const_cast(groupID.c_str()); - is_join_group(_wrapper_callonce_cpp_function(callback),operationID_cs,groupID_cs); -} - - -} \ No newline at end of file diff --git a/c_cpp_wrapper/openimsdkcc.h b/c_cpp_wrapper/openimsdkcc.h deleted file mode 100644 index 12dcc89..0000000 --- a/c_cpp_wrapper/openimsdkcc.h +++ /dev/null @@ -1,323 +0,0 @@ -#pragma once - -#include "openimsdk.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include - - - -namespace openim{ - -class OpenIMManager -{ -private: -OpenIMManager(){} -public: - // instance pattern - static OpenIMManager& GetInstance(); - - //must be called before use sdk - bool InitSDK(const std::function& cCallback,const std::string& operationID,const std::string& config); - - void UnInitSDK(const std::string& operationID); - - // // set print - // void SetPrint(const std::function& printCallBack); - - // set group listener - void SetGroupListener(const std::function& groupListenerCallBack); - - // set conversation listener - void SetConversationListener(const std::function& conversationListenerCallback); - - // set advanced msg listener - void SetAdvancedMsgListener(const std::function& advancedMsgListenerCallback); - - // set batch msg listener - void SetBatchMsgListener(const std::function& batchMsgListenerCallback); - - // set user listener - void SetUserListener(const std::function& userListenerCallback); - - // set friend listener - void SetFriendListener(const std::function& friendListenerCallback); - - // set custom business listener - void SetCustomBusinessListener(const std::function& customBusinessListenerCallback); - - // login - void Login(const std::function& loginCallback, const std::string& operationID, const std::string& uid, const std::string& token); - - // logout - void Logout(const std::function& logoutCallback, const std::string& operationID); - - // network status changed - void NetworkStatusChanged(const std::function& networkStatusCallback, const std::string& operationID); - - // get login status - GoInt GetLoginStatus(const std::string& operationID); - - // get login user - std::string GetLoginUser(); - - // create text message - std::string CreateTextMessage(const std::string& operationID, const std::string& text); - - // create advanced text message - std::string CreateAdvancedTextMessage(const std::string& operationID, const std::string& text, const std::string& messageEntityList); - - // create text at message - std::string CreateTextAtMessage(const std::string& operationID, const std::string& text, const std::string& atUserList, const std::string& atUsersInfo, const std::string& message); - - // create location message - std::string CreateLocationMessage(const std::string& operationID, const std::string& description, double longitude, double latitude); - - // create custom message - std::string CreateCustomMessage(const std::string& operationID, const std::string& data, const std::string& extension, const std::string& description); - - // create quote message - std::string CreateQuoteMessage(const std::string& operationID, const std::string& text, const std::string& message); - - - // create advanced quote message - std::string CreateAdvancedQuoteMessage(const std::string& operationID, const std::string& text, const std::string& message, const std::string& messageEntityList); - - // create card message - std::string CreateCardMessage(const std::string& operationID, const std::string& cardInfo); - - // create video message from full path - std::string CreateVideoMessageFromFullPath(const std::string& operationID, const std::string& videoFullPath, const std::string& videoType, long long int duration, const std::string& snapshotFullPath); - - // create image message from full path - std::string CreateImageMessageFromFullPath(const std::string& operationID, const std::string& imageFullPath); - - // create sound message from full path - std::string CreateSoundMessageFromFullPath(const std::string& operationID, const std::string& soundPath, long long int duration); - - // create file message from full path - std::string CreateFileMessageFromFullPath(const std::string& operationID, const std::string& fileFullPath, const std::string& fileName); - - // create image message - std::string CreateImageMessage(const std::string& operationID, const std::string& imagePath); - - - // create image message by URL - std::string CreateImageMessageByURL(const std::string& operationID, const std::string& sourcePath,const std::string& sourcePicture, const std::string& bigPicture, const std::string& snapshotPicture); - - // create sound message by URL - std::string CreateSoundMessageByURL(const std::string& operationID, const std::string& soundBaseInfo); - - // create sound message - std::string CreateSoundMessage(const std::string& operationID, const std::string& soundPath, long long int duration); - - // create video message by URL - std::string CreateVideoMessageByURL(const std::string& operationID, const std::string& videoBaseInfo); - - // create video message - std::string CreateVideoMessage(const std::string& operationID, const std::string& videoPath, const std::string& videoType, long long int duration, const std::string& snapshotPath); - - // create file message by URL - std::string CreateFileMessageByURL(const std::string& operationID, const std::string& fileBaseInfo); - - // create file message - std::string CreateFileMessage(const std::string& operationID, const std::string& filePath, const std::string& fileName); - - // create merger message - std::string CreateMergerMessage(const std::string& operationID, const std::string& messageList, const std::string& title, const std::string& summaryList); - - // create face message - std::string CreateFaceMessage(const std::string& operationID, int index, const std::string& data); - - // create forward message - std::string CreateForwardMessage(const std::string& operationID, const std::string& m); - - // get all conversation list - void GetAllConversationList(const std::function& getAllConversationListCallback, const std::string& operationID); - - // get advanced history message list - void GetAdvancedHistoryMessageList(const std::function& getAdvancedHistoryCallback , const std::string& operationID, const std::string& getMessageOptions); - - // send message - void SendMessage(const std::function& callback, const std::string& operationID, const std::string& message, const std::string& recvID, const std::string& groupID, const std::string& offlinePushInfo); - - // // =====================================================user=============================================== - // // - - // get users info - void GetUsersInfo(const std::function& callback, const std::string& operationID, const std::string& userIDs); - - // get users info from server - void GetUsersInfoFromServer(const std::function& callback, const std::string& operationID, const std::string& userIDs); - - // set self info - void SetSelfInfo(const std::function& callback, const std::string& operationID, const std::string& userInfo); - - // get self user info - void GetSelfUserInfo(const std::function& callback, const std::string& operationID); - - // update message sender info - void UpdateMessageSenderInfo(const std::function& callback, const std::string& operationID, const std::string& nickname, const std::string& faceURL); - - // subscribe users status - void SubscribeUsersStatus(const std::function& callback, const std::string& operationID, const std::string& userIDs); - - - // unsubscribe users status - void UnsubscribeUsersStatus(const std::function& callback, const std::string& operationID, const std::string& userIDs); - - // get subscribe users status - void GetSubscribeUsersStatus(const std::function& callback, const std::string& operationID); - - // get user status - void GetUserStatus(const std::function& callback, const std::string& operationID, const std::string& userIDs); - - // // =====================================================friend=============================================== - // // - - // get specified friends info - void GetSpecifiedFriendsInfo(const std::function& callback, const std::string& operationID, const std::string& userIDs); - - // get friend list - void GetFriendList(const std::function& callback, const std::string& operationID); - - // get friend list page - void GetFriendListPage(const std::function& callback, const std::string& operationID, int offset, int count); - - // search friends - void SearchFriends(const std::function& callback, const std::string& operationID, const std::string& searchParam); - - // check friend - void CheckFriend(const std::function& callback, const std::string& operationID, const std::string& userIDs); - - // add friend - void AddFriend(const std::function& callback, const std::string& operationID, const std::string& userIDReqMsg); - - // set friend remark - void SetFriendRemark(const std::function& callback, const std::string& operationID, const std::string& userIDRemark); - - // delete friend - void DeleteFriend(const std::function& callback, const std::string& operationID, const std::string& friendUserID); - - // get friend application list as recipient - void GetFriendApplicationListAsRecipant(const std::function& callback, const std::string& operationID); - - // get friend application list as applicant - void GetFriendApplicationListAsApplicant(const std::function& callback, const std::string& operationID); - - // accept friend application - void AcceptFriendApplication(const std::function& callback, const std::string& operationID, const std::string& userIDHandleMsg); - - // refuse friend application - void RefuseFriendApplication(const std::function& callback, const std::string& operationID, const std::string& userIDHandleMsg); - - // add black - void AddBlack(const std::function& callback, const std::string& operationID, const std::string& blackUserID); - - // get black list - void GetBlackList(const std::function& callback, const std::string& operationID); - - // remove black - void RemoveBlack(const std::function& callback, const std::string& operationID, const std::string& removeUserID); - - - // // =====================================================group=============================================== - // // - - // create group - void CreateGroup(const std::function& callback, const std::string& operationID, const std::string& groupReqInfo); - - // join group - void JoinGroup(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& reqMsg, int joinSource); - - // quit group - void QuitGroup(const std::function& callback, const std::string& operationID, const std::string& groupID); - - // dismiss group - void DismissGroup(const std::function& callback, const std::string& operationID, const std::string& groupID); - - // change group mute - void ChangeGroupMute(const std::function& callback, const std::string& operationID, const std::string& groupID, bool isMute); - - // change group member mute - void ChangeGroupMemberMute(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& userID, int mutedSeconds); - - // SetGroupMemberRoleLevel sets the role level of a group member - void SetGroupMemberRoleLevel(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& userID, int roleLevel); - - // SetGroupMemberInfo sets the information of a group member - void SetGroupMemberInfo(const std::function& callback, const std::string& operationID, const std::string& groupMemberInfo); - - // GetJoinedGroupList retrieves the list of joined groups - void GetJoinedGroupList(const std::function& callback, const std::string& operationID); - - // GetSpecifiedGroupsInfo retrieves the information of specified groups - void GetSpecifiedGroupsInfo(const std::function& callback, const std::string& operationID, const std::string& groupIDList); - - // SearchGroups searches for groups - void SearchGroups(const std::function& callback, const std::string& operationID, const std::string& searchParam); - - // SetGroupInfo sets the information of a group - void SetGroupInfo(const std::function& callback, const std::string& operationID, const std::string& groupInfo); - - // SetGroupVerification sets the verification mode of a group - void SetGroupVerification(const std::function& callback, const std::string& operationID, const std::string& groupID, int verification); - - - // SetGroupLookMemberInfo sets the member information visibility of a group - void SetGroupLookMemberInfo(const std::function& callback, const std::string& operationID, const std::string& groupID, int rule); - - // SetGroupApplyMemberFriend sets the friend rule for group applicants - void SetGroupApplyMemberFriend(const std::function& callback, const std::string& operationID, const std::string& groupID, int rule); - - // GetGroupMemberList retrieves the list of group members - void GetGroupMemberList(const std::function& callback, const std::string& operationID, const std::string& groupID, int filter, int offset, int count); - - // GetGroupMemberOwnerAndAdmin retrieves the owner and admin members of a group - void GetGroupMemberOwnerAndAdmin(const std::function& callback, const std::string& operationID, const std::string& groupID); - - // GetGroupMemberListByJoinTimeFilter retrieves the list of group members filtered by join time - void GetGroupMemberListByJoinTimeFilter(const std::function& callback, const std::string& operationID, const std::string& groupID, int offset, int count, long long int joinTimeBegin, long long int joinTimeEnd, const std::string& filteruserIDs); - - // GetSpecifiedGroupMembersInfo retrieves the information of specified group members - void GetSpecifiedGroupMembersInfo(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& userIDs); - - // KickGroupMember kicks group members - void KickGroupMember(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& reason, const std::string& userIDs); - - // TransferGroupOwner transfers the ownership of a group - void TransferGroupOwner(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& newOwnerUserID); - - // InviteUserToGroup invites users to a group - void InviteUserToGroup(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& reason, const std::string& userIDs); - - // GetGroupApplicationListAsRecipient retrieves the group application list as a recipient - void GetGroupApplicationListAsRecipient(const std::function& callback, const std::string& operationID); - - // GetGroupApplicationListAsApplicant retrieves the group application list as an applicant - void GetGroupApplicationListAsApplicant(const std::function& callback, const std::string& operationID); - - // AcceptGroupApplication accepts a group application - void AcceptGroupApplication(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& fromUserID, const std::string& handleMsg); - - // RefuseGroupApplication refuses a group application - void RefuseGroupApplication(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& fromUserID, const std::string& handleMsg); - - // SetGroupMemberNickname sets the nickname of a group member - void SetGroupMemberNickname(const std::function& callback, const std::string& operationID, const std::string& groupID, const std::string& userID, const std::string& groupMemberNickname); - - // SearchGroupMembers searches for group members - void SearchGroupMembers(const std::function& callback, const std::string& operationID, const std::string& searchParam); - - // IsJoinGroup checks if the user has joined a group - void IsJoinGroup(const std::function& callback, const std::string& operationID, const std::string& groupID); - -}; - -} \ No newline at end of file diff --git a/c_cpp_wrapper/protocol.go b/c_cpp_wrapper/protocol.go deleted file mode 100644 index 38541c0..0000000 --- a/c_cpp_wrapper/protocol.go +++ /dev/null @@ -1,106 +0,0 @@ -package main - -/* -#include -#include -#include -typedef void (*CB_S)(char *); -typedef void (*CB_I_S)(int,char *); -typedef void (*CB_S_I_S_S)(char *,int,char *,char *); -typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int); - -CB_S DebugPrint; - -void Call_CB_S(CB_S func,char* data) -{ - if(func == NULL){ - printf("callback func is null\n"); - return; - } - func(data); -} - - -void Call_CB_I_S(CB_I_S func,int event,char* data) -{ - if(func == NULL){ - printf("callback func is null\n"); - return; - } - if (strcmp(data, "\"\"") == 0) { - strcpy(data, ""); - } - func(event,data); - if (data != NULL && data[0] != '\0') - { - printf("this is not null data event\n"); - free(data); - } -} -void Call_CB_S_I_S_S(CB_S_I_S_S func,char* operationID, int errCode,char* errMsg,char* data) -{ - if(func == NULL){ - printf("callback func is null\n"); - return; - } - if (strcmp(data, "\"\"") == 0) { - strcpy(data, ""); - } - if (strlen(errMsg) != 0 && errMsg[strlen(errMsg) - 1] != '\0') { - printf("ttttt %s\n",errMsg); - strncat(errMsg, "\0", 1); - } - func(operationID,errCode,errMsg,data); - if (errMsg != NULL && errMsg[0] != '\0') - { - printf("this is not null errmsg %s\n",errMsg); - free(errMsg); - } - if (data != NULL && data[0] != '\0') - { - printf("this is not null data base,opid:%s,data:%s\n",operationID,data); - free(data); - } - if (operationID != NULL) - { - printf("this is not null operationID:%s\n",operationID); - free(operationID); - } -} -void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char* operationID,int errCode,char* errMsg,char* data,int progress) -{ - if(func == NULL){ - printf("callback func is null\n"); - return; - } - if(strcmp(data, "\"\"") == 0) { - strcpy(data, ""); - } - func(operationID,errCode,errMsg,data,progress); - if (errMsg != NULL && errMsg[0] != '\0') - { - printf("this is not null errmsg\n"); - free(errMsg); - } - if (data != NULL && data[0] != '\0') - { - printf("this is not null data\n"); - free(data); - } - if (operationID != NULL) - { - printf("this is not null operationID\n"); - free(operationID); - } -} - -enum CONN_EVENT{ - CONNECTING, - CONNECT_SUCCESS, - CONNECT_FAILED, - KICKED_OFFLINE, - USER_TOKEN_EXPIRED - -}; -*/ -import "C" diff --git a/c_cpp_wrapper/test.c b/c_cpp_wrapper/test.c deleted file mode 100644 index c7bf2f0..0000000 --- a/c_cpp_wrapper/test.c +++ /dev/null @@ -1,66 +0,0 @@ -// gcc -o test.exe -lc_wrapper.dll test.c -#include -#include -#include - -#include "openimsdk.h" - -typedef struct -{ - GoUint32 platformID; - char apiAddr[256]; - char wsAddr[256]; - char dataDir[256]; - GoUint32 logLevel; - GoUint8 isLogStandardOutput; - char logFilePath[256]; - GoUint8 isExternalExtensions; -} IMConfigC; - -void c_conn_callback(int event, char *data) -{ - printf("C c_conn_callback receive from Go callbck code: %d,data: %s\n", event,data); - -} -void c_conversation_callback(int event, char *data) -{ - printf("C c_conversation_callback receive from Go callbck code: %d,data: %s\n", event, data); -} -void c_message_callback(int event, char *data) -{ - printf("C c_message_callback receive from Go callbck code: %d,data: %s\n", event, data); -} -void c_base_callback(char * operationID ,int errCode,char * errMsg,char *data) -{ - printf("C c_base_callback operationID: %s receive from Go callbck code: %d, errMsg: %s, data: %s\n", operationID, errCode, errMsg, data); -} -int main(int argc, char **argv) -{ - char operationID[] = "12345"; -// char uid[] = "6959062403"; - char uid[] = "openIM123"; - // char token[] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiI2OTU5MDYyNDAzIiwiUGxhdGZvcm1JRCI6MywiZXhwIjoxNzAwNzIwOTg0LCJuYmYiOjE2OTI5NDQ2ODQsImlhdCI6MTY5Mjk0NDk4NH0.8otKTFrOCs8_ueV10rNOD-rzHrCT_EN0obKS9q79bIc"; - char token[] = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiJvcGVuSU0xMjMiLCJQbGF0Zm9ybUlEIjo2LCJleHAiOjE3MDkxMjQ2NzYsIm5iZiI6MTcwMTM0ODM3NiwiaWF0IjoxNzAxMzQ4Njc2fQ.EqlV5TlpiElYhUOHCEcSrZOWi9ldrUMR1L4q0blvxs0"; - - char *jsonString = "{\"platformID\": 2, \"apiAddr\": \"http://14.29.168.56:10002\", \"wsAddr\":\"ws://14.29.168.56:10001\",\"dataDir\": \"./\", \"logLevel\": 5, \"isLogStandardOutput\": true, \"logFilePath\": \"./\", \"isExternalExtensions\": true}"; - - GoUint8 init_result; - init_result = init_sdk(c_conn_callback,operationID, jsonString); - printf("init_result: %u\n", init_result); - set_conversation_listener(c_conversation_callback); - set_advanced_msg_listener(c_message_callback); - login(c_base_callback, operationID, uid, token); - sleep(10); - // char text[] = "哈哈"; - char* loginUserID=get_login_user(); - - printf("return :%s\n",loginUserID); - char operationID1[] = "12345,create"; - char *message = create_text_message(operationID1, "哈哈"); - printf("return :%s\n",message); - char operationID2[] = "12345,get_all_conversation_list"; - get_all_conversation_list(c_base_callback, operationID2); - - sleep(1000000); - return 0; -} \ No newline at end of file diff --git a/c_cpp_wrapper/test.cc b/c_cpp_wrapper/test.cc deleted file mode 100644 index e7ec4f2..0000000 --- a/c_cpp_wrapper/test.cc +++ /dev/null @@ -1,44 +0,0 @@ -#include -#include -#include -#include -#include "openimsdkcc.h" -using namespace std; -using namespace openim; - -// simple test -int main(){ - auto sdkMgr = OpenIMManager::GetInstance(); - string operationID="12345"; - string uid= "openIM123"; - string token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJVc2VySUQiOiJvcGVuSU0xMjMiLCJQbGF0Zm9ybUlEIjo2LCJleHAiOjE3MDkxMjQ2NzYsIm5iZiI6MTcwMTM0ODM3NiwiaWF0IjoxNzAxMzQ4Njc2fQ.EqlV5TlpiElYhUOHCEcSrZOWi9ldrUMR1L4q0blvxs0"; - string jsonString="{\"platformID\": 6, \"apiAddr\": \"http://14.29.168.56:10002\", \"wsAddr\":\"ws://14.29.168.56:10001\",\"dataDir\": \"./\", \"logLevel\": 5, \"isLogStandardOutput\": true, \"logFilePath\": \"./\", \"isExternalExtensions\": true}"; - bool init_result = sdkMgr.InitSDK([](int event,const string& data){ - cout<<"init> "<<"event:"< "<<"event:"< "<<"event:"< " <<"operationID: "< "<<"data:"< -#include -*/ -import "C" - -import ( - "encoding/json" - "strconv" - "unsafe" -) - -func parseBool(b int) bool { - return !(b == 0) -} - -func StructToJsonString(param interface{}) string { - dataType, _ := json.Marshal(param) - dataString := string(dataType) - return dataString -} - -func FreeCString(strList ...*C.char) { - for _, str := range strList { - C.free(unsafe.Pointer(str)) - } -} -func Int32ToString(intValue int32) string { - return strconv.Itoa(int(intValue)) -} diff --git a/c_cpp_wrapper/wrapp_cpp_function.inc b/c_cpp_wrapper/wrapp_cpp_function.inc deleted file mode 100644 index 7a615b8..0000000 --- a/c_cpp_wrapper/wrapp_cpp_function.inc +++ /dev/null @@ -1,301 +0,0 @@ -#define MAX_NUM_OF_CB_S 10 -#define MAX_NUM_OF_CB_I_S 10 -#define MAX_NUM_OF_CB_S_I_S_S 10 -#define MAX_NUM_OF_CB_S_I_S_S_I 10 -#define SLEEP_TIME_FOR_GET_INDEX 100 //ms - -// use recursive template to generate enough function pointer array -// and define c type function interface -// and define manager class to manage function pool -namespace { - CB_S* _fps_cb_s=new CB_S[MAX_NUM_OF_CB_S]; - CB_I_S* _fps_cb_i_s=new CB_I_S[MAX_NUM_OF_CB_I_S]; - CB_S_I_S_S* _fps_cb_s_i_s_s=new CB_S_I_S_S[MAX_NUM_OF_CB_S_I_S_S]; - CB_S_I_S_S_I* _fps_cb_s_i_s_s_i=new CB_S_I_S_S_I[MAX_NUM_OF_CB_S_I_S_S_I]; - // c type func interface call cpp function - std::function* _cpp_function_cb_s=new std::function[MAX_NUM_OF_CB_S]; - std::function* _cpp_function_cb_i_s=new std::function[MAX_NUM_OF_CB_I_S]; - std::function* _cpp_function_cb_s_i_s_s=new std::function[MAX_NUM_OF_CB_S_I_S_S]; - std::function* _cpp_function_cb_s_i_s_s_i=new std::function[MAX_NUM_OF_CB_S_I_S_S_I]; - - template - void _generate_cb_s(){ - _fps_cb_s[N]=[](char* c_str){ - _cpp_function_cb_s[N](std::string(c_str)); - }; - _generate_cb_s(); - } - template<> - void _generate_cb_s<0>(){ - _fps_cb_s[0]=[](char* c_str){ - _cpp_function_cb_s[0](std::string(c_str)); - }; - } - - template - void _generate_cb_i_s(){ - _fps_cb_i_s[N]=[](int code,char* c_str){ - _cpp_function_cb_i_s[N](code,std::string(c_str)); - }; - _generate_cb_i_s(); - } - template<> - void _generate_cb_i_s<0>(){ - _fps_cb_i_s[0]=[](int code,char* c_str){ - _cpp_function_cb_i_s[0](code,std::string(c_str)); - }; - } - template - void _generate_cb_s_i_s_s(){ - _fps_cb_s_i_s_s[N]=[](char* operationID,int code,char* c_str,char* c_str2){ - _cpp_function_cb_s_i_s_s[N](std::string(operationID),code,std::string(c_str),std::string(c_str2)); - }; - _generate_cb_s_i_s_s(); - } - template<> - void _generate_cb_s_i_s_s<0>(){ - _fps_cb_s_i_s_s[0]=[](char* operationID,int code,char* c_str,char* c_str2){ - _cpp_function_cb_s_i_s_s[0](std::string(operationID),code,std::string(c_str),std::string(c_str2)); - }; - } - template - void _generate_cb_s_i_s_s_i(){ - _fps_cb_s_i_s_s_i[N]=[](char* operationID,int code,char* c_str,char* c_str2,int c_int){ - _cpp_function_cb_s_i_s_s_i[N](std::string(operationID),code,std::string(c_str),std::string(c_str2),c_int); - }; - _generate_cb_s_i_s_s_i(); - } - template<> - void _generate_cb_s_i_s_s_i<0>(){ - _fps_cb_s_i_s_s_i[0]=[](char* operationID,int code,char* c_str,char* c_str2,int c_int){ - _cpp_function_cb_s_i_s_s_i[0](std::string(operationID),code,std::string(c_str),std::string(c_str2),c_int); - }; - } - - // init global function pointer array - void init(){ - _generate_cb_s(); - _generate_cb_i_s(); - _generate_cb_s_i_s_s(); - _generate_cb_s_i_s_s_i(); - } - // define sigle instance class to manage function pool - class FuncPoolManager{ - private: - // define a global bitmap, and support atomic operation, to manage cb_s pool - std::bitset _cb_s_bitmap; - std::bitset _cb_i_s_bitmap; - std::bitset _cb_s_i_s_s_bitmap; - std::bitset _cb_s_i_s_s_i_bitmap; - std::mutex _cb_s_mutex; - std::mutex _cb_i_s_mutex; - std::mutex _cb_s_i_s_s_mutex; - std::mutex _cb_s_i_s_s_i_mutex; - FuncPoolManager(){ - init(); - } - FuncPoolManager(const FuncPoolManager&){} - public: - static FuncPoolManager& get_instance(){ - static FuncPoolManager instance; - return instance; - } - // get a available cb_s function index - int get_cb_s_index(){ - std::lock_guard lock(_cb_s_mutex); - int index=-1; - for(int i=0;i<_cb_s_bitmap.size();i++){ - if(_cb_s_bitmap[i]==0){ - _cb_s_bitmap[i]=1; - index=i; - break; - } - } - return index; - } - // get a available cb_i_s function index - int get_cb_i_s_index(){ - std::lock_guard lock(_cb_i_s_mutex); - int index=-1; - for(int i=0;i<_cb_i_s_bitmap.size();i++){ - if(_cb_i_s_bitmap[i]==0){ - _cb_i_s_bitmap[i]=1; - index=i; - break; - } - } - return index; - } - // get a available cb_s_i_s_s function index - int get_cb_s_i_s_s_index(){ - std::lock_guard lock(_cb_s_i_s_s_mutex); - int index=-1; - for(int i=0;i<_cb_s_i_s_s_bitmap.size();i++){ - if(_cb_s_i_s_s_bitmap[i]==0){ - _cb_s_i_s_s_bitmap[i]=1; - index=i; - break; - } - } - return index; - } - // get a available cb_s_i_s_s_i function index - int get_cb_s_i_s_s_i_index(){ - std::lock_guard lock(_cb_s_i_s_s_i_mutex); - int index=-1; - for(int i=0;i<_cb_s_i_s_s_i_bitmap.size();i++){ - if(_cb_s_i_s_s_i_bitmap[i]==0){ - _cb_s_i_s_s_i_bitmap[i]=1; - index=i; - break; - } - } - return index; - } - // release a available cb_s function index - int release_cb_s_index(int index){ - std::lock_guard lock(_cb_s_mutex); - if(index<0||index>=_cb_s_bitmap.size()){ - return -1; - } - _cpp_function_cb_s[index]=nullptr; - _cb_s_bitmap[index]=0; - return 0; - } - // release a available cb_i_s function index - int release_cb_i_s_index(int index){ - std::lock_guard lock(_cb_i_s_mutex); - if(index<0||index>=_cb_i_s_bitmap.size()){ - return -1; - } - _cpp_function_cb_i_s[index]=nullptr; - _cb_i_s_bitmap[index]=0; - return 0; - } - // release a available cb_s_i_s_s function index - int release_cb_s_i_s_s_index(int index){ - std::lock_guard lock(_cb_s_i_s_s_mutex); - if(index<0||index>=_cb_s_i_s_s_bitmap.size()){ - return -1; - } - _cpp_function_cb_s_i_s_s[index]=nullptr; - _cb_s_i_s_s_bitmap[index]=0; - return 0; - } - // release a available cb_s_i_s_s_i function index - int release_cb_s_i_s_s_i_index(int index){ - std::lock_guard lock(_cb_s_i_s_s_i_mutex); - if(index<0||index>=_cb_s_i_s_s_i_bitmap.size()){ - return -1; - } - _cpp_function_cb_s_i_s_s_i[index]=nullptr; - _cb_s_i_s_s_i_bitmap[index]=0; - return 0; - } - }; - FuncPoolManager& instance=FuncPoolManager::get_instance(); - - // wrapper persistent function - // wrapp CB_S,if function pool is full,return nullptr - CB_S _wrapper_cpp_function(const std::function& cpp_function) { - int index=FuncPoolManager::get_instance().get_cb_s_index(); - while(index<0){ - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); - index=FuncPoolManager::get_instance().get_cb_s_index(); - } - _cpp_function_cb_s[index]=cpp_function; - return _fps_cb_s[index]; - } - // wrapp CB_I_S - CB_I_S _wrapper_cpp_function(const std::function& cpp_function) - { - int index=FuncPoolManager::get_instance().get_cb_i_s_index(); - while(index<0){ - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); - index=FuncPoolManager::get_instance().get_cb_i_s_index(); - } - _cpp_function_cb_i_s[index]=cpp_function; - return _fps_cb_i_s[index]; - } - // wrapp CB_S_I_S_S - CB_S_I_S_S _wrapper_cpp_function(const std::function& cpp_function) - { - int index=FuncPoolManager::get_instance().get_cb_s_i_s_s_index(); - while(index<0){ - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); - index=FuncPoolManager::get_instance().get_cb_s_i_s_s_index(); - } - _cpp_function_cb_s_i_s_s[index]=cpp_function; - return _fps_cb_s_i_s_s[index]; - } - // wrapp CB_S_I_S_S_I - CB_S_I_S_S_I _wrapper_cpp_function(const std::function& cpp_function) - { - int index=FuncPoolManager::get_instance().get_cb_s_i_s_s_i_index(); - while(index<0){ - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); - index=FuncPoolManager::get_instance().get_cb_s_i_s_s_i_index(); - } - _cpp_function_cb_s_i_s_s_i[index]=cpp_function; - return _fps_cb_s_i_s_s_i[index]; - } - - // wrapp function to onetime function - CB_S _wrapper_callonce_cpp_function(const std::function& cpp_function) { - int index=FuncPoolManager::get_instance().get_cb_s_index(); - while(index<0){ - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); - index=FuncPoolManager::get_instance().get_cb_s_index(); - } - _cpp_function_cb_s[index]=[cpp_function,index](const std::string& str)->void { - cpp_function(str); - FuncPoolManager::get_instance().release_cb_s_index(index); - }; - return _fps_cb_s[index]; - } - - CB_I_S _wrapper_callonce_cpp_function(const std::function& cpp_function) - { - int index=FuncPoolManager::get_instance().get_cb_i_s_index(); - while(index<0){ - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); - index=FuncPoolManager::get_instance().get_cb_i_s_index(); - } - _cpp_function_cb_i_s[index]=[cpp_function,index](int code,const std::string& str)->void { - cpp_function(code,str); - FuncPoolManager::get_instance().release_cb_i_s_index(index); - }; - return _fps_cb_i_s[index]; - } - - CB_S_I_S_S _wrapper_callonce_cpp_function(const std::function& cpp_function) - { - int index=FuncPoolManager::get_instance().get_cb_s_i_s_s_index(); - while(index<0){ - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); - index=FuncPoolManager::get_instance().get_cb_s_i_s_s_index(); - } - _cpp_function_cb_s_i_s_s[index]=[cpp_function,index](const std::string& operationID,int code,const std::string& str,const std::string& str2)->void { - cpp_function(operationID,code,str,str2); - FuncPoolManager::get_instance().release_cb_s_i_s_s_index(index); - }; - return _fps_cb_s_i_s_s[index]; - } - - CB_S_I_S_S_I _wrapper_callonce_cpp_function(const std::function& cpp_function) - { - int index=FuncPoolManager::get_instance().get_cb_s_i_s_s_i_index(); - // while loop util get a available index - while(index<0){ - std::this_thread::sleep_for(std::chrono::milliseconds(SLEEP_TIME_FOR_GET_INDEX)); - index=FuncPoolManager::get_instance().get_cb_s_i_s_s_i_index(); - } - _cpp_function_cb_s_i_s_s_i[index]=[cpp_function,index](const std::string& operationID,int code,const std::string& str,const std::string& str2,int c_int)->void { - cpp_function(operationID,code,str,str2,c_int); - FuncPoolManager::get_instance().release_cb_s_i_s_s_i_index(index); - }; - return _fps_cb_s_i_s_s_i[index]; - } - -} - diff --git a/c_cpp_wrapper/export.go b/export.go similarity index 54% rename from c_cpp_wrapper/export.go rename to export.go index fd4cc98..6e70fde 100644 --- a/c_cpp_wrapper/export.go +++ b/export.go @@ -2,382 +2,443 @@ package main /* #include -typedef void (*CB_S)(char *); -typedef void (*CB_I_S)(int,char *); -typedef void (*CB_S_I_S_S)(char *,int,char *,char *); -typedef void (*CB_S_I_S_S_I)(char *,int,char *,char *,int); -extern void Call_CB_S(CB_S func,char* data); -extern void Call_CB_I_S(CB_I_S func,int event,char* data); -extern void Call_CB_S_I_S_S(CB_S_I_S_S func,char *,int errCode,char* errMsg,char* data); -extern void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char *,int errCode,char* errMsg,char* data,int progress); -extern CB_S DebugPrint; - +typedef void (*MessageHandler)(int id ,char* data); +extern MessageHandler messageHandler; +extern void CallMessageHandler(MessageHandler msgHandler,int id,char* data); */ import "C" import ( + "encoding/json" + "fmt" + "reflect" + "strconv" + "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" ) -//export set_print -func set_print(print C.CB_S) { - C.DebugPrint = print +//export SetMessageHandler +func SetMessageHandler(handler C.MessageHandler) { + C.messageHandler = handler } -func DebugPrint(info string) { - C.Call_CB_S(C.DebugPrint, C.CString("DLL:"+info)) +func DispatorMsg(msgId int, msg interface{}) { + t := reflect.TypeOf(msg) + kind := t.Kind() + if kind == reflect.Struct { + msgJson, err := json.Marshal(msg) + if err != nil { + C.CallMessageHandler(C.messageHandler, C.int(0), C.CString(fmt.Sprintf("Marshal Json Error :%s", err.Error()))) + } else { + C.CallMessageHandler(C.messageHandler, C.int(msgId), C.CString((string(msgJson)))) + } + } else if kind == reflect.String { + C.CallMessageHandler(C.messageHandler, C.int(msgId), C.CString(msg.(string))) + } else if kind == reflect.Int32 { + C.CallMessageHandler(C.messageHandler, C.int(msgId), C.CString(strconv.Itoa(msg.(int)))) + } } -type Base struct { - ErrCode int32 `json:"errCode"` - ErrMsg string `json:"errMsg"` +func parseBool(b int) bool { + return !(b == 0) } // =====================================================listener=============================================== type ConnCallback struct { - cCallback C.CB_I_S } -func NewConnCallback(cCallback C.CB_I_S) *ConnCallback { - return &ConnCallback{cCallback: cCallback} +func NewConnCallback() *ConnCallback { + return &ConnCallback{} } - func (c ConnCallback) OnConnecting() { - C.Call_CB_I_S(c.cCallback, CONNECTING, NO_DATA) + DispatorMsg(Msg_Connecting, Empty{}) } func (c ConnCallback) OnConnectSuccess() { - C.Call_CB_I_S(c.cCallback, CONNECT_SUCCESS, NO_DATA) + DispatorMsg(Msg_ConnectSuccess, Empty{}) } func (c ConnCallback) OnConnectFailed(errCode int32, errMsg string) { - - C.Call_CB_I_S(c.cCallback, CONNECT_FAILED, C.CString(StructToJsonString(Base{ErrCode: errCode, ErrMsg: errMsg}))) - + DispatorMsg(Msg_ConectFailed, Error{ErrCode: errCode, ErrMsg: errMsg}) } func (c ConnCallback) OnKickedOffline() { - C.Call_CB_I_S(c.cCallback, KICKED_OFFLINE, NO_DATA) + DispatorMsg(Msg_KickedOffline, Empty{}) } - func (c ConnCallback) OnUserTokenExpired() { - C.Call_CB_I_S(c.cCallback, USER_TOKEN_EXPIRED, NO_DATA) + DispatorMsg(Msg_UserTokenExpired, Empty{}) } type ConversationCallback struct { - cCallback C.CB_I_S } -func NewConversationCallback(cCallback C.CB_I_S) *ConversationCallback { - return &ConversationCallback{cCallback: cCallback} +func NewConversationCallback() *ConversationCallback { + return &ConversationCallback{} } - func (c ConversationCallback) OnSyncServerStart() { - C.Call_CB_I_S(c.cCallback, SYNC_SERVER_START, NO_DATA) + DispatorMsg(Msg_SyncServerStart, Empty{}) } - func (c ConversationCallback) OnSyncServerFinish() { - C.Call_CB_I_S(c.cCallback, SYNC_SERVER_FINISH, NO_DATA) + DispatorMsg(Msg_SyncServerFinish, Empty{}) } - func (c ConversationCallback) OnSyncServerFailed() { - C.Call_CB_I_S(c.cCallback, SYNC_SERVER_FAILED, NO_DATA) + DispatorMsg(Msg_SyncServerFailed, Empty{}) } - func (c ConversationCallback) OnNewConversation(conversationList string) { - C.Call_CB_I_S(c.cCallback, NEW_CONVERSATION, C.CString(conversationList)) + DispatorMsg(Msg_NewConversation, conversationList) } - func (c ConversationCallback) OnConversationChanged(conversationList string) { - C.Call_CB_I_S(c.cCallback, CONVERSATION_CHANGED, C.CString(conversationList)) + DispatorMsg(Msg_ConversationChanged, conversationList) } - func (c ConversationCallback) OnTotalUnreadMessageCountChanged(totalUnreadCount int32) { - C.Call_CB_I_S(c.cCallback, TOTAL_UNREAD_MESSAGE_COUNT_CHANGED, C.CString(Int32ToString(totalUnreadCount))) + DispatorMsg(Msg_TotalUnreadMessageCountChanged, totalUnreadCount) } type AdvancedMsgCallback struct { - cCallback C.CB_I_S } func (a AdvancedMsgCallback) OnRecvNewMessage(message string) { - C.Call_CB_I_S(a.cCallback, RECV_NEW_MESSAGE, C.CString(message)) + DispatorMsg(Msg_Advanced_RecvNewMessage, message) } - func (a AdvancedMsgCallback) OnRecvC2CReadReceipt(msgReceiptList string) { - C.Call_CB_I_S(a.cCallback, RECV_C2C_READ_RECEIPT, C.CString(msgReceiptList)) + DispatorMsg(Msg_Advanced_RecvC2CReadReceipt, msgReceiptList) } - func (a AdvancedMsgCallback) OnRecvGroupReadReceipt(groupMsgReceiptList string) { - C.Call_CB_I_S(a.cCallback, RECV_GROUP_READ_RECEIPT, C.CString(groupMsgReceiptList)) + DispatorMsg(Msg_Advanced_RecvGroupReadReceipt, groupMsgReceiptList) } - func (a AdvancedMsgCallback) OnNewRecvMessageRevoked(messageRevoked string) { - C.Call_CB_I_S(a.cCallback, NEW_RECV_MESSAGE_REVOKED, C.CString(messageRevoked)) + DispatorMsg(Msg_Advanced_NewRecvMessageRevoked, messageRevoked) } - func (a AdvancedMsgCallback) OnRecvMessageExtensionsChanged(msgID string, reactionExtensionList string) { - m := make(map[string]string) - m["msgID"] = msgID - m["reactionExtensionList"] = reactionExtensionList - C.Call_CB_I_S(a.cCallback, RECV_MESSAGE_EXTENSIONS_CHANGED, C.CString(StructToJsonString(m))) + DispatorMsg(Msg_Advanced_RecvMessageExtensionsChanged, MsgIDAndList{Id: msgID, List: reactionExtensionList}) } - func (a AdvancedMsgCallback) OnRecvMessageExtensionsDeleted(msgID string, reactionExtensionKeyList string) { - m := make(map[string]string) - m["msgID"] = msgID - m["reactionExtensionKeyList"] = reactionExtensionKeyList - C.Call_CB_I_S(a.cCallback, RECV_MESSAGE_EXTENSIONS_DELETED, C.CString(StructToJsonString(m))) + DispatorMsg(Msg_Advanced_RecvMessageExtensionsDeleted, MsgIDAndList{Id: msgID, List: reactionExtensionKeyList}) } - func (a AdvancedMsgCallback) OnRecvMessageExtensionsAdded(msgID string, reactionExtensionList string) { - m := make(map[string]string) - m["msgID"] = msgID - m["reactionExtensionList"] = reactionExtensionList - C.Call_CB_I_S(a.cCallback, RECV_MESSAGE_EXTENSIONS_ADDED, C.CString(StructToJsonString(m))) + DispatorMsg(Msg_Advanced_RecvMessageExtensionsAdded, MsgIDAndList{Id: msgID, List: reactionExtensionList}) } - func (a AdvancedMsgCallback) OnRecvOfflineNewMessage(message string) { - C.Call_CB_I_S(a.cCallback, RECV_OFFLINE_NEW_MESSAGE, C.CString(message)) + DispatorMsg(Msg_Advanced_RecvOfflineNewMessage, message) } - func (a AdvancedMsgCallback) OnMsgDeleted(message string) { - C.Call_CB_I_S(a.cCallback, MSG_DELETED, C.CString(message)) + DispatorMsg(Msg_Advanced_MsgDeleted, message) } -func NewAdvancedMsgCallback(cCallback C.CB_I_S) *AdvancedMsgCallback { - return &AdvancedMsgCallback{cCallback: cCallback} +func NewAdvancedMsgCallback() *AdvancedMsgCallback { + return &AdvancedMsgCallback{} } type BatchMessageCallback struct { - cCallback C.CB_I_S } func (b BatchMessageCallback) OnRecvNewMessages(messageList string) { - C.Call_CB_I_S(b.cCallback, RECV_NEW_MESSAGES, C.CString(messageList)) + DispatorMsg(Msg_Batch_RecvNewMessages, messageList) } - func (b BatchMessageCallback) OnRecvOfflineNewMessages(messageList string) { - C.Call_CB_I_S(b.cCallback, RECV_OFFLINE_NEW_MESSAGES, C.CString(messageList)) + DispatorMsg(Msg_Batch_RecvOfflineNewMessages, messageList) } -func NewBatchMessageCallback(cCallback C.CB_I_S) *BatchMessageCallback { - return &BatchMessageCallback{cCallback: cCallback} +func NewBatchMessageCallback() *BatchMessageCallback { + return &BatchMessageCallback{} } type FriendCallback struct { - cCallback C.CB_I_S } func (f FriendCallback) OnFriendApplicationAdded(friendApplication string) { - C.Call_CB_I_S(f.cCallback, FRIEND_APPLICATION_ADDED, C.CString(friendApplication)) + DispatorMsg(Msg_FriendApplicationAdded, friendApplication) } - func (f FriendCallback) OnFriendApplicationDeleted(friendApplication string) { - C.Call_CB_I_S(f.cCallback, FRIEND_APPLICATION_DELETED, C.CString(friendApplication)) + DispatorMsg(Msg_FriendApplicationDeleted, friendApplication) } - func (f FriendCallback) OnFriendApplicationAccepted(friendApplication string) { - C.Call_CB_I_S(f.cCallback, FRIEND_APPLICATION_ACCEPTED, C.CString(friendApplication)) + DispatorMsg(Msg_FriendApplicationAccepted, friendApplication) } - func (f FriendCallback) OnFriendApplicationRejected(friendApplication string) { - C.Call_CB_I_S(f.cCallback, FRIEND_APPLICATION_REJECTED, C.CString(friendApplication)) + DispatorMsg(Msg_FriendApplicationRejected, friendApplication) } - func (f FriendCallback) OnFriendAdded(friendInfo string) { - C.Call_CB_I_S(f.cCallback, FRIEND_ADDED, C.CString(friendInfo)) + DispatorMsg(Msg_FriendAdded, friendInfo) } - func (f FriendCallback) OnFriendDeleted(friendInfo string) { - C.Call_CB_I_S(f.cCallback, FRIEND_DELETED, C.CString(friendInfo)) + DispatorMsg(Msg_FriendDeleted, friendInfo) } - func (f FriendCallback) OnFriendInfoChanged(friendInfo string) { - C.Call_CB_I_S(f.cCallback, FRIEND_INFO_CHANGED, C.CString(friendInfo)) + DispatorMsg(Msg_FriendInfoChanged, friendInfo) } - func (f FriendCallback) OnBlackAdded(blackInfo string) { - C.Call_CB_I_S(f.cCallback, BLACK_ADDED, C.CString(blackInfo)) + DispatorMsg(Msg_BlackAdded, blackInfo) } - func (f FriendCallback) OnBlackDeleted(blackInfo string) { - C.Call_CB_I_S(f.cCallback, BLACK_DELETED, C.CString(blackInfo)) + DispatorMsg(Msg_BlackDeleted, blackInfo) } -func NewFriendCallback(cCallback C.CB_I_S) *FriendCallback { - return &FriendCallback{cCallback: cCallback} +func NewFriendCallback() *FriendCallback { + return &FriendCallback{} } type GroupCallback struct { - cCallback C.CB_I_S } -func NewGroupCallback(cCallback C.CB_I_S) *GroupCallback { - return &GroupCallback{cCallback: cCallback} +func NewGroupCallback() *GroupCallback { + return &GroupCallback{} } - func (g GroupCallback) OnJoinedGroupAdded(groupInfo string) { - C.Call_CB_I_S(g.cCallback, JOINED_GROUP_ADDED, C.CString(groupInfo)) + DispatorMsg(Msg_JoinedGroupAdded, groupInfo) } - func (g GroupCallback) OnJoinedGroupDeleted(groupInfo string) { - C.Call_CB_I_S(g.cCallback, JOINED_GROUP_DELETED, C.CString(groupInfo)) + DispatorMsg(Msg_JoinedGroupDeleted, groupInfo) } - func (g GroupCallback) OnGroupMemberAdded(groupMemberInfo string) { - C.Call_CB_I_S(g.cCallback, GROUP_MEMBER_ADDED, C.CString(groupMemberInfo)) + DispatorMsg(Msg_GroupMemberAdded, groupMemberInfo) } - func (g GroupCallback) OnGroupMemberDeleted(groupMemberInfo string) { - C.Call_CB_I_S(g.cCallback, GROUP_MEMBER_DELETED, C.CString(groupMemberInfo)) + DispatorMsg(Msg_GroupMemberDeleted, groupMemberInfo) } - func (g GroupCallback) OnGroupApplicationAdded(groupApplication string) { - C.Call_CB_I_S(g.cCallback, GROUP_APPLICATION_ADDED, C.CString(groupApplication)) + DispatorMsg(Msg_GroupApplicationAdded, groupApplication) } - func (g GroupCallback) OnGroupApplicationDeleted(groupApplication string) { - C.Call_CB_I_S(g.cCallback, GROUP_APPLICATION_DELETED, C.CString(groupApplication)) + DispatorMsg(Msg_GroupApplicationDeleted, groupApplication) } - func (g GroupCallback) OnGroupInfoChanged(groupInfo string) { - C.Call_CB_I_S(g.cCallback, GROUP_INFO_CHANGED, C.CString(groupInfo)) + DispatorMsg(Msg_GroupInfoChanged, groupInfo) } - func (g GroupCallback) OnGroupDismissed(groupInfo string) { - C.Call_CB_I_S(g.cCallback, GROUP_DISMISSED, C.CString(groupInfo)) + DispatorMsg(Msg_GroupDismissed, groupInfo) } - func (g GroupCallback) OnGroupMemberInfoChanged(groupMemberInfo string) { - C.Call_CB_I_S(g.cCallback, GROUP_MEMBER_INFO_CHANGED, C.CString(groupMemberInfo)) + DispatorMsg(Msg_GroupMemberInfoChanged, groupMemberInfo) } - func (g GroupCallback) OnGroupApplicationAccepted(groupApplication string) { - C.Call_CB_I_S(g.cCallback, GROUP_APPLICATION_ACCEPTED, C.CString(groupApplication)) + DispatorMsg(Msg_GroupApplicationAccepted, groupApplication) } - func (g GroupCallback) OnGroupApplicationRejected(groupApplication string) { - C.Call_CB_I_S(g.cCallback, GROUP_APPLICATION_REJECTED, C.CString(groupApplication)) + DispatorMsg(Msg_GroupApplicationRejected, groupApplication) } type CustomBusinessCallback struct { - cCallback C.CB_I_S } func (c CustomBusinessCallback) OnRecvCustomBusinessMessage(businessMessage string) { - C.Call_CB_I_S(c.cCallback, RECV_CUSTOM_BUSINESS_MESSAGE, C.CString(businessMessage)) + DispatorMsg(Msg_RecvCustomBusinessMessage, businessMessage) } - -func NewCustomBusinessCallback(cCallback C.CB_I_S) *CustomBusinessCallback { - return &CustomBusinessCallback{cCallback: cCallback} +func NewCustomBusinessCallback() *CustomBusinessCallback { + return &CustomBusinessCallback{} } type UserCallback struct { - cCallback C.CB_I_S } func (u UserCallback) OnSelfInfoUpdated(userInfo string) { - C.Call_CB_I_S(u.cCallback, SELF_INFO_UPDATED, C.CString(userInfo)) + DispatorMsg(Msg_SelfInfoUpdated, userInfo) } func (u UserCallback) OnUserStatusChanged(statusMap string) { - C.Call_CB_I_S(u.cCallback, USER_STATUS_CHANGED, C.CString(statusMap)) + DispatorMsg(Msg_UserStatusChanged, statusMap) } -func NewUserCallback(cCallback C.CB_I_S) *UserCallback { - return &UserCallback{cCallback: cCallback} +func NewUserCallback() *UserCallback { + return &UserCallback{} } type SendMessageCallback struct { - cCallback C.CB_S_I_S_S_I operationID string } -func NewSendMessageCallback(cCallback C.CB_S_I_S_S_I, operationID *C.char) *SendMessageCallback { - return &SendMessageCallback{cCallback: cCallback, operationID: C.GoString(operationID)} +func NewSendMessageCallback(operationID *C.char) *SendMessageCallback { + return &SendMessageCallback{operationID: C.GoString(operationID)} } func (s SendMessageCallback) OnError(errCode int32, errMsg string) { - C.Call_CB_S_I_S_S_I(s.cCallback, C.CString(s.operationID), C.int(errCode), C.CString(errMsg), NO_DATA, NO_PROGRESS) + DispatorMsg(Msg_SendMessage_Error, Error{ErrCode: errCode, ErrMsg: errMsg, OperationID: s.operationID}) } func (s SendMessageCallback) OnSuccess(data string) { - C.Call_CB_S_I_S_S_I(s.cCallback, C.CString(s.operationID), NO_ERR, NO_ERR_MSG, C.CString(data), NO_PROGRESS) + DispatorMsg(Msg_SendMessage_Success, Success{OperationID: s.operationID, Data: data}) } func (s SendMessageCallback) OnProgress(progress int) { - C.Call_CB_S_I_S_S_I(s.cCallback, C.CString(s.operationID), NO_ERR, NO_ERR_MSG, NO_DATA, C.int(progress)) + DispatorMsg(Msg_SendMessage_Progress, Progress{OperationID: s.operationID, Progress: progress}) } type BaseCallback struct { - cCallback C.CB_S_I_S_S operationID string } -func NewBaseCallback(cCallback C.CB_S_I_S_S, operationID *C.char) *BaseCallback { - return &BaseCallback{cCallback: cCallback, operationID: C.GoString(operationID)} +func NewBaseCallback(operationID *C.char) *BaseCallback { + return &BaseCallback{operationID: C.GoString(operationID)} } - func (b BaseCallback) OnError(errCode int32, errMsg string) { - C.Call_CB_S_I_S_S(b.cCallback, C.CString(b.operationID), C.int(errCode), C.CString(errMsg), NO_DATA) + DispatorMsg(Msg_Base_Error, Error{OperationID: b.operationID, ErrCode: errCode, ErrMsg: errMsg}) } - func (b BaseCallback) OnSuccess(data string) { - C.Call_CB_S_I_S_S(b.cCallback, C.CString(b.operationID), NO_ERR, NO_ERR_MSG, C.CString(data)) + DispatorMsg(Msg_Base_Success, Success{OperationID: b.operationID, Data: data}) +} + +type GroupListener struct { +} + +func (GroupListener) OnGroupApplicationAccepted(groupApplication string) { + +} +func (GroupListener) OnGroupApplicationAdded(groupApplication string) { +} +func (GroupListener) OnGroupApplicationDeleted(groupApplication string) { +} + +func (GroupListener) OnGroupApplicationRejected(groupApplication string) { +} + +func (GroupListener) OnGroupDismissed(groupInfo string) { +} + +func (GroupListener) OnGroupInfoChanged(groupInfo string) { +} + +func (GroupListener) OnGroupMemberAdded(groupMemberInfo string) { +} +func (GroupListener) OnGroupMemberDeleted(groupMemberInfo string) { +} +func (GroupListener) OnGroupMemberInfoChanged(groupMemberInfo string) { +} + +func (GroupListener) OnJoinedGroupAdded(groupInfo string) { +} + +func (GroupListener) OnJoinedGroupDeleted(groupInfo string) { } -// =====================================================global_callback=============================================== +type ConversationListener struct { +} -//export set_group_listener -func set_group_listener(cCallback C.CB_I_S) { - open_im_sdk.SetGroupListener(NewGroupCallback(cCallback)) +func (ConversationListener) OnConversationChanged(conversationList string) { +} +func (ConversationListener) OnNewConversation(conversationList string) { +} +func (ConversationListener) OnSyncServerFailed() { +} +func (ConversationListener) OnSyncServerFinish() { +} +func (ConversationListener) OnSyncServerStart() { } -//export set_conversation_listener -func set_conversation_listener(cCallback C.CB_I_S) { - open_im_sdk.SetConversationListener(NewConversationCallback(cCallback)) +func (ConversationListener) OnTotalUnreadMessageCountChanged(totalUnreadCount int32) { } -//export set_advanced_msg_listener -func set_advanced_msg_listener(cCallback C.CB_I_S) { - open_im_sdk.SetAdvancedMsgListener(NewAdvancedMsgCallback(cCallback)) +type AdvancedMsgListener struct { } -//export set_batch_msg_listener -func set_batch_msg_listener(cCallback C.CB_I_S) { - open_im_sdk.SetBatchMsgListener(NewBatchMessageCallback(cCallback)) +func (AdvancedMsgListener) OnMsgDeleted(message string) { +} +func (AdvancedMsgListener) OnNewRecvMessageRevoked(messageRevoked string) { +} +func (AdvancedMsgListener) OnRecvC2CReadReceipt(msgReceiptList string) { +} +func (AdvancedMsgListener) OnRecvGroupReadReceipt(groupMsgReceiptList string) { +} +func (AdvancedMsgListener) OnRecvMessageExtensionsAdded(msgID string, reactionExtensionList string) { +} +func (AdvancedMsgListener) OnRecvMessageExtensionsChanged(msgID string, reactionExtensionList string) { +} +func (AdvancedMsgListener) OnRecvMessageExtensionsDeleted(msgID string, reactionExtensionKeyList string) { +} +func (AdvancedMsgListener) OnRecvNewMessage(message string) { +} +func (AdvancedMsgListener) OnRecvOfflineNewMessage(message string) { } -//export set_user_listener -func set_user_listener(cCallback C.CB_I_S) { - open_im_sdk.SetUserListener(NewUserCallback(cCallback)) +type BatchMsgListener struct { } -//export set_friend_listener -func set_friend_listener(cCallback C.CB_I_S) { - open_im_sdk.SetFriendListener(NewFriendCallback(cCallback)) +func (BatchMsgListener) OnRecvNewMessages(messageList string) { } -//export set_custom_business_listener -func set_custom_business_listener(cCallback C.CB_I_S) { - open_im_sdk.SetCustomBusinessListener(NewCustomBusinessCallback(cCallback)) +func (BatchMsgListener) OnRecvOfflineNewMessages(messageList string) { +} + +type UserListener struct { +} + +func (UserListener) OnSelfInfoUpdated(userInfo string) { +} + +func (UserListener) OnUserStatusChanged(userOnlineStatus string) { + +} + +type FriendListener struct { +} + +func (FriendListener) OnBlackAdded(blackInfo string) { + +} + +func (FriendListener) OnBlackDeleted(blackInfo string) { + } -////export set_messsage_kv_listener -//func set_messsage_kv_listener(cCallback C.CB_I_S) { -// open_im_sdk.SetMessageKvInfoListener(NewMessageKVCallback(cCallback)) -//} +func (FriendListener) OnFriendAdded(friendInfo string) { + +} + +func (FriendListener) OnFriendApplicationAccepted(friendApplication string) { + +} + +func (FriendListener) OnFriendApplicationAdded(friendApplication string) { + +} + +func (FriendListener) OnFriendApplicationDeleted(friendApplication string) { + +} + +func (FriendListener) OnFriendApplicationRejected(friendApplication string) { + +} + +func (FriendListener) OnFriendDeleted(friendInfo string) { + +} + +func (FriendListener) OnFriendInfoChanged(friendInfo string) { + +} + +type CustomBusinessListener struct { +} + +func (CustomBusinessListener) OnRecvCustomBusinessMessage(businessMessage string) { + +} + +type MessageKvInfoListener struct { +} + +func (MessageKvInfoListener) OnMessageKvInfoChanged(messageChangedList string) { + +} // =====================================================init_login=============================================== //export init_sdk func init_sdk( - cCallback C.CB_I_S, operationID *C.char, config *C.char) bool { - callback := NewConnCallback(cCallback) - return open_im_sdk.InitSDK(callback, C.GoString(operationID), C.GoString(config)) + callback := NewConnCallback() + res := open_im_sdk.InitSDK(callback, C.GoString(operationID), C.GoString(config)) + if res { + open_im_sdk.SetGroupListener(NewGroupCallback()) + open_im_sdk.SetConversationListener(NewConversationCallback()) + open_im_sdk.SetAdvancedMsgListener(NewAdvancedMsgCallback()) + open_im_sdk.SetBatchMsgListener(NewBatchMessageCallback()) + open_im_sdk.SetUserListener(NewUserCallback()) + open_im_sdk.SetFriendListener(NewFriendCallback()) + open_im_sdk.SetCustomBusinessListener(NewCustomBusinessCallback()) + } + return res } //export un_init_sdk @@ -386,26 +447,26 @@ func un_init_sdk(operationID *C.char) { } //export login -func login(cCallback C.CB_S_I_S_S, operationID, uid, token *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func login(operationID, uid, token *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.Login(baseCallback, C.GoString(operationID), C.GoString(uid), C.GoString(token)) } //export logout -func logout(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func logout(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.Logout(baseCallback, C.GoString(operationID)) } //export set_app_background_status -func set_app_background_status(cCallback C.CB_S_I_S_S, operationID *C.char, isBackground C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_app_background_status(operationID *C.char, isBackground C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetAppBackgroundStatus(baseCallback, C.GoString(operationID), parseBool(int(isBackground))) } //export network_status_changed -func network_status_changed(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func network_status_changed(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.NetworkStatusChanged(baseCallback, C.GoString(operationID)) } @@ -551,93 +612,93 @@ func create_forward_message(operationID, m *C.char) *C.char { } //export get_all_conversation_list -func get_all_conversation_list(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_all_conversation_list(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetAllConversationList(baseCallback, C.GoString(operationID)) } //export get_conversation_list_split -func get_conversation_list_split(cCallback C.CB_S_I_S_S, operationID *C.char, offset C.int, count C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_conversation_list_split(operationID *C.char, offset C.int, count C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetConversationListSplit(baseCallback, C.GoString(operationID), int(offset), int(count)) } //export get_one_conversation -func get_one_conversation(cCallback C.CB_S_I_S_S, operationID *C.char, sessionType C.int, sourceID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_one_conversation(operationID *C.char, sessionType C.int, sourceID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetOneConversation(baseCallback, C.GoString(operationID), int32(sessionType), C.GoString(sourceID)) } //export get_multiple_conversation -func get_multiple_conversation(cCallback C.CB_S_I_S_S, operationID *C.char, conversationIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_multiple_conversation(operationID *C.char, conversationIDList *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetMultipleConversation(baseCallback, C.GoString(operationID), C.GoString(conversationIDList)) } //export set_conversation_msg_destruct_time -func set_conversation_msg_destruct_time(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, msgDestructTime C.longlong) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_conversation_msg_destruct_time(operationID *C.char, conversationID *C.char, msgDestructTime C.longlong) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetConversationMsgDestructTime(baseCallback, C.GoString(operationID), C.GoString(conversationID), int64(msgDestructTime)) } //export set_conversation_is_msg_destruct -func set_conversation_is_msg_destruct(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, isMsgDestruct C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_conversation_is_msg_destruct(operationID *C.char, conversationID *C.char, isMsgDestruct C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetConversationIsMsgDestruct(baseCallback, C.GoString(operationID), C.GoString(conversationID), parseBool(int(isMsgDestruct))) } //export hide_conversation -func hide_conversation(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func hide_conversation(operationID *C.char, conversationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.HideConversation(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export get_conversation_recv_message_opt -func get_conversation_recv_message_opt(cCallback C.CB_S_I_S_S, operationID *C.char, conversationIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_conversation_recv_message_opt(operationID *C.char, conversationIDList *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetConversationRecvMessageOpt(baseCallback, C.GoString(operationID), C.GoString(conversationIDList)) } //export set_conversation_draft -func set_conversation_draft(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, draftText *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_conversation_draft(operationID *C.char, conversationID *C.char, draftText *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetConversationDraft(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(draftText)) } //export reset_conversation_group_at_type -func reset_conversation_group_at_type(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func reset_conversation_group_at_type(operationID *C.char, conversationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.ResetConversationGroupAtType(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export pin_conversation -func pin_conversation(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, isPinned C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func pin_conversation(operationID *C.char, conversationID *C.char, isPinned C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.PinConversation(baseCallback, C.GoString(operationID), C.GoString(conversationID), parseBool(int(isPinned))) } //export set_conversation_private_chat -func set_conversation_private_chat(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, isPrivate C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_conversation_private_chat(operationID *C.char, conversationID *C.char, isPrivate C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetConversationPrivateChat(baseCallback, C.GoString(operationID), C.GoString(conversationID), parseBool(int(isPrivate))) } //export set_conversation_burn_duration -func set_conversation_burn_duration(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, duration C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_conversation_burn_duration(operationID *C.char, conversationID *C.char, duration C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetConversationBurnDuration(baseCallback, C.GoString(operationID), C.GoString(conversationID), int32(duration)) } //export set_conversation_recv_message_opt -func set_conversation_recv_message_opt(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, opt C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_conversation_recv_message_opt(operationID *C.char, conversationID *C.char, opt C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetConversationRecvMessageOpt(baseCallback, C.GoString(operationID), C.GoString(conversationID), int(opt)) } //export get_total_unread_msg_count -func get_total_unread_msg_count(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_total_unread_msg_count(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetTotalUnreadMsgCount(baseCallback, C.GoString(operationID)) } @@ -652,278 +713,278 @@ func get_conversation_id_by_session_type(operationID *C.char, sourceID *C.char, } //export send_message -func send_message(cCallback C.CB_S_I_S_S_I, operationID, message, recvID, groupID, offlinePushInfo *C.char) { - sendMsgCallback := NewSendMessageCallback(cCallback, operationID) +func send_message(operationID, message, recvID, groupID, offlinePushInfo *C.char) { + sendMsgCallback := NewSendMessageCallback(operationID) open_im_sdk.SendMessage(sendMsgCallback, C.GoString(operationID), C.GoString(message), C.GoString(recvID), C.GoString(groupID), C.GoString(offlinePushInfo)) } //export send_message_not_oss -func send_message_not_oss(cCallback C.CB_S_I_S_S_I, operationID, message, recvID, groupID, offlinePushInfo *C.char) { - sendMsgCallback := NewSendMessageCallback(cCallback, operationID) +func send_message_not_oss(operationID, message, recvID, groupID, offlinePushInfo *C.char) { + sendMsgCallback := NewSendMessageCallback(operationID) open_im_sdk.SendMessageNotOss(sendMsgCallback, C.GoString(operationID), C.GoString(message), C.GoString(recvID), C.GoString(groupID), C.GoString(offlinePushInfo)) } //export find_message_list -func find_message_list(cCallback C.CB_S_I_S_S, operationID *C.char, findMessageOptions *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func find_message_list(operationID *C.char, findMessageOptions *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.FindMessageList(baseCallback, C.GoString(operationID), C.GoString(findMessageOptions)) } //export get_advanced_history_message_list -func get_advanced_history_message_list(cCallback C.CB_S_I_S_S, operationID, getMessageOptions *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_advanced_history_message_list(operationID, getMessageOptions *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetAdvancedHistoryMessageList(baseCallback, C.GoString(operationID), C.GoString(getMessageOptions)) } //export get_advanced_history_message_list_reverse -func get_advanced_history_message_list_reverse(cCallback C.CB_S_I_S_S, operationID *C.char, getMessageOptions *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_advanced_history_message_list_reverse(operationID *C.char, getMessageOptions *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetAdvancedHistoryMessageListReverse(baseCallback, C.GoString(operationID), C.GoString(getMessageOptions)) } //export revoke_message -func revoke_message(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, clientMsgID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func revoke_message(operationID *C.char, conversationID *C.char, clientMsgID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.RevokeMessage(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID)) } //export typing_status_update -func typing_status_update(cCallback C.CB_S_I_S_S, operationID *C.char, recvID *C.char, msgTip *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func typing_status_update(operationID *C.char, recvID *C.char, msgTip *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.TypingStatusUpdate(baseCallback, C.GoString(operationID), C.GoString(recvID), C.GoString(msgTip)) } //export mark_conversation_message_as_read -func mark_conversation_message_as_read(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func mark_conversation_message_as_read(operationID *C.char, conversationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.MarkConversationMessageAsRead(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export delete_message_from_local_storage -func delete_message_from_local_storage(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, clientMsgID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func delete_message_from_local_storage(operationID *C.char, conversationID *C.char, clientMsgID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.DeleteMessageFromLocalStorage(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID)) } //export delete_message -func delete_message(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, clientMsgID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func delete_message(operationID *C.char, conversationID *C.char, clientMsgID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.DeleteMessage(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID)) } //export hide_all_conversations -func hide_all_conversations(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func hide_all_conversations(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.HideAllConversations(baseCallback, C.GoString(operationID)) } //export delete_all_msg_from_local_and_svr -func delete_all_msg_from_local_and_svr(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func delete_all_msg_from_local_and_svr(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.DeleteAllMsgFromLocalAndSvr(baseCallback, C.GoString(operationID)) } //export delete_all_msg_from_local -func delete_all_msg_from_local(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func delete_all_msg_from_local(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.DeleteAllMsgFromLocal(baseCallback, C.GoString(operationID)) } //export clear_conversation_and_delete_all_msg -func clear_conversation_and_delete_all_msg(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func clear_conversation_and_delete_all_msg(operationID *C.char, conversationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.ClearConversationAndDeleteAllMsg(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export delete_conversation_and_delete_all_msg -func delete_conversation_and_delete_all_msg(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func delete_conversation_and_delete_all_msg(operationID *C.char, conversationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.DeleteConversationAndDeleteAllMsg(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export insert_single_message_to_local_storage -func insert_single_message_to_local_storage(cCallback C.CB_S_I_S_S, operationID *C.char, message *C.char, recvID *C.char, sendID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func insert_single_message_to_local_storage(operationID *C.char, message *C.char, recvID *C.char, sendID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.InsertSingleMessageToLocalStorage(baseCallback, C.GoString(operationID), C.GoString(message), C.GoString(recvID), C.GoString(sendID)) } //export insert_group_message_to_local_storage -func insert_group_message_to_local_storage(cCallback C.CB_S_I_S_S, operationID *C.char, message *C.char, groupID *C.char, sendID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func insert_group_message_to_local_storage(operationID *C.char, message *C.char, groupID *C.char, sendID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.InsertGroupMessageToLocalStorage(baseCallback, C.GoString(operationID), C.GoString(message), C.GoString(groupID), C.GoString(sendID)) } //export search_local_messages -func search_local_messages(cCallback C.CB_S_I_S_S, operationID *C.char, searchParam *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func search_local_messages(operationID *C.char, searchParam *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SearchLocalMessages(baseCallback, C.GoString(operationID), C.GoString(searchParam)) } //export set_message_local_ex -func set_message_local_ex(cCallback C.CB_S_I_S_S, operationID *C.char, conversationID *C.char, clientMsgID *C.char, localEx *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_message_local_ex(operationID *C.char, conversationID *C.char, clientMsgID *C.char, localEx *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetMessageLocalEx(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID), C.GoString(localEx)) } // =====================================================user=============================================== //export get_users_info -func get_users_info(cCallback C.CB_S_I_S_S, operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_users_info(operationID *C.char, userIDs *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetUsersInfo(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } //export get_users_info_with_cache -func get_users_info_with_cache(cCallback C.CB_S_I_S_S, operationID *C.char, userIDs *C.char, groupID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_users_info_with_cache(operationID *C.char, userIDs *C.char, groupID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetUsersInfoWithCache(baseCallback, C.GoString(operationID), C.GoString(userIDs), C.GoString(groupID)) } //export get_users_info_from_srv -func get_users_info_from_srv(cCallback C.CB_S_I_S_S, operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_users_info_from_srv(operationID *C.char, userIDs *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetUsersInfoFromSrv(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } //export set_self_info -func set_self_info(cCallback C.CB_S_I_S_S, operationID *C.char, userInfo *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_self_info(operationID *C.char, userInfo *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetSelfInfo(baseCallback, C.GoString(operationID), C.GoString(userInfo)) } //export set_global_recv_message_opt -func set_global_recv_message_opt(cCallback C.CB_S_I_S_S, operationID *C.char, opt C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_global_recv_message_opt(operationID *C.char, opt C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetGlobalRecvMessageOpt(baseCallback, C.GoString(operationID), int(opt)) } //export get_self_user_info -func get_self_user_info(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_self_user_info(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetSelfUserInfo(baseCallback, C.GoString(operationID)) } //export update_msg_sender_info -func update_msg_sender_info(cCallback C.CB_S_I_S_S, operationID *C.char, nickname *C.char, faceURL *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func update_msg_sender_info(operationID *C.char, nickname *C.char, faceURL *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.UpdateMsgSenderInfo(baseCallback, C.GoString(operationID), C.GoString(nickname), C.GoString(faceURL)) } //export subscribe_users_status -func subscribe_users_status(cCallback C.CB_S_I_S_S, operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func subscribe_users_status(operationID *C.char, userIDs *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SubscribeUsersStatus(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } //export unsubscribe_users_status -func unsubscribe_users_status(cCallback C.CB_S_I_S_S, operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func unsubscribe_users_status(operationID *C.char, userIDs *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.UnsubscribeUsersStatus(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } //export get_subscribe_users_status -func get_subscribe_users_status(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_subscribe_users_status(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetSubscribeUsersStatus(baseCallback, C.GoString(operationID)) } //export get_user_status -func get_user_status(cCallback C.CB_S_I_S_S, operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_user_status(operationID *C.char, userIDs *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetUserStatus(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } // =====================================================friend=============================================== // //export get_specified_friends_info -func get_specified_friends_info(cCallback C.CB_S_I_S_S, operationID *C.char, userIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_specified_friends_info(operationID *C.char, userIDList *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetSpecifiedFriendsInfo(baseCallback, C.GoString(operationID), C.GoString(userIDList)) } //export get_friend_list -func get_friend_list(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_friend_list(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetFriendList(baseCallback, C.GoString(operationID)) } //export get_friend_list_page -func get_friend_list_page(cCallback C.CB_S_I_S_S, operationID *C.char, offset C.int, count C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_friend_list_page(operationID *C.char, offset C.int, count C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetFriendListPage(baseCallback, C.GoString(operationID), int32(offset), int32(count)) } //export search_friends -func search_friends(cCallback C.CB_S_I_S_S, operationID *C.char, searchParam *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func search_friends(operationID *C.char, searchParam *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SearchFriends(baseCallback, C.GoString(operationID), C.GoString(searchParam)) } //export check_friend -func check_friend(cCallback C.CB_S_I_S_S, operationID *C.char, userIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func check_friend(operationID *C.char, userIDList *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.CheckFriend(baseCallback, C.GoString(operationID), C.GoString(userIDList)) } //export add_friend -func add_friend(cCallback C.CB_S_I_S_S, operationID *C.char, userIDReqMsg *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func add_friend(operationID *C.char, userIDReqMsg *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.AddFriend(baseCallback, C.GoString(operationID), C.GoString(userIDReqMsg)) } //export set_friend_remark -func set_friend_remark(cCallback C.CB_S_I_S_S, operationID *C.char, userIDRemark *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_friend_remark(operationID *C.char, userIDRemark *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetFriendRemark(baseCallback, C.GoString(operationID), C.GoString(userIDRemark)) } //export delete_friend -func delete_friend(cCallback C.CB_S_I_S_S, operationID *C.char, friendUserID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func delete_friend(operationID *C.char, friendUserID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.DeleteFriend(baseCallback, C.GoString(operationID), C.GoString(friendUserID)) } //export get_friend_application_list_as_recipient -func get_friend_application_list_as_recipient(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_friend_application_list_as_recipient(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetFriendApplicationListAsRecipient(baseCallback, C.GoString(operationID)) } //export get_friend_application_list_as_applicant -func get_friend_application_list_as_applicant(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_friend_application_list_as_applicant(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetFriendApplicationListAsApplicant(baseCallback, C.GoString(operationID)) } //export accept_friend_application -func accept_friend_application(cCallback C.CB_S_I_S_S, operationID *C.char, userIDHandleMsg *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func accept_friend_application(operationID *C.char, userIDHandleMsg *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.AcceptFriendApplication(baseCallback, C.GoString(operationID), C.GoString(userIDHandleMsg)) } //export refuse_friend_application -func refuse_friend_application(cCallback C.CB_S_I_S_S, operationID *C.char, userIDHandleMsg *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func refuse_friend_application(operationID *C.char, userIDHandleMsg *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.RefuseFriendApplication(baseCallback, C.GoString(operationID), C.GoString(userIDHandleMsg)) } //export add_black -func add_black(cCallback C.CB_S_I_S_S, operationID *C.char, blackUserID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func add_black(operationID *C.char, blackUserID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.AddBlack(baseCallback, C.GoString(operationID), C.GoString(blackUserID)) } //export get_black_list -func get_black_list(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_black_list(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetBlackList(baseCallback, C.GoString(operationID)) } //export remove_black -func remove_black(cCallback C.CB_S_I_S_S, operationID *C.char, removeUserID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func remove_black(operationID *C.char, removeUserID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.RemoveBlack(baseCallback, C.GoString(operationID), C.GoString(removeUserID)) } @@ -931,16 +992,16 @@ func remove_black(cCallback C.CB_S_I_S_S, operationID *C.char, removeUserID *C.c // CreateGroup creates a group // //export create_group -func create_group(cCallback C.CB_S_I_S_S, operationID, cGroupReqInfo *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func create_group(operationID, cGroupReqInfo *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.CreateGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupReqInfo)) } // JoinGroup joins a group // //export join_group -func join_group(cCallback C.CB_S_I_S_S, operationID, cGroupID, cReqMsg *C.char, cJoinSource C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func join_group(operationID, cGroupID, cReqMsg *C.char, cJoinSource C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.JoinGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReqMsg), int32(cJoinSource)) } @@ -948,32 +1009,32 @@ func join_group(cCallback C.CB_S_I_S_S, operationID, cGroupID, cReqMsg *C.char, // QuitGroup quits a group // //export quit_group -func quit_group(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func quit_group(operationID, cGroupID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.QuitGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) } // DismissGroup dismisses a group // //export dismiss_group -func dismiss_group(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func dismiss_group(operationID, cGroupID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.DismissGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) } // ChangeGroupMute changes the mute status of a group // //export change_group_mute -func change_group_mute(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char, cIsMute C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func change_group_mute(operationID, cGroupID *C.char, cIsMute C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.ChangeGroupMute(baseCallback, C.GoString(operationID), C.GoString(cGroupID), parseBool(int(cIsMute))) } // ChangeGroupMemberMute changes the mute status of a group member // //export change_group_member_mute -func change_group_member_mute(cCallback C.CB_S_I_S_S, operationID, cGroupID, cUserID *C.char, cMutedSeconds C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func change_group_member_mute(operationID, cGroupID, cUserID *C.char, cMutedSeconds C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.ChangeGroupMemberMute(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserID), int(cMutedSeconds)) } @@ -981,8 +1042,8 @@ func change_group_member_mute(cCallback C.CB_S_I_S_S, operationID, cGroupID, cUs // SetGroupMemberRoleLevel sets the role level of a group member // //export set_group_member_role_level -func set_group_member_role_level(cCallback C.CB_S_I_S_S, operationID, cGroupID, cUserID *C.char, cRoleLevel C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_group_member_role_level(operationID, cGroupID, cUserID *C.char, cRoleLevel C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetGroupMemberRoleLevel(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserID), int(cRoleLevel)) } @@ -990,72 +1051,72 @@ func set_group_member_role_level(cCallback C.CB_S_I_S_S, operationID, cGroupID, // SetGroupMemberInfo sets the information of a group member // //export set_group_member_info -func set_group_member_info(cCallback C.CB_S_I_S_S, operationID *C.char, cGroupMemberInfo *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_group_member_info(operationID *C.char, cGroupMemberInfo *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetGroupMemberInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupMemberInfo)) } // GetJoinedGroupList retrieves the list of joined groups // //export get_joined_group_list -func get_joined_group_list(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_joined_group_list(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetJoinedGroupList(baseCallback, C.GoString(operationID)) } // GetSpecifiedGroupsInfo retrieves the information of specified groups // //export get_specified_groups_info -func get_specified_groups_info(cCallback C.CB_S_I_S_S, operationID, cGroupIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_specified_groups_info(operationID, cGroupIDList *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetSpecifiedGroupsInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupIDList)) } // SearchGroups searches for groups // //export search_groups -func search_groups(cCallback C.CB_S_I_S_S, operationID, cSearchParam *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func search_groups(operationID, cSearchParam *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SearchGroups(baseCallback, C.GoString(operationID), C.GoString(cSearchParam)) } // SetGroupInfo sets the information of a group // //export set_group_info -func set_group_info(cCallback C.CB_S_I_S_S, operationID, cGroupInfo *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_group_info(operationID, cGroupInfo *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetGroupInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupInfo)) } // SetGroupVerification sets the verification mode of a group // //export set_group_verification -func set_group_verification(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char, cVerification C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_group_verification(operationID, cGroupID *C.char, cVerification C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetGroupVerification(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cVerification)) } // SetGroupLookMemberInfo sets the member information visibility of a group // //export set_group_look_member_info -func set_group_look_member_info(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char, cRule C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_group_look_member_info(operationID, cGroupID *C.char, cRule C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetGroupLookMemberInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cRule)) } // SetGroupApplyMemberFriend sets the friend rule for group applicants // //export set_group_apply_member_friend -func set_group_apply_member_friend(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char, cRule C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_group_apply_member_friend(operationID, cGroupID *C.char, cRule C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetGroupApplyMemberFriend(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cRule)) } // GetGroupMemberList retrieves the list of group members // //export get_group_member_list -func get_group_member_list(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char, cFilter, cOffset, cCount C.int) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_group_member_list(operationID, cGroupID *C.char, cFilter, cOffset, cCount C.int) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetGroupMemberList(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cFilter), int32(cOffset), int32(cCount)) } @@ -1063,17 +1124,17 @@ func get_group_member_list(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char // GetGroupMemberOwnerAndAdmin retrieves the owner and admin members of a group // //export get_group_member_owner_and_admin -func get_group_member_owner_and_admin(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_group_member_owner_and_admin(operationID, cGroupID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetGroupMemberOwnerAndAdmin(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) } // GetGroupMemberListByJoinTimeFilter retrieves the list of group members filtered by join time // //export get_group_member_list_by_join_time_filter -func get_group_member_list_by_join_time_filter(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char, cOffset, +func get_group_member_list_by_join_time_filter(operationID, cGroupID *C.char, cOffset, cCount C.int, cJoinTimeBegin, cJoinTimeEnd C.longlong, cFilterUserIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetGroupMemberListByJoinTimeFilter(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cOffset), int32(cCount), int64(cJoinTimeBegin), int64(cJoinTimeEnd), C.GoString(cFilterUserIDList)) } @@ -1081,8 +1142,8 @@ func get_group_member_list_by_join_time_filter(cCallback C.CB_S_I_S_S, operation // GetSpecifiedGroupMembersInfo retrieves the information of specified group members // //export get_specified_group_members_info -func get_specified_group_members_info(cCallback C.CB_S_I_S_S, operationID, cGroupID, cUserIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_specified_group_members_info(operationID, cGroupID, cUserIDList *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetSpecifiedGroupMembersInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserIDList)) } @@ -1090,8 +1151,8 @@ func get_specified_group_members_info(cCallback C.CB_S_I_S_S, operationID, cGrou // KickGroupMember kicks group members // //export kick_group_member -func kick_group_member(cCallback C.CB_S_I_S_S, operationID, cGroupID, cReason, cUserIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func kick_group_member(operationID, cGroupID, cReason, cUserIDList *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.KickGroupMember(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReason), C.GoString(cUserIDList)) } @@ -1099,8 +1160,8 @@ func kick_group_member(cCallback C.CB_S_I_S_S, operationID, cGroupID, cReason, c // TransferGroupOwner transfers the ownership of a group // //export transfer_group_owner -func transfer_group_owner(cCallback C.CB_S_I_S_S, operationID, cGroupID, cNewOwnerUserID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func transfer_group_owner(operationID, cGroupID, cNewOwnerUserID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.TransferGroupOwner(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cNewOwnerUserID)) } @@ -1108,8 +1169,8 @@ func transfer_group_owner(cCallback C.CB_S_I_S_S, operationID, cGroupID, cNewOwn // InviteUserToGroup invites users to a group // //export invite_user_to_group -func invite_user_to_group(cCallback C.CB_S_I_S_S, operationID, cGroupID, cReason, cUserIDList *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func invite_user_to_group(operationID, cGroupID, cReason, cUserIDList *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.InviteUserToGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReason), C.GoString(cUserIDList)) } @@ -1117,24 +1178,24 @@ func invite_user_to_group(cCallback C.CB_S_I_S_S, operationID, cGroupID, cReason // GetGroupApplicationListAsRecipient retrieves the group application list as a recipient // //export get_group_application_list_as_recipient -func get_group_application_list_as_recipient(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_group_application_list_as_recipient(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetGroupApplicationListAsRecipient(baseCallback, C.GoString(operationID)) } // GetGroupApplicationListAsApplicant retrieves the group application list as an applicant // //export get_group_application_list_as_applicant -func get_group_application_list_as_applicant(cCallback C.CB_S_I_S_S, operationID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func get_group_application_list_as_applicant(operationID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.GetGroupApplicationListAsApplicant(baseCallback, C.GoString(operationID)) } // AcceptGroupApplication accepts a group application // //export accept_group_application -func accept_group_application(cCallback C.CB_S_I_S_S, operationID, cGroupID, cFromUserID, cHandleMsg *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func accept_group_application(operationID, cGroupID, cFromUserID, cHandleMsg *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.AcceptGroupApplication(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cFromUserID), C.GoString(cHandleMsg)) } @@ -1142,8 +1203,8 @@ func accept_group_application(cCallback C.CB_S_I_S_S, operationID, cGroupID, cFr // RefuseGroupApplication refuses a group application // //export refuse_group_application -func refuse_group_application(cCallback C.CB_S_I_S_S, operationID, cGroupID, cFromUserID, cHandleMsg *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func refuse_group_application(operationID, cGroupID, cFromUserID, cHandleMsg *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.RefuseGroupApplication(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cFromUserID), C.GoString(cHandleMsg)) } @@ -1151,8 +1212,8 @@ func refuse_group_application(cCallback C.CB_S_I_S_S, operationID, cGroupID, cFr // SetGroupMemberNickname sets the nickname of a group member // //export set_group_member_nickname -func set_group_member_nickname(cCallback C.CB_S_I_S_S, operationID, cGroupID, cUserID, cGroupMemberNickname *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func set_group_member_nickname(operationID, cGroupID, cUserID, cGroupMemberNickname *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SetGroupMemberNickname(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserID), C.GoString(cGroupMemberNickname)) } @@ -1160,16 +1221,16 @@ func set_group_member_nickname(cCallback C.CB_S_I_S_S, operationID, cGroupID, cU // SearchGroupMembers searches for group members // //export search_group_members -func search_group_members(cCallback C.CB_S_I_S_S, operationID, cSearchParam *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func search_group_members(operationID, cSearchParam *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.SearchGroupMembers(baseCallback, C.GoString(operationID), C.GoString(cSearchParam)) } // IsJoinGroup checks if the user has joined a group // //export is_join_group -func is_join_group(cCallback C.CB_S_I_S_S, operationID, cGroupID *C.char) { - baseCallback := NewBaseCallback(cCallback, operationID) +func is_join_group(operationID, cGroupID *C.char) { + baseCallback := NewBaseCallback(operationID) open_im_sdk.IsJoinGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) } diff --git a/c_cpp_wrapper/gen_android_so.bat b/gen_android_so.bat similarity index 100% rename from c_cpp_wrapper/gen_android_so.bat rename to gen_android_so.bat diff --git a/gen_ios_dylib.sh b/gen_ios_dylib.sh new file mode 100644 index 0000000..11586f5 --- /dev/null +++ b/gen_ios_dylib.sh @@ -0,0 +1,8 @@ +export GOOS=darwin +export GOARCH=arm64 +export CGO_ENABLED=1 +export CC=clang + +go build -buildmode=c-shared -o libopenimsdk.dylib export.go protocol.go message.go + + diff --git a/c_cpp_wrapper/go.sum b/go.sum similarity index 100% rename from c_cpp_wrapper/go.sum rename to go.sum diff --git a/message.go b/message.go new file mode 100644 index 0000000..c0c1d6a --- /dev/null +++ b/message.go @@ -0,0 +1,88 @@ +package main + +const ( + Msg_Error = iota + + Msg_Connecting + Msg_ConnectSuccess + Msg_ConectFailed + Msg_KickedOffline + Msg_UserTokenExpired + + Msg_SyncServerStart + Msg_SyncServerFinish + Msg_SyncServerFailed + Msg_NewConversation + Msg_ConversationChanged + Msg_TotalUnreadMessageCountChanged + + Msg_Advanced_RecvNewMessage + Msg_Advanced_RecvC2CReadReceipt + Msg_Advanced_RecvGroupReadReceipt + Msg_Advanced_NewRecvMessageRevoked + Msg_Advanced_RecvMessageExtensionsChanged + Msg_Advanced_RecvMessageExtensionsDeleted + Msg_Advanced_RecvMessageExtensionsAdded + Msg_Advanced_RecvOfflineNewMessage + Msg_Advanced_MsgDeleted + + Msg_Batch_RecvNewMessages + Msg_Batch_RecvOfflineNewMessages + + Msg_FriendApplicationAdded + Msg_FriendApplicationDeleted + Msg_FriendApplicationAccepted + Msg_FriendApplicationRejected + Msg_FriendAdded + Msg_FriendDeleted + Msg_FriendInfoChanged + Msg_BlackAdded + Msg_BlackDeleted + + Msg_JoinedGroupAdded + Msg_JoinedGroupDeleted + Msg_GroupMemberAdded + Msg_GroupMemberDeleted + Msg_GroupApplicationAdded + Msg_GroupApplicationDeleted + Msg_GroupInfoChanged + Msg_GroupDismissed + Msg_GroupMemberInfoChanged + Msg_GroupApplicationAccepted + Msg_GroupApplicationRejected + + Msg_RecvCustomBusinessMessage + + Msg_SelfInfoUpdated + Msg_UserStatusChanged + + Msg_SendMessage_Error + Msg_SendMessage_Success + Msg_SendMessage_Progress + + Msg_Base_Error + Msg_Base_Success +) + +type Empty struct { +} + +type Error struct { + ErrCode int32 `json:"errCode"` + ErrMsg string `json:"errMsg"` + OperationID string `json:"operationId"` +} + +type Success struct { + OperationID string `json:"operationId"` + Data string `json:"data"` +} +type Progress struct { + OperationID string `json:"operationId"` + Progress int `json:"progress"` +} + +type MsgIDAndList struct { + Id string `json:"msgId"` + List string `json:"list"` +} diff --git a/protocol.go b/protocol.go new file mode 100644 index 0000000..7c8ba64 --- /dev/null +++ b/protocol.go @@ -0,0 +1,16 @@ +package main + +/* +#include +typedef void (*MessageHandler)(int id ,char* data); +MessageHandler messageHandler; +void CallMessageHandler(MessageHandler msgHandler,int id,char* data){ + if(msgHandler == NULL){ + printf("IMSDK: not set message handler"); + }else{ + msgHandler(id,data); + } +} + +*/ +import "C" diff --git a/c_cpp_wrapper/run_test.sh b/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from c_cpp_wrapper/run_test.sh rename to run_test.sh From fbab8c3327c0be75baa9f6eaef9058d4f1c40ca5 Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Wed, 24 Jan 2024 17:21:13 +0800 Subject: [PATCH 02/13] add go.mod --- go.mod | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 go.mod diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..b475ae7 --- /dev/null +++ b/go.mod @@ -0,0 +1,38 @@ +module github.com/openimsdk/openim-sdk-cpp + +go 1.20 + +require github.com/openimsdk/openim-sdk-core/v3 v3.4.0 + +require ( + github.com/OpenIMSDK/protocol v0.0.23 // indirect + github.com/OpenIMSDK/tools v0.0.5 // indirect + github.com/bwmarrin/snowflake v0.3.0 // indirect + github.com/golang/protobuf v1.5.3 // indirect + github.com/google/go-cmp v0.5.9 // indirect + github.com/gorilla/websocket v1.4.2 // indirect + github.com/jinzhu/copier v0.3.5 // indirect + github.com/jinzhu/inflection v1.0.0 // indirect + github.com/jinzhu/now v1.1.5 // indirect + github.com/klauspost/compress v1.16.5 // indirect + github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect + github.com/lestrrat-go/strftime v1.0.6 // indirect + github.com/mattn/go-sqlite3 v1.14.12 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20220106031843-2efeb10ca2f6 // indirect + go.uber.org/atomic v1.7.0 // indirect + go.uber.org/multierr v1.6.0 // indirect + go.uber.org/zap v1.24.0 // indirect + golang.org/x/image v0.9.0 // indirect + golang.org/x/net v0.11.0 // indirect + golang.org/x/sys v0.9.0 // indirect + golang.org/x/text v0.11.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect + google.golang.org/grpc v1.56.2 // indirect + google.golang.org/protobuf v1.31.0 // indirect + gorm.io/driver/sqlite v1.3.6 // indirect + gorm.io/gorm v1.23.8 // indirect + nhooyr.io/websocket v1.8.7 // indirect +) From 48a43084966c9bc1b18ee8e850e6a5d74cd89a27 Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Thu, 25 Jan 2024 10:54:51 +0800 Subject: [PATCH 03/13] dev:change base callback datatype --- export.go | 195 +++++++++++++++++++++++++++-------------------------- message.go | 44 +++++++++++- 2 files changed, 140 insertions(+), 99 deletions(-) diff --git a/export.go b/export.go index 6e70fde..7e93499 100644 --- a/export.go +++ b/export.go @@ -60,7 +60,7 @@ func (c ConnCallback) OnConnectSuccess() { } func (c ConnCallback) OnConnectFailed(errCode int32, errMsg string) { - DispatorMsg(Msg_ConectFailed, Error{ErrCode: errCode, ErrMsg: errMsg}) + DispatorMsg(Msg_ConnectFailed, Error{ErrCode: errCode, ErrMsg: errMsg}) } func (c ConnCallback) OnKickedOffline() { @@ -265,17 +265,18 @@ func (s SendMessageCallback) OnProgress(progress int) { } type BaseCallback struct { - operationID string + OperationID string + DataType int } -func NewBaseCallback(operationID *C.char) *BaseCallback { - return &BaseCallback{operationID: C.GoString(operationID)} +func NewBaseCallback(operationID *C.char, dataType int) *BaseCallback { + return &BaseCallback{OperationID: C.GoString(operationID), DataType: dataType} } func (b BaseCallback) OnError(errCode int32, errMsg string) { - DispatorMsg(Msg_Base_Error, Error{OperationID: b.operationID, ErrCode: errCode, ErrMsg: errMsg}) + DispatorMsg(Msg_Base_Error, Error{OperationID: b.OperationID, ErrCode: errCode, ErrMsg: errMsg}) } func (b BaseCallback) OnSuccess(data string) { - DispatorMsg(Msg_Base_Success, Success{OperationID: b.operationID, Data: data}) + DispatorMsg(Msg_Base_Success, Success{OperationID: b.OperationID, DataType: b.DataType, Data: data}) } type GroupListener struct { @@ -448,25 +449,25 @@ func un_init_sdk(operationID *C.char) { //export login func login(operationID, uid, token *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.Login(baseCallback, C.GoString(operationID), C.GoString(uid), C.GoString(token)) } //export logout func logout(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.Logout(baseCallback, C.GoString(operationID)) } //export set_app_background_status func set_app_background_status(operationID *C.char, isBackground C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetAppBackgroundStatus(baseCallback, C.GoString(operationID), parseBool(int(isBackground))) } //export network_status_changed func network_status_changed(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.NetworkStatusChanged(baseCallback, C.GoString(operationID)) } @@ -613,92 +614,92 @@ func create_forward_message(operationID, m *C.char) *C.char { //export get_all_conversation_list func get_all_conversation_list(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalConversation_List) open_im_sdk.GetAllConversationList(baseCallback, C.GoString(operationID)) } //export get_conversation_list_split func get_conversation_list_split(operationID *C.char, offset C.int, count C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalConversation_List) open_im_sdk.GetConversationListSplit(baseCallback, C.GoString(operationID), int(offset), int(count)) } //export get_one_conversation func get_one_conversation(operationID *C.char, sessionType C.int, sourceID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalConversation) open_im_sdk.GetOneConversation(baseCallback, C.GoString(operationID), int32(sessionType), C.GoString(sourceID)) } //export get_multiple_conversation func get_multiple_conversation(operationID *C.char, conversationIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalConversation_List) open_im_sdk.GetMultipleConversation(baseCallback, C.GoString(operationID), C.GoString(conversationIDList)) } //export set_conversation_msg_destruct_time func set_conversation_msg_destruct_time(operationID *C.char, conversationID *C.char, msgDestructTime C.longlong) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetConversationMsgDestructTime(baseCallback, C.GoString(operationID), C.GoString(conversationID), int64(msgDestructTime)) } //export set_conversation_is_msg_destruct func set_conversation_is_msg_destruct(operationID *C.char, conversationID *C.char, isMsgDestruct C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetConversationIsMsgDestruct(baseCallback, C.GoString(operationID), C.GoString(conversationID), parseBool(int(isMsgDestruct))) } //export hide_conversation func hide_conversation(operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.HideConversation(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export get_conversation_recv_message_opt func get_conversation_recv_message_opt(operationID *C.char, conversationIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_GetConversationRecvMessageOptResp_List) open_im_sdk.GetConversationRecvMessageOpt(baseCallback, C.GoString(operationID), C.GoString(conversationIDList)) } //export set_conversation_draft func set_conversation_draft(operationID *C.char, conversationID *C.char, draftText *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetConversationDraft(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(draftText)) } //export reset_conversation_group_at_type func reset_conversation_group_at_type(operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.ResetConversationGroupAtType(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export pin_conversation func pin_conversation(operationID *C.char, conversationID *C.char, isPinned C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.PinConversation(baseCallback, C.GoString(operationID), C.GoString(conversationID), parseBool(int(isPinned))) } //export set_conversation_private_chat func set_conversation_private_chat(operationID *C.char, conversationID *C.char, isPrivate C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetConversationPrivateChat(baseCallback, C.GoString(operationID), C.GoString(conversationID), parseBool(int(isPrivate))) } //export set_conversation_burn_duration func set_conversation_burn_duration(operationID *C.char, conversationID *C.char, duration C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetConversationBurnDuration(baseCallback, C.GoString(operationID), C.GoString(conversationID), int32(duration)) } //export set_conversation_recv_message_opt func set_conversation_recv_message_opt(operationID *C.char, conversationID *C.char, opt C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetConversationRecvMessageOpt(baseCallback, C.GoString(operationID), C.GoString(conversationID), int(opt)) } //export get_total_unread_msg_count func get_total_unread_msg_count(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Int) open_im_sdk.GetTotalUnreadMsgCount(baseCallback, C.GoString(operationID)) } @@ -728,103 +729,103 @@ func send_message_not_oss(operationID, message, recvID, groupID, offlinePushInfo //export find_message_list func find_message_list(operationID *C.char, findMessageOptions *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_FindMessageListCallback) open_im_sdk.FindMessageList(baseCallback, C.GoString(operationID), C.GoString(findMessageOptions)) } //export get_advanced_history_message_list func get_advanced_history_message_list(operationID, getMessageOptions *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageListParams) open_im_sdk.GetAdvancedHistoryMessageList(baseCallback, C.GoString(operationID), C.GoString(getMessageOptions)) } //export get_advanced_history_message_list_reverse func get_advanced_history_message_list_reverse(operationID *C.char, getMessageOptions *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageListParams) open_im_sdk.GetAdvancedHistoryMessageListReverse(baseCallback, C.GoString(operationID), C.GoString(getMessageOptions)) } //export revoke_message func revoke_message(operationID *C.char, conversationID *C.char, clientMsgID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageListParams) open_im_sdk.RevokeMessage(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID)) } //export typing_status_update func typing_status_update(operationID *C.char, recvID *C.char, msgTip *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.TypingStatusUpdate(baseCallback, C.GoString(operationID), C.GoString(recvID), C.GoString(msgTip)) } //export mark_conversation_message_as_read func mark_conversation_message_as_read(operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.MarkConversationMessageAsRead(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export delete_message_from_local_storage func delete_message_from_local_storage(operationID *C.char, conversationID *C.char, clientMsgID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.DeleteMessageFromLocalStorage(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID)) } //export delete_message func delete_message(operationID *C.char, conversationID *C.char, clientMsgID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.DeleteMessage(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID)) } //export hide_all_conversations func hide_all_conversations(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.HideAllConversations(baseCallback, C.GoString(operationID)) } //export delete_all_msg_from_local_and_svr func delete_all_msg_from_local_and_svr(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.DeleteAllMsgFromLocalAndSvr(baseCallback, C.GoString(operationID)) } //export delete_all_msg_from_local func delete_all_msg_from_local(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.DeleteAllMsgFromLocal(baseCallback, C.GoString(operationID)) } //export clear_conversation_and_delete_all_msg func clear_conversation_and_delete_all_msg(operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.ClearConversationAndDeleteAllMsg(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export delete_conversation_and_delete_all_msg func delete_conversation_and_delete_all_msg(operationID *C.char, conversationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.DeleteConversationAndDeleteAllMsg(baseCallback, C.GoString(operationID), C.GoString(conversationID)) } //export insert_single_message_to_local_storage func insert_single_message_to_local_storage(operationID *C.char, message *C.char, recvID *C.char, sendID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_MsgStruct) open_im_sdk.InsertSingleMessageToLocalStorage(baseCallback, C.GoString(operationID), C.GoString(message), C.GoString(recvID), C.GoString(sendID)) } //export insert_group_message_to_local_storage func insert_group_message_to_local_storage(operationID *C.char, message *C.char, groupID *C.char, sendID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_MsgStruct) open_im_sdk.InsertGroupMessageToLocalStorage(baseCallback, C.GoString(operationID), C.GoString(message), C.GoString(groupID), C.GoString(sendID)) } //export search_local_messages func search_local_messages(operationID *C.char, searchParam *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_SearchLocalMessagesCallback) open_im_sdk.SearchLocalMessages(baseCallback, C.GoString(operationID), C.GoString(searchParam)) } //export set_message_local_ex func set_message_local_ex(operationID *C.char, conversationID *C.char, clientMsgID *C.char, localEx *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetMessageLocalEx(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID), C.GoString(localEx)) } @@ -832,67 +833,67 @@ func set_message_local_ex(operationID *C.char, conversationID *C.char, clientMsg //export get_users_info func get_users_info(operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_FullUserInfo_List) open_im_sdk.GetUsersInfo(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } //export get_users_info_with_cache func get_users_info_with_cache(operationID *C.char, userIDs *C.char, groupID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_FullUserInfoWithCache_List) open_im_sdk.GetUsersInfoWithCache(baseCallback, C.GoString(operationID), C.GoString(userIDs), C.GoString(groupID)) } //export get_users_info_from_srv func get_users_info_from_srv(operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalUser_List) open_im_sdk.GetUsersInfoFromSrv(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } //export set_self_info func set_self_info(operationID *C.char, userInfo *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetSelfInfo(baseCallback, C.GoString(operationID), C.GoString(userInfo)) } //export set_global_recv_message_opt func set_global_recv_message_opt(operationID *C.char, opt C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetGlobalRecvMessageOpt(baseCallback, C.GoString(operationID), int(opt)) } //export get_self_user_info func get_self_user_info(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalUser) open_im_sdk.GetSelfUserInfo(baseCallback, C.GoString(operationID)) } //export update_msg_sender_info func update_msg_sender_info(operationID *C.char, nickname *C.char, faceURL *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.UpdateMsgSenderInfo(baseCallback, C.GoString(operationID), C.GoString(nickname), C.GoString(faceURL)) } //export subscribe_users_status func subscribe_users_status(operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_OnlineStatus_List) open_im_sdk.SubscribeUsersStatus(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } //export unsubscribe_users_status func unsubscribe_users_status(operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.UnsubscribeUsersStatus(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } //export get_subscribe_users_status func get_subscribe_users_status(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_OnlineStatus_List) open_im_sdk.GetSubscribeUsersStatus(baseCallback, C.GoString(operationID)) } //export get_user_status func get_user_status(operationID *C.char, userIDs *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_OnlineStatus_List) open_im_sdk.GetUserStatus(baseCallback, C.GoString(operationID), C.GoString(userIDs)) } @@ -900,91 +901,91 @@ func get_user_status(operationID *C.char, userIDs *C.char) { // //export get_specified_friends_info func get_specified_friends_info(operationID *C.char, userIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_FullUserInfo_List) open_im_sdk.GetSpecifiedFriendsInfo(baseCallback, C.GoString(operationID), C.GoString(userIDList)) } //export get_friend_list func get_friend_list(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_FullUserInfo_List) open_im_sdk.GetFriendList(baseCallback, C.GoString(operationID)) } //export get_friend_list_page func get_friend_list_page(operationID *C.char, offset C.int, count C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_FullUserInfo_List) open_im_sdk.GetFriendListPage(baseCallback, C.GoString(operationID), int32(offset), int32(count)) } //export search_friends func search_friends(operationID *C.char, searchParam *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_SearchFriendItem_List) open_im_sdk.SearchFriends(baseCallback, C.GoString(operationID), C.GoString(searchParam)) } //export check_friend func check_friend(operationID *C.char, userIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_UserIDResult_List) open_im_sdk.CheckFriend(baseCallback, C.GoString(operationID), C.GoString(userIDList)) } //export add_friend func add_friend(operationID *C.char, userIDReqMsg *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.AddFriend(baseCallback, C.GoString(operationID), C.GoString(userIDReqMsg)) } //export set_friend_remark func set_friend_remark(operationID *C.char, userIDRemark *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetFriendRemark(baseCallback, C.GoString(operationID), C.GoString(userIDRemark)) } //export delete_friend func delete_friend(operationID *C.char, friendUserID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.DeleteFriend(baseCallback, C.GoString(operationID), C.GoString(friendUserID)) } //export get_friend_application_list_as_recipient func get_friend_application_list_as_recipient(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalFriendRequest_List) open_im_sdk.GetFriendApplicationListAsRecipient(baseCallback, C.GoString(operationID)) } //export get_friend_application_list_as_applicant func get_friend_application_list_as_applicant(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalFriendRequest_List) open_im_sdk.GetFriendApplicationListAsApplicant(baseCallback, C.GoString(operationID)) } //export accept_friend_application func accept_friend_application(operationID *C.char, userIDHandleMsg *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.AcceptFriendApplication(baseCallback, C.GoString(operationID), C.GoString(userIDHandleMsg)) } //export refuse_friend_application func refuse_friend_application(operationID *C.char, userIDHandleMsg *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.RefuseFriendApplication(baseCallback, C.GoString(operationID), C.GoString(userIDHandleMsg)) } //export add_black func add_black(operationID *C.char, blackUserID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.AddBlack(baseCallback, C.GoString(operationID), C.GoString(blackUserID)) } //export get_black_list func get_black_list(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalBlack_List) open_im_sdk.GetBlackList(baseCallback, C.GoString(operationID)) } //export remove_black func remove_black(operationID *C.char, removeUserID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.RemoveBlack(baseCallback, C.GoString(operationID), C.GoString(removeUserID)) } @@ -993,7 +994,7 @@ func remove_black(operationID *C.char, removeUserID *C.char) { // //export create_group func create_group(operationID, cGroupReqInfo *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_GroupInfo) open_im_sdk.CreateGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupReqInfo)) } @@ -1001,7 +1002,7 @@ func create_group(operationID, cGroupReqInfo *C.char) { // //export join_group func join_group(operationID, cGroupID, cReqMsg *C.char, cJoinSource C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.JoinGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReqMsg), int32(cJoinSource)) } @@ -1010,7 +1011,7 @@ func join_group(operationID, cGroupID, cReqMsg *C.char, cJoinSource C.int) { // //export quit_group func quit_group(operationID, cGroupID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.QuitGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) } @@ -1018,7 +1019,7 @@ func quit_group(operationID, cGroupID *C.char) { // //export dismiss_group func dismiss_group(operationID, cGroupID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.DismissGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) } @@ -1026,7 +1027,7 @@ func dismiss_group(operationID, cGroupID *C.char) { // //export change_group_mute func change_group_mute(operationID, cGroupID *C.char, cIsMute C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.ChangeGroupMute(baseCallback, C.GoString(operationID), C.GoString(cGroupID), parseBool(int(cIsMute))) } @@ -1034,7 +1035,7 @@ func change_group_mute(operationID, cGroupID *C.char, cIsMute C.int) { // //export change_group_member_mute func change_group_member_mute(operationID, cGroupID, cUserID *C.char, cMutedSeconds C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.ChangeGroupMemberMute(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserID), int(cMutedSeconds)) } @@ -1043,7 +1044,7 @@ func change_group_member_mute(operationID, cGroupID, cUserID *C.char, cMutedSeco // //export set_group_member_role_level func set_group_member_role_level(operationID, cGroupID, cUserID *C.char, cRoleLevel C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetGroupMemberRoleLevel(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserID), int(cRoleLevel)) } @@ -1052,7 +1053,7 @@ func set_group_member_role_level(operationID, cGroupID, cUserID *C.char, cRoleLe // //export set_group_member_info func set_group_member_info(operationID *C.char, cGroupMemberInfo *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetGroupMemberInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupMemberInfo)) } @@ -1060,7 +1061,7 @@ func set_group_member_info(operationID *C.char, cGroupMemberInfo *C.char) { // //export get_joined_group_list func get_joined_group_list(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroup_List) open_im_sdk.GetJoinedGroupList(baseCallback, C.GoString(operationID)) } @@ -1068,7 +1069,7 @@ func get_joined_group_list(operationID *C.char) { // //export get_specified_groups_info func get_specified_groups_info(operationID, cGroupIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroup_List) open_im_sdk.GetSpecifiedGroupsInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupIDList)) } @@ -1076,7 +1077,7 @@ func get_specified_groups_info(operationID, cGroupIDList *C.char) { // //export search_groups func search_groups(operationID, cSearchParam *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroup_List) open_im_sdk.SearchGroups(baseCallback, C.GoString(operationID), C.GoString(cSearchParam)) } @@ -1084,7 +1085,7 @@ func search_groups(operationID, cSearchParam *C.char) { // //export set_group_info func set_group_info(operationID, cGroupInfo *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetGroupInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupInfo)) } @@ -1092,7 +1093,7 @@ func set_group_info(operationID, cGroupInfo *C.char) { // //export set_group_verification func set_group_verification(operationID, cGroupID *C.char, cVerification C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetGroupVerification(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cVerification)) } @@ -1100,7 +1101,7 @@ func set_group_verification(operationID, cGroupID *C.char, cVerification C.int) // //export set_group_look_member_info func set_group_look_member_info(operationID, cGroupID *C.char, cRule C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetGroupLookMemberInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cRule)) } @@ -1108,7 +1109,7 @@ func set_group_look_member_info(operationID, cGroupID *C.char, cRule C.int) { // //export set_group_apply_member_friend func set_group_apply_member_friend(operationID, cGroupID *C.char, cRule C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetGroupApplyMemberFriend(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cRule)) } @@ -1116,7 +1117,7 @@ func set_group_apply_member_friend(operationID, cGroupID *C.char, cRule C.int) { // //export get_group_member_list func get_group_member_list(operationID, cGroupID *C.char, cFilter, cOffset, cCount C.int) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) open_im_sdk.GetGroupMemberList(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cFilter), int32(cOffset), int32(cCount)) } @@ -1125,7 +1126,7 @@ func get_group_member_list(operationID, cGroupID *C.char, cFilter, cOffset, cCou // //export get_group_member_owner_and_admin func get_group_member_owner_and_admin(operationID, cGroupID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) open_im_sdk.GetGroupMemberOwnerAndAdmin(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) } @@ -1134,7 +1135,7 @@ func get_group_member_owner_and_admin(operationID, cGroupID *C.char) { //export get_group_member_list_by_join_time_filter func get_group_member_list_by_join_time_filter(operationID, cGroupID *C.char, cOffset, cCount C.int, cJoinTimeBegin, cJoinTimeEnd C.longlong, cFilterUserIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) open_im_sdk.GetGroupMemberListByJoinTimeFilter(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cOffset), int32(cCount), int64(cJoinTimeBegin), int64(cJoinTimeEnd), C.GoString(cFilterUserIDList)) } @@ -1143,7 +1144,7 @@ func get_group_member_list_by_join_time_filter(operationID, cGroupID *C.char, cO // //export get_specified_group_members_info func get_specified_group_members_info(operationID, cGroupID, cUserIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) open_im_sdk.GetSpecifiedGroupMembersInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserIDList)) } @@ -1152,7 +1153,7 @@ func get_specified_group_members_info(operationID, cGroupID, cUserIDList *C.char // //export kick_group_member func kick_group_member(operationID, cGroupID, cReason, cUserIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.KickGroupMember(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReason), C.GoString(cUserIDList)) } @@ -1161,7 +1162,7 @@ func kick_group_member(operationID, cGroupID, cReason, cUserIDList *C.char) { // //export transfer_group_owner func transfer_group_owner(operationID, cGroupID, cNewOwnerUserID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.TransferGroupOwner(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cNewOwnerUserID)) } @@ -1170,7 +1171,7 @@ func transfer_group_owner(operationID, cGroupID, cNewOwnerUserID *C.char) { // //export invite_user_to_group func invite_user_to_group(operationID, cGroupID, cReason, cUserIDList *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.InviteUserToGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReason), C.GoString(cUserIDList)) } @@ -1179,7 +1180,7 @@ func invite_user_to_group(operationID, cGroupID, cReason, cUserIDList *C.char) { // //export get_group_application_list_as_recipient func get_group_application_list_as_recipient(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalAdminGroupRequest_List) open_im_sdk.GetGroupApplicationListAsRecipient(baseCallback, C.GoString(operationID)) } @@ -1187,7 +1188,7 @@ func get_group_application_list_as_recipient(operationID *C.char) { // //export get_group_application_list_as_applicant func get_group_application_list_as_applicant(operationID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroupRequest_List) open_im_sdk.GetGroupApplicationListAsApplicant(baseCallback, C.GoString(operationID)) } @@ -1195,7 +1196,7 @@ func get_group_application_list_as_applicant(operationID *C.char) { // //export accept_group_application func accept_group_application(operationID, cGroupID, cFromUserID, cHandleMsg *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.AcceptGroupApplication(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cFromUserID), C.GoString(cHandleMsg)) } @@ -1204,7 +1205,7 @@ func accept_group_application(operationID, cGroupID, cFromUserID, cHandleMsg *C. // //export refuse_group_application func refuse_group_application(operationID, cGroupID, cFromUserID, cHandleMsg *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.RefuseGroupApplication(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cFromUserID), C.GoString(cHandleMsg)) } @@ -1213,7 +1214,7 @@ func refuse_group_application(operationID, cGroupID, cFromUserID, cHandleMsg *C. // //export set_group_member_nickname func set_group_member_nickname(operationID, cGroupID, cUserID, cGroupMemberNickname *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.SetGroupMemberNickname(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserID), C.GoString(cGroupMemberNickname)) } @@ -1222,7 +1223,7 @@ func set_group_member_nickname(operationID, cGroupID, cUserID, cGroupMemberNickn // //export search_group_members func search_group_members(operationID, cSearchParam *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) open_im_sdk.SearchGroupMembers(baseCallback, C.GoString(operationID), C.GoString(cSearchParam)) } @@ -1230,7 +1231,7 @@ func search_group_members(operationID, cSearchParam *C.char) { // //export is_join_group func is_join_group(operationID, cGroupID *C.char) { - baseCallback := NewBaseCallback(operationID) + baseCallback := NewBaseCallback(operationID, DataType_Bool) open_im_sdk.IsJoinGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) } diff --git a/message.go b/message.go index c0c1d6a..4a155c9 100644 --- a/message.go +++ b/message.go @@ -5,7 +5,7 @@ const ( Msg_Connecting Msg_ConnectSuccess - Msg_ConectFailed + Msg_ConnectFailed Msg_KickedOffline Msg_UserTokenExpired @@ -64,19 +64,59 @@ const ( Msg_Base_Success ) +const ( + DataType_Empty = iota + DataType_Int + DataType_Bool + DataType_LocalConversation + DataType_LocalConversation_List + DataType_GetConversationRecvMessageOptResp_List + DataType_FindMessageListCallback + DataType_GetAdvancedHistoryMessageListParams + DataType_MsgStruct + DataType_SearchLocalMessagesCallback + DataType_FullUserInfo + DataType_FullUserInfo_List + DataType_FullUserInfoWithCache + DataType_FullUserInfoWithCache_List + DataType_LocalUser + DataType_LocalUser_List + DataType_OnlineStatus + DataType_OnlineStatus_List + DataType_SearchFriendItem + DataType_SearchFriendItem_List + DataType_UserIDResult + DataType_UserIDResult_List + DataType_LocalFriendRequest + DataType_LocalFriendRequest_List + DataType_LocalBlack + DataType_LocalBlack_List + DataType_GroupInfo + DataType_LocalGroup + DataType_LocalGroup_List + DataType_LocalGroupMember + DataType_LocalGroupMember_List + DataType_LocalAdminGroupRequest + DataType_LocalAdminGroupRequest_List + DataType_LocalGroupRequest + DataType_LocalGroupRequest_List +) + type Empty struct { } type Error struct { + OperationID string `json:"operationId"` ErrCode int32 `json:"errCode"` ErrMsg string `json:"errMsg"` - OperationID string `json:"operationId"` } type Success struct { OperationID string `json:"operationId"` + DataType int `json:"dataType"` Data string `json:"data"` } + type Progress struct { OperationID string `json:"operationId"` Progress int `json:"progress"` From 73b29b5bb9fc88e57098a443858645838d23513f Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Thu, 25 Jan 2024 18:05:21 +0800 Subject: [PATCH 04/13] dev: merage suc err --- export.go | 6 +++--- message.go | 12 ++++++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/export.go b/export.go index 7e93499..46c5c74 100644 --- a/export.go +++ b/export.go @@ -257,7 +257,7 @@ func (s SendMessageCallback) OnError(errCode int32, errMsg string) { } func (s SendMessageCallback) OnSuccess(data string) { - DispatorMsg(Msg_SendMessage_Success, Success{OperationID: s.operationID, Data: data}) + DispatorMsg(Msg_SendMessage_Success, Success{OperationID: s.operationID, Data: data, DataType: DataType_MsgStruct}) } func (s SendMessageCallback) OnProgress(progress int) { @@ -273,10 +273,10 @@ func NewBaseCallback(operationID *C.char, dataType int) *BaseCallback { return &BaseCallback{OperationID: C.GoString(operationID), DataType: dataType} } func (b BaseCallback) OnError(errCode int32, errMsg string) { - DispatorMsg(Msg_Base_Error, Error{OperationID: b.OperationID, ErrCode: errCode, ErrMsg: errMsg}) + DispatorMsg(Msg_ErrorOrSuc, ErrorOrSuccess{OperationID: b.OperationID, ErrCode: errCode, ErrMsg: errMsg, DataType: DataType_Empty, Data: ""}) } func (b BaseCallback) OnSuccess(data string) { - DispatorMsg(Msg_Base_Success, Success{OperationID: b.OperationID, DataType: b.DataType, Data: data}) + DispatorMsg(Msg_ErrorOrSuc, ErrorOrSuccess{OperationID: b.OperationID, DataType: b.DataType, Data: data, ErrCode: -1, ErrMsg: ""}) } type GroupListener struct { diff --git a/message.go b/message.go index 4a155c9..9264fd9 100644 --- a/message.go +++ b/message.go @@ -60,8 +60,7 @@ const ( Msg_SendMessage_Success Msg_SendMessage_Progress - Msg_Base_Error - Msg_Base_Success + Msg_ErrorOrSuc ) const ( @@ -104,17 +103,22 @@ const ( type Empty struct { } - type Error struct { OperationID string `json:"operationId"` ErrCode int32 `json:"errCode"` ErrMsg string `json:"errMsg"` } - type Success struct { OperationID string `json:"operationId"` + Data string `json:"data"` DataType int `json:"dataType"` +} +type ErrorOrSuccess struct { + OperationID string `json:"operationId"` + ErrCode int32 `json:"errCode"` Data string `json:"data"` + DataType int `json:"dataType"` + ErrMsg string `json:"errMsg"` } type Progress struct { From f18b94852523c6722060dca98b911215b362cab9 Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Thu, 25 Jan 2024 22:06:57 +0800 Subject: [PATCH 05/13] dev:change name --- export.go | 8 ++++---- message.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/export.go b/export.go index 46c5c74..27ff729 100644 --- a/export.go +++ b/export.go @@ -729,25 +729,25 @@ func send_message_not_oss(operationID, message, recvID, groupID, offlinePushInfo //export find_message_list func find_message_list(operationID *C.char, findMessageOptions *C.char) { - baseCallback := NewBaseCallback(operationID, DataType_FindMessageListCallback) + baseCallback := NewBaseCallback(operationID, DataType_FindMessageList) open_im_sdk.FindMessageList(baseCallback, C.GoString(operationID), C.GoString(findMessageOptions)) } //export get_advanced_history_message_list func get_advanced_history_message_list(operationID, getMessageOptions *C.char) { - baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageListParams) + baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageList) open_im_sdk.GetAdvancedHistoryMessageList(baseCallback, C.GoString(operationID), C.GoString(getMessageOptions)) } //export get_advanced_history_message_list_reverse func get_advanced_history_message_list_reverse(operationID *C.char, getMessageOptions *C.char) { - baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageListParams) + baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageList) open_im_sdk.GetAdvancedHistoryMessageListReverse(baseCallback, C.GoString(operationID), C.GoString(getMessageOptions)) } //export revoke_message func revoke_message(operationID *C.char, conversationID *C.char, clientMsgID *C.char) { - baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageListParams) + baseCallback := NewBaseCallback(operationID, DataType_GetAdvancedHistoryMessageList) open_im_sdk.RevokeMessage(baseCallback, C.GoString(operationID), C.GoString(conversationID), C.GoString(clientMsgID)) } diff --git a/message.go b/message.go index 9264fd9..4d6cecd 100644 --- a/message.go +++ b/message.go @@ -70,8 +70,8 @@ const ( DataType_LocalConversation DataType_LocalConversation_List DataType_GetConversationRecvMessageOptResp_List - DataType_FindMessageListCallback - DataType_GetAdvancedHistoryMessageListParams + DataType_FindMessageList + DataType_GetAdvancedHistoryMessageList DataType_MsgStruct DataType_SearchLocalMessagesCallback DataType_FullUserInfo From 1a9fd78ebf942601576c22d52403c5b76ac84c69 Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Sun, 28 Jan 2024 22:37:57 +0800 Subject: [PATCH 06/13] =?UTF-8?q?fix=EF=BC=9Achange=20some=20args=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- export.go | 266 +++++++++++++----------------------------------------- 1 file changed, 61 insertions(+), 205 deletions(-) diff --git a/export.go b/export.go index 27ff729..f91c866 100644 --- a/export.go +++ b/export.go @@ -279,150 +279,6 @@ func (b BaseCallback) OnSuccess(data string) { DispatorMsg(Msg_ErrorOrSuc, ErrorOrSuccess{OperationID: b.OperationID, DataType: b.DataType, Data: data, ErrCode: -1, ErrMsg: ""}) } -type GroupListener struct { -} - -func (GroupListener) OnGroupApplicationAccepted(groupApplication string) { - -} -func (GroupListener) OnGroupApplicationAdded(groupApplication string) { -} -func (GroupListener) OnGroupApplicationDeleted(groupApplication string) { -} - -func (GroupListener) OnGroupApplicationRejected(groupApplication string) { -} - -func (GroupListener) OnGroupDismissed(groupInfo string) { -} - -func (GroupListener) OnGroupInfoChanged(groupInfo string) { -} - -func (GroupListener) OnGroupMemberAdded(groupMemberInfo string) { -} -func (GroupListener) OnGroupMemberDeleted(groupMemberInfo string) { -} -func (GroupListener) OnGroupMemberInfoChanged(groupMemberInfo string) { -} - -func (GroupListener) OnJoinedGroupAdded(groupInfo string) { -} - -func (GroupListener) OnJoinedGroupDeleted(groupInfo string) { -} - -type ConversationListener struct { -} - -func (ConversationListener) OnConversationChanged(conversationList string) { -} -func (ConversationListener) OnNewConversation(conversationList string) { -} -func (ConversationListener) OnSyncServerFailed() { -} -func (ConversationListener) OnSyncServerFinish() { -} -func (ConversationListener) OnSyncServerStart() { -} - -func (ConversationListener) OnTotalUnreadMessageCountChanged(totalUnreadCount int32) { -} - -type AdvancedMsgListener struct { -} - -func (AdvancedMsgListener) OnMsgDeleted(message string) { -} -func (AdvancedMsgListener) OnNewRecvMessageRevoked(messageRevoked string) { -} -func (AdvancedMsgListener) OnRecvC2CReadReceipt(msgReceiptList string) { -} -func (AdvancedMsgListener) OnRecvGroupReadReceipt(groupMsgReceiptList string) { -} -func (AdvancedMsgListener) OnRecvMessageExtensionsAdded(msgID string, reactionExtensionList string) { -} -func (AdvancedMsgListener) OnRecvMessageExtensionsChanged(msgID string, reactionExtensionList string) { -} -func (AdvancedMsgListener) OnRecvMessageExtensionsDeleted(msgID string, reactionExtensionKeyList string) { -} -func (AdvancedMsgListener) OnRecvNewMessage(message string) { -} -func (AdvancedMsgListener) OnRecvOfflineNewMessage(message string) { -} - -type BatchMsgListener struct { -} - -func (BatchMsgListener) OnRecvNewMessages(messageList string) { -} - -func (BatchMsgListener) OnRecvOfflineNewMessages(messageList string) { -} - -type UserListener struct { -} - -func (UserListener) OnSelfInfoUpdated(userInfo string) { -} - -func (UserListener) OnUserStatusChanged(userOnlineStatus string) { - -} - -type FriendListener struct { -} - -func (FriendListener) OnBlackAdded(blackInfo string) { - -} - -func (FriendListener) OnBlackDeleted(blackInfo string) { - -} - -func (FriendListener) OnFriendAdded(friendInfo string) { - -} - -func (FriendListener) OnFriendApplicationAccepted(friendApplication string) { - -} - -func (FriendListener) OnFriendApplicationAdded(friendApplication string) { - -} - -func (FriendListener) OnFriendApplicationDeleted(friendApplication string) { - -} - -func (FriendListener) OnFriendApplicationRejected(friendApplication string) { - -} - -func (FriendListener) OnFriendDeleted(friendInfo string) { - -} - -func (FriendListener) OnFriendInfoChanged(friendInfo string) { - -} - -type CustomBusinessListener struct { -} - -func (CustomBusinessListener) OnRecvCustomBusinessMessage(businessMessage string) { - -} - -type MessageKvInfoListener struct { -} - -func (MessageKvInfoListener) OnMessageKvInfoChanged(messageChangedList string) { - -} - // =====================================================init_login=============================================== //export init_sdk @@ -993,68 +849,68 @@ func remove_black(operationID *C.char, removeUserID *C.char) { // CreateGroup creates a group // //export create_group -func create_group(operationID, cGroupReqInfo *C.char) { +func create_group(operationID, groupReqInfo *C.char) { baseCallback := NewBaseCallback(operationID, DataType_GroupInfo) - open_im_sdk.CreateGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupReqInfo)) + open_im_sdk.CreateGroup(baseCallback, C.GoString(operationID), C.GoString(groupReqInfo)) } // JoinGroup joins a group // //export join_group -func join_group(operationID, cGroupID, cReqMsg *C.char, cJoinSource C.int) { +func join_group(operationID, groupId, reqMsg *C.char, joinSource C.int) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.JoinGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReqMsg), - int32(cJoinSource)) + open_im_sdk.JoinGroup(baseCallback, C.GoString(operationID), C.GoString(groupId), C.GoString(reqMsg), + int32(joinSource)) } // QuitGroup quits a group // //export quit_group -func quit_group(operationID, cGroupID *C.char) { +func quit_group(operationID, groupId *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.QuitGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) + open_im_sdk.QuitGroup(baseCallback, C.GoString(operationID), C.GoString(groupId)) } // DismissGroup dismisses a group // //export dismiss_group -func dismiss_group(operationID, cGroupID *C.char) { +func dismiss_group(operationID, groupId *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.DismissGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) + open_im_sdk.DismissGroup(baseCallback, C.GoString(operationID), C.GoString(groupId)) } // ChangeGroupMute changes the mute status of a group // //export change_group_mute -func change_group_mute(operationID, cGroupID *C.char, cIsMute C.int) { +func change_group_mute(operationID, groupId *C.char, cIsMute C.int) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.ChangeGroupMute(baseCallback, C.GoString(operationID), C.GoString(cGroupID), parseBool(int(cIsMute))) + open_im_sdk.ChangeGroupMute(baseCallback, C.GoString(operationID), C.GoString(groupId), parseBool(int(cIsMute))) } // ChangeGroupMemberMute changes the mute status of a group member // //export change_group_member_mute -func change_group_member_mute(operationID, cGroupID, cUserID *C.char, cMutedSeconds C.int) { +func change_group_member_mute(operationID, groupId, userId *C.char, mutedSeconds C.int) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.ChangeGroupMemberMute(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cUserID), - int(cMutedSeconds)) + open_im_sdk.ChangeGroupMemberMute(baseCallback, C.GoString(operationID), C.GoString(groupId), C.GoString(userId), + int(mutedSeconds)) } // SetGroupMemberRoleLevel sets the role level of a group member // //export set_group_member_role_level -func set_group_member_role_level(operationID, cGroupID, cUserID *C.char, cRoleLevel C.int) { +func set_group_member_role_level(operationID, groupId, userId *C.char, roleLevel C.int) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.SetGroupMemberRoleLevel(baseCallback, C.GoString(operationID), C.GoString(cGroupID), - C.GoString(cUserID), int(cRoleLevel)) + open_im_sdk.SetGroupMemberRoleLevel(baseCallback, C.GoString(operationID), C.GoString(groupId), + C.GoString(userId), int(roleLevel)) } // SetGroupMemberInfo sets the information of a group member // //export set_group_member_info -func set_group_member_info(operationID *C.char, cGroupMemberInfo *C.char) { +func set_group_member_info(operationID *C.char, groupMemberInfo *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.SetGroupMemberInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupMemberInfo)) + open_im_sdk.SetGroupMemberInfo(baseCallback, C.GoString(operationID), C.GoString(groupMemberInfo)) } // GetJoinedGroupList retrieves the list of joined groups @@ -1068,112 +924,112 @@ func get_joined_group_list(operationID *C.char) { // GetSpecifiedGroupsInfo retrieves the information of specified groups // //export get_specified_groups_info -func get_specified_groups_info(operationID, cGroupIDList *C.char) { +func get_specified_groups_info(operationID, groupIdList *C.char) { baseCallback := NewBaseCallback(operationID, DataType_LocalGroup_List) - open_im_sdk.GetSpecifiedGroupsInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupIDList)) + open_im_sdk.GetSpecifiedGroupsInfo(baseCallback, C.GoString(operationID), C.GoString(groupIdList)) } // SearchGroups searches for groups // //export search_groups -func search_groups(operationID, cSearchParam *C.char) { +func search_groups(operationID, searchParam *C.char) { baseCallback := NewBaseCallback(operationID, DataType_LocalGroup_List) - open_im_sdk.SearchGroups(baseCallback, C.GoString(operationID), C.GoString(cSearchParam)) + open_im_sdk.SearchGroups(baseCallback, C.GoString(operationID), C.GoString(searchParam)) } // SetGroupInfo sets the information of a group // //export set_group_info -func set_group_info(operationID, cGroupInfo *C.char) { +func set_group_info(operationID, groupInfo *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.SetGroupInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupInfo)) + open_im_sdk.SetGroupInfo(baseCallback, C.GoString(operationID), C.GoString(groupInfo)) } // SetGroupVerification sets the verification mode of a group // //export set_group_verification -func set_group_verification(operationID, cGroupID *C.char, cVerification C.int) { +func set_group_verification(operationID, groupId *C.char, verification C.int) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.SetGroupVerification(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cVerification)) + open_im_sdk.SetGroupVerification(baseCallback, C.GoString(operationID), C.GoString(groupId), int32(verification)) } // SetGroupLookMemberInfo sets the member information visibility of a group // //export set_group_look_member_info -func set_group_look_member_info(operationID, cGroupID *C.char, cRule C.int) { +func set_group_look_member_info(operationID, groupId *C.char, cRule C.int) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.SetGroupLookMemberInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cRule)) + open_im_sdk.SetGroupLookMemberInfo(baseCallback, C.GoString(operationID), C.GoString(groupId), int32(cRule)) } // SetGroupApplyMemberFriend sets the friend rule for group applicants // //export set_group_apply_member_friend -func set_group_apply_member_friend(operationID, cGroupID *C.char, cRule C.int) { +func set_group_apply_member_friend(operationID, groupId *C.char, cRule C.int) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.SetGroupApplyMemberFriend(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cRule)) + open_im_sdk.SetGroupApplyMemberFriend(baseCallback, C.GoString(operationID), C.GoString(groupId), int32(cRule)) } // GetGroupMemberList retrieves the list of group members // //export get_group_member_list -func get_group_member_list(operationID, cGroupID *C.char, cFilter, cOffset, cCount C.int) { +func get_group_member_list(operationID, groupId *C.char, cFilter, cOffset, cCount C.int) { baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) - open_im_sdk.GetGroupMemberList(baseCallback, C.GoString(operationID), C.GoString(cGroupID), int32(cFilter), + open_im_sdk.GetGroupMemberList(baseCallback, C.GoString(operationID), C.GoString(groupId), int32(cFilter), int32(cOffset), int32(cCount)) } // GetGroupMemberOwnerAndAdmin retrieves the owner and admin members of a group // //export get_group_member_owner_and_admin -func get_group_member_owner_and_admin(operationID, cGroupID *C.char) { +func get_group_member_owner_and_admin(operationID, groupId *C.char) { baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) - open_im_sdk.GetGroupMemberOwnerAndAdmin(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) + open_im_sdk.GetGroupMemberOwnerAndAdmin(baseCallback, C.GoString(operationID), C.GoString(groupId)) } // GetGroupMemberListByJoinTimeFilter retrieves the list of group members filtered by join time // //export get_group_member_list_by_join_time_filter -func get_group_member_list_by_join_time_filter(operationID, cGroupID *C.char, cOffset, +func get_group_member_list_by_join_time_filter(operationID, groupId *C.char, cOffset, cCount C.int, cJoinTimeBegin, cJoinTimeEnd C.longlong, cFilterUserIDList *C.char) { baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) - open_im_sdk.GetGroupMemberListByJoinTimeFilter(baseCallback, C.GoString(operationID), C.GoString(cGroupID), + open_im_sdk.GetGroupMemberListByJoinTimeFilter(baseCallback, C.GoString(operationID), C.GoString(groupId), int32(cOffset), int32(cCount), int64(cJoinTimeBegin), int64(cJoinTimeEnd), C.GoString(cFilterUserIDList)) } // GetSpecifiedGroupMembersInfo retrieves the information of specified group members // //export get_specified_group_members_info -func get_specified_group_members_info(operationID, cGroupID, cUserIDList *C.char) { +func get_specified_group_members_info(operationID, groupId, userIdList *C.char) { baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) - open_im_sdk.GetSpecifiedGroupMembersInfo(baseCallback, C.GoString(operationID), C.GoString(cGroupID), - C.GoString(cUserIDList)) + open_im_sdk.GetSpecifiedGroupMembersInfo(baseCallback, C.GoString(operationID), C.GoString(groupId), + C.GoString(userIdList)) } // KickGroupMember kicks group members // //export kick_group_member -func kick_group_member(operationID, cGroupID, cReason, cUserIDList *C.char) { +func kick_group_member(operationID, groupId, cReason, userIdList *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.KickGroupMember(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReason), - C.GoString(cUserIDList)) + open_im_sdk.KickGroupMember(baseCallback, C.GoString(operationID), C.GoString(groupId), C.GoString(cReason), + C.GoString(userIdList)) } // TransferGroupOwner transfers the ownership of a group // //export transfer_group_owner -func transfer_group_owner(operationID, cGroupID, cNewOwnerUserID *C.char) { +func transfer_group_owner(operationID, groupId, cNewOwnerUserID *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.TransferGroupOwner(baseCallback, C.GoString(operationID), C.GoString(cGroupID), + open_im_sdk.TransferGroupOwner(baseCallback, C.GoString(operationID), C.GoString(groupId), C.GoString(cNewOwnerUserID)) } // InviteUserToGroup invites users to a group // //export invite_user_to_group -func invite_user_to_group(operationID, cGroupID, cReason, cUserIDList *C.char) { +func invite_user_to_group(operationID, groupId, cReason, userIdList *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.InviteUserToGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID), C.GoString(cReason), - C.GoString(cUserIDList)) + open_im_sdk.InviteUserToGroup(baseCallback, C.GoString(operationID), C.GoString(groupId), C.GoString(cReason), + C.GoString(userIdList)) } // GetGroupApplicationListAsRecipient retrieves the group application list as a recipient @@ -1195,44 +1051,44 @@ func get_group_application_list_as_applicant(operationID *C.char) { // AcceptGroupApplication accepts a group application // //export accept_group_application -func accept_group_application(operationID, cGroupID, cFromUserID, cHandleMsg *C.char) { +func accept_group_application(operationID, groupId, fromUserId, handleMsg *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.AcceptGroupApplication(baseCallback, C.GoString(operationID), C.GoString(cGroupID), - C.GoString(cFromUserID), C.GoString(cHandleMsg)) + open_im_sdk.AcceptGroupApplication(baseCallback, C.GoString(operationID), C.GoString(groupId), + C.GoString(fromUserId), C.GoString(handleMsg)) } // RefuseGroupApplication refuses a group application // //export refuse_group_application -func refuse_group_application(operationID, cGroupID, cFromUserID, cHandleMsg *C.char) { +func refuse_group_application(operationID, groupId, fromUserId, handleMsg *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.RefuseGroupApplication(baseCallback, C.GoString(operationID), C.GoString(cGroupID), - C.GoString(cFromUserID), C.GoString(cHandleMsg)) + open_im_sdk.RefuseGroupApplication(baseCallback, C.GoString(operationID), C.GoString(groupId), + C.GoString(fromUserId), C.GoString(handleMsg)) } // SetGroupMemberNickname sets the nickname of a group member // //export set_group_member_nickname -func set_group_member_nickname(operationID, cGroupID, cUserID, cGroupMemberNickname *C.char) { +func set_group_member_nickname(operationID, groupId, userId, groupMemberNickname *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.SetGroupMemberNickname(baseCallback, C.GoString(operationID), C.GoString(cGroupID), - C.GoString(cUserID), C.GoString(cGroupMemberNickname)) + open_im_sdk.SetGroupMemberNickname(baseCallback, C.GoString(operationID), C.GoString(groupId), + C.GoString(userId), C.GoString(groupMemberNickname)) } // SearchGroupMembers searches for group members // //export search_group_members -func search_group_members(operationID, cSearchParam *C.char) { +func search_group_members(operationID, searchParam *C.char) { baseCallback := NewBaseCallback(operationID, DataType_LocalGroupMember_List) - open_im_sdk.SearchGroupMembers(baseCallback, C.GoString(operationID), C.GoString(cSearchParam)) + open_im_sdk.SearchGroupMembers(baseCallback, C.GoString(operationID), C.GoString(searchParam)) } // IsJoinGroup checks if the user has joined a group // //export is_join_group -func is_join_group(operationID, cGroupID *C.char) { +func is_join_group(operationID, groupId *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Bool) - open_im_sdk.IsJoinGroup(baseCallback, C.GoString(operationID), C.GoString(cGroupID)) + open_im_sdk.IsJoinGroup(baseCallback, C.GoString(operationID), C.GoString(groupId)) } func main() { From e5a86539a9bc30e9f61094178047c21b66206e29 Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Mon, 5 Feb 2024 16:38:46 +0800 Subject: [PATCH 07/13] fix: free memeory --- export.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/export.go b/export.go index f91c866..ef43d50 100644 --- a/export.go +++ b/export.go @@ -2,6 +2,7 @@ package main /* #include +#include typedef void (*MessageHandler)(int id ,char* data); extern MessageHandler messageHandler; extern void CallMessageHandler(MessageHandler msgHandler,int id,char* data); @@ -13,6 +14,7 @@ import ( "fmt" "reflect" "strconv" + "unsafe" "github.com/openimsdk/openim-sdk-core/v3/open_im_sdk" ) @@ -25,18 +27,23 @@ func SetMessageHandler(handler C.MessageHandler) { func DispatorMsg(msgId int, msg interface{}) { t := reflect.TypeOf(msg) kind := t.Kind() + var data = "" if kind == reflect.Struct { msgJson, err := json.Marshal(msg) if err != nil { - C.CallMessageHandler(C.messageHandler, C.int(0), C.CString(fmt.Sprintf("Marshal Json Error :%s", err.Error()))) + msgId = 0 + data = fmt.Sprintf("Marshal Json Error :%s", err.Error()) } else { - C.CallMessageHandler(C.messageHandler, C.int(msgId), C.CString((string(msgJson)))) + data = string(msgJson) } } else if kind == reflect.String { - C.CallMessageHandler(C.messageHandler, C.int(msgId), C.CString(msg.(string))) + data = msg.(string) } else if kind == reflect.Int32 { - C.CallMessageHandler(C.messageHandler, C.int(msgId), C.CString(strconv.Itoa(msg.(int)))) + data = strconv.Itoa(msg.(int)) } + var cdata = C.CString(data) + C.CallMessageHandler(C.messageHandler, C.int(msgId), cdata) + C.free(unsafe.Pointer(cdata)) } func parseBool(b int) bool { From bfd968ea9d3dd87a81d35ba2fe7016a9a5c47cbc Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Mon, 5 Feb 2024 17:21:32 +0800 Subject: [PATCH 08/13] dev: change version to v3.5.1-alpha.8 --- export.go | 14 ++++-- go.mod | 24 +++++------ go.sum | 123 ++++++++--------------------------------------------- message.go | 2 + 4 files changed, 41 insertions(+), 122 deletions(-) diff --git a/export.go b/export.go index ef43d50..de1c5a2 100644 --- a/export.go +++ b/export.go @@ -101,6 +101,9 @@ func (c ConversationCallback) OnConversationChanged(conversationList string) { func (c ConversationCallback) OnTotalUnreadMessageCountChanged(totalUnreadCount int32) { DispatorMsg(Msg_TotalUnreadMessageCountChanged, totalUnreadCount) } +func (c ConversationCallback) OnConversationUserInputStatusChanged(change string) { + DispatorMsg(Msg_ConversationUserInputStatusChanged, change) +} type AdvancedMsgCallback struct { } @@ -132,6 +135,9 @@ func (a AdvancedMsgCallback) OnRecvOfflineNewMessage(message string) { func (a AdvancedMsgCallback) OnMsgDeleted(message string) { DispatorMsg(Msg_Advanced_MsgDeleted, message) } +func (*AdvancedMsgCallback) OnRecvOnlineOnlyMessage(message string) { + DispatorMsg(Msg_Advanced_RecvOnlineOnlyMessage, message) +} func NewAdvancedMsgCallback() *AdvancedMsgCallback { return &AdvancedMsgCallback{} @@ -835,9 +841,9 @@ func refuse_friend_application(operationID *C.char, userIDHandleMsg *C.char) { } //export add_black -func add_black(operationID *C.char, blackUserID *C.char) { +func add_black(operationID *C.char, blackUserID *C.char, ex *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) - open_im_sdk.AddBlack(baseCallback, C.GoString(operationID), C.GoString(blackUserID)) + open_im_sdk.AddBlack(baseCallback, C.GoString(operationID), C.GoString(blackUserID), C.GoString(ex)) } //export get_black_list @@ -864,10 +870,10 @@ func create_group(operationID, groupReqInfo *C.char) { // JoinGroup joins a group // //export join_group -func join_group(operationID, groupId, reqMsg *C.char, joinSource C.int) { +func join_group(operationID, groupId, reqMsg *C.char, joinSource C.int, ex *C.char) { baseCallback := NewBaseCallback(operationID, DataType_Empty) open_im_sdk.JoinGroup(baseCallback, C.GoString(operationID), C.GoString(groupId), C.GoString(reqMsg), - int32(joinSource)) + int32(joinSource), C.GoString(ex)) } // QuitGroup quits a group diff --git a/go.mod b/go.mod index b475ae7..6bde0f1 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,12 @@ module github.com/openimsdk/openim-sdk-cpp -go 1.20 +go 1.18 -require github.com/openimsdk/openim-sdk-core/v3 v3.4.0 +require github.com/openimsdk/openim-sdk-core/v3 v3.5.1-alpha.8 require ( - github.com/OpenIMSDK/protocol v0.0.23 // indirect - github.com/OpenIMSDK/tools v0.0.5 // indirect + github.com/OpenIMSDK/protocol v0.0.40 // indirect + github.com/OpenIMSDK/tools v0.0.24 // indirect github.com/bwmarrin/snowflake v0.3.0 // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect @@ -14,25 +14,23 @@ require ( github.com/jinzhu/copier v0.3.5 // indirect github.com/jinzhu/inflection v1.0.0 // indirect github.com/jinzhu/now v1.1.5 // indirect - github.com/klauspost/compress v1.16.5 // indirect github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect github.com/lestrrat-go/strftime v1.0.6 // indirect github.com/mattn/go-sqlite3 v1.14.12 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect + github.com/patrickmn/go-cache v2.1.0+incompatible // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20220106031843-2efeb10ca2f6 // indirect go.uber.org/atomic v1.7.0 // indirect - go.uber.org/multierr v1.6.0 // indirect + go.uber.org/multierr v1.6.0 // indirect; indirecv3.5.1-alpha.8t go.uber.org/zap v1.24.0 // indirect - golang.org/x/image v0.9.0 // indirect - golang.org/x/net v0.11.0 // indirect - golang.org/x/sys v0.9.0 // indirect - golang.org/x/text v0.11.0 // indirect + golang.org/x/image v0.14.0 // indirect + golang.org/x/net v0.19.0 // indirect + golang.org/x/sys v0.15.0 // indirect + golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect google.golang.org/grpc v1.56.2 // indirect google.golang.org/protobuf v1.31.0 // indirect gorm.io/driver/sqlite v1.3.6 // indirect gorm.io/gorm v1.23.8 // indirect - nhooyr.io/websocket v1.8.7 // indirect + nhooyr.io/websocket v1.8.10 // indirect ) diff --git a/go.sum b/go.sum index 65aa0fa..367d1f2 100644 --- a/go.sum +++ b/go.sum @@ -1,45 +1,19 @@ -github.com/OpenIMSDK/protocol v0.0.23 h1:L545aRQez6Ro+AaJB1Z6Mz7ojnDtp41WqASxYveCkcE= -github.com/OpenIMSDK/protocol v0.0.23/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= -github.com/OpenIMSDK/tools v0.0.5 h1:yBVHJ3EpIDcp8VFKPjuGr6MQvFa3t4JByZ+vmeC06/Q= -github.com/OpenIMSDK/tools v0.0.5/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI= +github.com/OpenIMSDK/protocol v0.0.40 h1:1/Oij6RSAaePCPrWGwp9Cyz976/8Uxr94hM5M5FXzlg= +github.com/OpenIMSDK/protocol v0.0.40/go.mod h1:F25dFrwrIx3lkNoiuf6FkCfxuwf8L4Z8UIsdTHP/r0Y= +github.com/OpenIMSDK/tools v0.0.24 h1:P8n7ZtsZEbm4W3dQAem29O+bigzy6YPXxFzd/D8Vh3U= +github.com/OpenIMSDK/tools v0.0.24/go.mod h1:eg+q4A34Qmu73xkY0mt37FHGMCMfC6CtmOnm0kFEGFI= github.com/benbjohnson/clock v1.1.0 h1:Q92kusRqC1XV2MjkWETPvjJVqKetz1OzxZB7mHJLju8= github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= -github.com/bytedance/sonic v1.9.1 h1:6iJ6NqdoxCDr6mbY8h18oSO+cShGSMRGCEo7F2h0x8s= -github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= -github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= -github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= -github.com/gin-gonic/gin v1.6.3/go.mod h1:75u5sXoLsGZoRN5Sgbi1eraJ4GU3++wFwWzhwvtwp4M= -github.com/gin-gonic/gin v1.9.1 h1:4idEAncQnU5cB7BeOkPtxjfCSye0AAm1R0RVIqJ+Jmg= -github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= -github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= -github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= -github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= -github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= -github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= -github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= -github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= -github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= -github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU= -github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= -github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/jinzhu/copier v0.3.5 h1:GlvfUwHk62RokgqVNvYsku0TATCF7bAHVwEXoBh3iJg= @@ -50,51 +24,27 @@ github.com/jinzhu/now v1.1.4/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/ github.com/jinzhu/now v1.1.5 h1:/o9tlHleP7gOFmsnYNz3RGnqzefHA47wQpKrrdTIwXQ= github.com/jinzhu/now v1.1.5/go.mod h1:d3SSVoowX0Lcu0IBviAWJpolVfI5UJVZZ7cO71lE/z8= github.com/jonboulle/clockwork v0.4.0 h1:p4Cf1aMWXnXAUh8lVfewRBx1zaTSYKrKMF2g3ST4RZ4= -github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= -github.com/klauspost/compress v1.16.5 h1:IFV2oUNUzZaz+XyusxpLzpzS8Pt5rh0Z16For/djlyI= -github.com/klauspost/compress v1.16.5/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid/v2 v2.2.4 h1:acbojRNwl3o09bUq+yDCtZFc1aiwaAAxtcn8YkZXnvk= -github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= -github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc h1:RKf14vYWi2ttpEmkA4aQ3j4u9dStX2t4M8UM6qqNsG8= github.com/lestrrat-go/envload v0.0.0-20180220234015-a3eb8ddeffcc/go.mod h1:kopuH9ugFRkIXf3YoqHKyrJ9YfUFsckUU9S7B+XP+is= github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible h1:Y6sqxHMyB1D2YSzWkLibYKgg+SwmyFU9dF2hn6MdTj4= github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible/go.mod h1:ZQnN8lSECaebrkQytbHj4xNgtg8CR7RYXnPok8e0EHA= github.com/lestrrat-go/strftime v1.0.6 h1:CFGsDEt1pOpFNU+TJB0nhz9jl+K0hZSLE205AhTIGQQ= github.com/lestrrat-go/strftime v1.0.6/go.mod h1:f7jQKgV5nnJpYgdEasS+/y7EsTb8ykN2z68n3TtcTaw= -github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA= github.com/mattn/go-sqlite3 v1.14.12 h1:TJ1bhYJPV44phC+IMu1u2K/i5RriLTPe+yc68XDJ1Z0= github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= -github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= -github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= -github.com/openimsdk/openim-sdk-core/v3 v3.4.0 h1:H5hXANjpLqKaiwaPZAFUdoPCjez29PeMvu3r7reWF8A= -github.com/openimsdk/openim-sdk-core/v3 v3.4.0/go.mod h1:8cQJEanYxUxMdPuiPxHPrw1RkiDtIny5eGNyYfNFdWM= -github.com/pelletier/go-toml/v2 v2.0.8 h1:0ctb6s9mE31h0/lhu+J6OPmVeDxJn+kYnJc2jZR9tGQ= +github.com/openimsdk/openim-sdk-core/v3 v3.5.1-alpha.8 h1:kPjlkSHX7PsBz0Af+Jk1PB4sraup7mbmmwyA3f8uEBI= +github.com/openimsdk/openim-sdk-core/v3 v3.5.1-alpha.8/go.mod h1:d2aVHT6pSYthQQd+/4JaruHPTLsQV2D+eQisRQkoP3I= +github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= +github.com/patrickmn/go-cache v2.1.0+incompatible/go.mod h1:3Qf8kWWT7OJRJbdiICTKqZju1ZixQ/KpMGzzAfe6+WQ= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY= -github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20220106031843-2efeb10ca2f6 h1:SLcMxS3gIswMN5mHHeVo+85lHBau10lZmrZ3Ukji510= -github.com/tencentyun/qcloud-cos-sts-sdk v0.0.0-20220106031843-2efeb10ca2f6/go.mod h1:b18KQa4IxHbxeseW1GcZox53d7J0z39VNONTxvvlkXw= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo= -github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= -github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= -github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.11 h1:wy28qYRKZgnJTxGxvye5/wgWr1EKjmUDGYox5mGlRlI= @@ -102,48 +52,14 @@ go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4= go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60= go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg= -golang.org/x/arch v0.3.0 h1:02VY4/ZcO/gBOH6PUaoiptASxtXU10jazRCP865E97k= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.10.0 h1:LKqV2xt9+kDzSTfOhx4FrkEBcMrAgHSYgzywV9zcGmM= -golang.org/x/image v0.9.0 h1:QrzfX26snvCM20hIhBwuHI/ThTg18b/+kcKdXHvnR+g= -golang.org/x/image v0.9.0/go.mod h1:jtrku+n79PfroUbvDdeUWMAI+heR786BofxrbiSF+J0= -golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.11.0 h1:Gi2tvZIJyBtO9SDr1q9h5hEQCp/4L2RQ+ar0qjx2oNU= -golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s= -golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.11.0 h1:LAntKIrcmeSKERyiOh0XMV39LXS8IE9UL2yP7+f5ij4= -golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/image v0.14.0 h1:tNgSxAFe3jC4uYqvZdTr84SZoM1KfwdC9SKIFrLjFn4= +golang.org/x/image v0.14.0/go.mod h1:HUYqC05R2ZcZ3ejNQsIHQDQiwWM4JBqmm6MKANTp4LE= +golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c= +golang.org/x/net v0.19.0/go.mod h1:CfAk/cbD4CthTvqiEl8NpboMuiuOYsAr/7NOjZJtv1U= +golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= +golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 h1:XUODHrpzJEUeWmVo/jfNTLj0YyVveOo28oE6vkFbkO4= google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM= @@ -153,14 +69,11 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gorm.io/driver/sqlite v1.3.6 h1:Fi8xNYCUplOqWiPa3/GuCeowRNBRGTf62DEmhMDHeQQ= gorm.io/driver/sqlite v1.3.6/go.mod h1:Sg1/pvnKtbQ7jLXxfZa+jSHvoX8hoZA8cn4xllOMTgE= gorm.io/gorm v1.23.4/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= gorm.io/gorm v1.23.8 h1:h8sGJ+biDgBA1AD1Ha9gFCx7h8npU7AsLdlkX0n2TpE= gorm.io/gorm v1.23.8/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk= -nhooyr.io/websocket v1.8.7 h1:usjR2uOr/zjjkVMy0lW+PPohFok7PCow5sDjLgX4P4g= -nhooyr.io/websocket v1.8.7/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= +nhooyr.io/websocket v1.8.10 h1:mv4p+MnGrLDcPlBoWsvPP7XCzTYMXP9F9eIGoKbgx7Q= +nhooyr.io/websocket v1.8.10/go.mod h1:rN9OFWIUwuxg4fR5tELlYC04bXYowCP9GX47ivo2l+c= diff --git a/message.go b/message.go index 4d6cecd..a05007b 100644 --- a/message.go +++ b/message.go @@ -15,6 +15,7 @@ const ( Msg_NewConversation Msg_ConversationChanged Msg_TotalUnreadMessageCountChanged + Msg_ConversationUserInputStatusChanged Msg_Advanced_RecvNewMessage Msg_Advanced_RecvC2CReadReceipt @@ -25,6 +26,7 @@ const ( Msg_Advanced_RecvMessageExtensionsAdded Msg_Advanced_RecvOfflineNewMessage Msg_Advanced_MsgDeleted + Msg_Advanced_RecvOnlineOnlyMessage Msg_Batch_RecvNewMessages Msg_Batch_RecvOfflineNewMessages From 74b8ebe9c23ef297c31a2388fcf1c5a6dc346beb Mon Sep 17 00:00:00 2001 From: yejian <596306006@qq.com> Date: Sun, 18 Feb 2024 15:37:25 +0800 Subject: [PATCH 09/13] dev: add cmake env --- .gitignore | 2 + CMakeLists.txt | 13 + examples/CMakeLists.txt | 11 + examples/main.cpp | 10 + build_dll.bat => gen/build_dll.bat | 0 build_so.sh => gen/build_so.sh | 0 export.go => gen/export.go | 0 gen_android_so.bat => gen/gen_android_so.bat | 0 gen_ios_dylib.sh => gen/gen_ios_dylib.sh | 0 go.sum => gen/go.sum | 0 message.go => gen/message.go | 0 gen/openimsdk.h | 303 + protocol.go => gen/protocol.go | 0 go.mod | 36 - include/IMSDK.h | 11 + run_test.sh | 18 - src/IMSDK.cpp | 20 + src/json.hpp | 24765 +++++++++++++++++ 18 files changed, 25135 insertions(+), 54 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 examples/CMakeLists.txt create mode 100644 examples/main.cpp rename build_dll.bat => gen/build_dll.bat (100%) rename build_so.sh => gen/build_so.sh (100%) rename export.go => gen/export.go (100%) rename gen_android_so.bat => gen/gen_android_so.bat (100%) rename gen_ios_dylib.sh => gen/gen_ios_dylib.sh (100%) rename go.sum => gen/go.sum (100%) rename message.go => gen/message.go (100%) create mode 100644 gen/openimsdk.h rename protocol.go => gen/protocol.go (100%) delete mode 100644 go.mod create mode 100644 include/IMSDK.h delete mode 100644 run_test.sh create mode 100644 src/IMSDK.cpp create mode 100644 src/json.hpp diff --git a/.gitignore b/.gitignore index 4c67d8d..6b70f4e 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,5 @@ /vendor /openimsdk.h /openimsdk.dll +/build +/.vscode diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..b048433 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.20) +project(openim-sdk-cpp) +set(CMAKE_CXX_STANDARD 11) +include_directories(${CMAKE_SOURCE_DIR}/gen) +link_directories(${CMAKE_SOURCE_DIR}/gen) +file(GLOB INCLUDES "include/*.h") +file(GLOB SOURCES "src/*.cpp") + +add_library(openimsdk_wrapper STATIC ${SOURCES} ${INCLUDES}) +target_include_directories(openimsdk_wrapper PUBLIC include) +target_link_libraries(openimsdk_wrapper openimsdk) +add_subdirectory(examples) + diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000..4f74c00 --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.20) + +file(GLOB EXAMPLE_INCLUDES "*.h") +file(GLOB EXAMPLE_SOURCES "*.cpp") +add_executable(example ${EXAMPLE_SOURCES} ${EXAMPLE_INCLUDES}) +target_link_libraries(example openimsdk_wrapper) + + +add_custom_command(TARGET example PRE_BUILD + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_SOURCE_DIR}/gen/openimsdk.dll $/) \ No newline at end of file diff --git a/examples/main.cpp b/examples/main.cpp new file mode 100644 index 0000000..cc26b98 --- /dev/null +++ b/examples/main.cpp @@ -0,0 +1,10 @@ +#include +#include "IMSDK.h" +using namespace OpenIM; + +int main() +{ + InitSDK(); + std::cout << "helloworld" << std::endl; + return 0; +} \ No newline at end of file diff --git a/build_dll.bat b/gen/build_dll.bat similarity index 100% rename from build_dll.bat rename to gen/build_dll.bat diff --git a/build_so.sh b/gen/build_so.sh similarity index 100% rename from build_so.sh rename to gen/build_so.sh diff --git a/export.go b/gen/export.go similarity index 100% rename from export.go rename to gen/export.go diff --git a/gen_android_so.bat b/gen/gen_android_so.bat similarity index 100% rename from gen_android_so.bat rename to gen/gen_android_so.bat diff --git a/gen_ios_dylib.sh b/gen/gen_ios_dylib.sh similarity index 100% rename from gen_ios_dylib.sh rename to gen/gen_ios_dylib.sh diff --git a/go.sum b/gen/go.sum similarity index 100% rename from go.sum rename to gen/go.sum diff --git a/message.go b/gen/message.go similarity index 100% rename from message.go rename to gen/message.go diff --git a/gen/openimsdk.h b/gen/openimsdk.h new file mode 100644 index 0000000..325e5d6 --- /dev/null +++ b/gen/openimsdk.h @@ -0,0 +1,303 @@ +/* Code generated by cmd/cgo; DO NOT EDIT. */ + +/* package command-line-arguments */ + + +#line 1 "cgo-builtin-export-prolog" + +#include + +#ifndef GO_CGO_EXPORT_PROLOGUE_H +#define GO_CGO_EXPORT_PROLOGUE_H + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef struct { const char *p; ptrdiff_t n; } _GoString_; +#endif + +#endif + +/* Start of preamble from import "C" comments. */ + + +#line 3 "export.go" + +#include +#include +typedef void (*MessageHandler)(int id ,char* data); +extern MessageHandler messageHandler; +extern void CallMessageHandler(MessageHandler msgHandler,int id,char* data); + +#line 1 "cgo-generated-wrapper" + + +/* End of preamble from import "C" comments. */ + + +/* Start of boilerplate cgo prologue. */ +#line 1 "cgo-gcc-export-header-prolog" + +#ifndef GO_CGO_PROLOGUE_H +#define GO_CGO_PROLOGUE_H + +typedef signed char GoInt8; +typedef unsigned char GoUint8; +typedef short GoInt16; +typedef unsigned short GoUint16; +typedef int GoInt32; +typedef unsigned int GoUint32; +typedef long long GoInt64; +typedef unsigned long long GoUint64; +typedef GoInt64 GoInt; +typedef GoUint64 GoUint; +typedef size_t GoUintptr; +typedef float GoFloat32; +typedef double GoFloat64; +#ifdef _MSC_VER +#include +typedef _Fcomplex GoComplex64; +typedef _Dcomplex GoComplex128; +#else +typedef float _Complex GoComplex64; +typedef double _Complex GoComplex128; +#endif + +/* + static assertion to make sure the file is being used on architecture + at least with matching size of GoInt. +*/ +typedef char _check_for_64_bit_pointer_matching_GoInt[sizeof(void*)==64/8 ? 1:-1]; + +#ifndef GO_CGO_GOSTRING_TYPEDEF +typedef _GoString_ GoString; +#endif +typedef void *GoMap; +typedef void *GoChan; +typedef struct { void *t; void *v; } GoInterface; +typedef struct { void *data; GoInt len; GoInt cap; } GoSlice; + +#endif + +/* End of boilerplate cgo prologue. */ + +#ifdef __cplusplus +extern "C" { +#endif + +extern __declspec(dllexport) void SetMessageHandler(MessageHandler handler); +extern __declspec(dllexport) GoUint8 init_sdk(char* operationID, char* config); +extern __declspec(dllexport) void un_init_sdk(char* operationID); +extern __declspec(dllexport) void login(char* operationID, char* uid, char* token); +extern __declspec(dllexport) void logout(char* operationID); +extern __declspec(dllexport) void set_app_background_status(char* operationID, int isBackground); +extern __declspec(dllexport) void network_status_changed(char* operationID); +extern __declspec(dllexport) GoInt get_login_status(char* operationID); +extern __declspec(dllexport) char* get_login_user(); +extern __declspec(dllexport) char* create_text_message(char* operationID, char* text); +extern __declspec(dllexport) char* create_advanced_text_message(char* operationID, char* text, char* messageEntityList); +extern __declspec(dllexport) char* create_text_at_message(char* operationID, char* text, char* atUserList, char* atUsersInfo, char* message); +extern __declspec(dllexport) char* create_location_message(char* operationID, char* description, double longitude, double latitude); +extern __declspec(dllexport) char* create_custom_message(char* operationID, char* data, char* extension, char* description); +extern __declspec(dllexport) char* create_quote_message(char* operationID, char* text, char* message); +extern __declspec(dllexport) char* create_advanced_quote_message(char* operationID, char* text, char* message, char* messageEntityList); +extern __declspec(dllexport) char* create_card_message(char* operationID, char* cardInfo); +extern __declspec(dllexport) char* create_video_message_from_full_path(char* operationID, char* videoFullPath, char* videoType, long long int duration, char* snapshotFullPath); +extern __declspec(dllexport) char* create_image_message_from_full_path(char* operationID, char* imageFullPath); +extern __declspec(dllexport) char* create_sound_message_from_full_path(char* operationID, char* soundPath, long long int duration); +extern __declspec(dllexport) char* create_file_message_from_full_path(char* operationID, char* fileFullPath, char* fileName); +extern __declspec(dllexport) char* create_image_message(char* operationID, char* imagePath); +extern __declspec(dllexport) char* create_image_message_by_url(char* operationID, char* sourcePath, char* sourcePicture, char* bigPicture, char* snapshotPicture); +extern __declspec(dllexport) char* create_sound_message_by_url(char* operationID, char* soundBaseInfo); +extern __declspec(dllexport) char* create_sound_message(char* operationID, char* soundPath, long long int duration); +extern __declspec(dllexport) char* create_video_message_by_url(char* operationID, char* videoBaseInfo); +extern __declspec(dllexport) char* create_video_message(char* operationID, char* videoPath, char* videoType, long long int duration, char* snapshotPath); +extern __declspec(dllexport) char* create_file_message_by_url(char* operationID, char* fileBaseInfo); +extern __declspec(dllexport) char* create_file_message(char* operationID, char* filePath, char* fileName); +extern __declspec(dllexport) char* create_merger_message(char* operationID, char* messageList, char* title, char* summaryList); +extern __declspec(dllexport) char* create_face_message(char* operationID, int index, char* data); +extern __declspec(dllexport) char* create_forward_message(char* operationID, char* m); +extern __declspec(dllexport) void get_all_conversation_list(char* operationID); +extern __declspec(dllexport) void get_conversation_list_split(char* operationID, int offset, int count); +extern __declspec(dllexport) void get_one_conversation(char* operationID, int sessionType, char* sourceID); +extern __declspec(dllexport) void get_multiple_conversation(char* operationID, char* conversationIDList); +extern __declspec(dllexport) void set_conversation_msg_destruct_time(char* operationID, char* conversationID, long long int msgDestructTime); +extern __declspec(dllexport) void set_conversation_is_msg_destruct(char* operationID, char* conversationID, int isMsgDestruct); +extern __declspec(dllexport) void hide_conversation(char* operationID, char* conversationID); +extern __declspec(dllexport) void get_conversation_recv_message_opt(char* operationID, char* conversationIDList); +extern __declspec(dllexport) void set_conversation_draft(char* operationID, char* conversationID, char* draftText); +extern __declspec(dllexport) void reset_conversation_group_at_type(char* operationID, char* conversationID); +extern __declspec(dllexport) void pin_conversation(char* operationID, char* conversationID, int isPinned); +extern __declspec(dllexport) void set_conversation_private_chat(char* operationID, char* conversationID, int isPrivate); +extern __declspec(dllexport) void set_conversation_burn_duration(char* operationID, char* conversationID, int duration); +extern __declspec(dllexport) void set_conversation_recv_message_opt(char* operationID, char* conversationID, int opt); +extern __declspec(dllexport) void get_total_unread_msg_count(char* operationID); +extern __declspec(dllexport) char* get_at_all_tag(char* operationID); +extern __declspec(dllexport) char* get_conversation_id_by_session_type(char* operationID, char* sourceID, int sessionType); +extern __declspec(dllexport) void send_message(char* operationID, char* message, char* recvID, char* groupID, char* offlinePushInfo); +extern __declspec(dllexport) void send_message_not_oss(char* operationID, char* message, char* recvID, char* groupID, char* offlinePushInfo); +extern __declspec(dllexport) void find_message_list(char* operationID, char* findMessageOptions); +extern __declspec(dllexport) void get_advanced_history_message_list(char* operationID, char* getMessageOptions); +extern __declspec(dllexport) void get_advanced_history_message_list_reverse(char* operationID, char* getMessageOptions); +extern __declspec(dllexport) void revoke_message(char* operationID, char* conversationID, char* clientMsgID); +extern __declspec(dllexport) void typing_status_update(char* operationID, char* recvID, char* msgTip); +extern __declspec(dllexport) void mark_conversation_message_as_read(char* operationID, char* conversationID); +extern __declspec(dllexport) void delete_message_from_local_storage(char* operationID, char* conversationID, char* clientMsgID); +extern __declspec(dllexport) void delete_message(char* operationID, char* conversationID, char* clientMsgID); +extern __declspec(dllexport) void hide_all_conversations(char* operationID); +extern __declspec(dllexport) void delete_all_msg_from_local_and_svr(char* operationID); +extern __declspec(dllexport) void delete_all_msg_from_local(char* operationID); +extern __declspec(dllexport) void clear_conversation_and_delete_all_msg(char* operationID, char* conversationID); +extern __declspec(dllexport) void delete_conversation_and_delete_all_msg(char* operationID, char* conversationID); +extern __declspec(dllexport) void insert_single_message_to_local_storage(char* operationID, char* message, char* recvID, char* sendID); +extern __declspec(dllexport) void insert_group_message_to_local_storage(char* operationID, char* message, char* groupID, char* sendID); +extern __declspec(dllexport) void search_local_messages(char* operationID, char* searchParam); +extern __declspec(dllexport) void set_message_local_ex(char* operationID, char* conversationID, char* clientMsgID, char* localEx); +extern __declspec(dllexport) void get_users_info(char* operationID, char* userIDs); +extern __declspec(dllexport) void get_users_info_with_cache(char* operationID, char* userIDs, char* groupID); +extern __declspec(dllexport) void get_users_info_from_srv(char* operationID, char* userIDs); +extern __declspec(dllexport) void set_self_info(char* operationID, char* userInfo); +extern __declspec(dllexport) void set_global_recv_message_opt(char* operationID, int opt); +extern __declspec(dllexport) void get_self_user_info(char* operationID); +extern __declspec(dllexport) void update_msg_sender_info(char* operationID, char* nickname, char* faceURL); +extern __declspec(dllexport) void subscribe_users_status(char* operationID, char* userIDs); +extern __declspec(dllexport) void unsubscribe_users_status(char* operationID, char* userIDs); +extern __declspec(dllexport) void get_subscribe_users_status(char* operationID); +extern __declspec(dllexport) void get_user_status(char* operationID, char* userIDs); + +// =====================================================friend=============================================== +// +extern __declspec(dllexport) void get_specified_friends_info(char* operationID, char* userIDList); +extern __declspec(dllexport) void get_friend_list(char* operationID); +extern __declspec(dllexport) void get_friend_list_page(char* operationID, int offset, int count); +extern __declspec(dllexport) void search_friends(char* operationID, char* searchParam); +extern __declspec(dllexport) void check_friend(char* operationID, char* userIDList); +extern __declspec(dllexport) void add_friend(char* operationID, char* userIDReqMsg); +extern __declspec(dllexport) void set_friend_remark(char* operationID, char* userIDRemark); +extern __declspec(dllexport) void delete_friend(char* operationID, char* friendUserID); +extern __declspec(dllexport) void get_friend_application_list_as_recipient(char* operationID); +extern __declspec(dllexport) void get_friend_application_list_as_applicant(char* operationID); +extern __declspec(dllexport) void accept_friend_application(char* operationID, char* userIDHandleMsg); +extern __declspec(dllexport) void refuse_friend_application(char* operationID, char* userIDHandleMsg); +extern __declspec(dllexport) void add_black(char* operationID, char* blackUserID, char* ex); +extern __declspec(dllexport) void get_black_list(char* operationID); +extern __declspec(dllexport) void remove_black(char* operationID, char* removeUserID); + +// =====================================================group=============================================== +// CreateGroup creates a group +// +extern __declspec(dllexport) void create_group(char* operationID, char* groupReqInfo); + +// JoinGroup joins a group +// +extern __declspec(dllexport) void join_group(char* operationID, char* groupId, char* reqMsg, int joinSource, char* ex); + +// QuitGroup quits a group +// +extern __declspec(dllexport) void quit_group(char* operationID, char* groupId); + +// DismissGroup dismisses a group +// +extern __declspec(dllexport) void dismiss_group(char* operationID, char* groupId); + +// ChangeGroupMute changes the mute status of a group +// +extern __declspec(dllexport) void change_group_mute(char* operationID, char* groupId, int cIsMute); + +// ChangeGroupMemberMute changes the mute status of a group member +// +extern __declspec(dllexport) void change_group_member_mute(char* operationID, char* groupId, char* userId, int mutedSeconds); + +// SetGroupMemberRoleLevel sets the role level of a group member +// +extern __declspec(dllexport) void set_group_member_role_level(char* operationID, char* groupId, char* userId, int roleLevel); + +// SetGroupMemberInfo sets the information of a group member +// +extern __declspec(dllexport) void set_group_member_info(char* operationID, char* groupMemberInfo); + +// GetJoinedGroupList retrieves the list of joined groups +// +extern __declspec(dllexport) void get_joined_group_list(char* operationID); + +// GetSpecifiedGroupsInfo retrieves the information of specified groups +// +extern __declspec(dllexport) void get_specified_groups_info(char* operationID, char* groupIdList); + +// SearchGroups searches for groups +// +extern __declspec(dllexport) void search_groups(char* operationID, char* searchParam); + +// SetGroupInfo sets the information of a group +// +extern __declspec(dllexport) void set_group_info(char* operationID, char* groupInfo); + +// SetGroupVerification sets the verification mode of a group +// +extern __declspec(dllexport) void set_group_verification(char* operationID, char* groupId, int verification); + +// SetGroupLookMemberInfo sets the member information visibility of a group +// +extern __declspec(dllexport) void set_group_look_member_info(char* operationID, char* groupId, int cRule); + +// SetGroupApplyMemberFriend sets the friend rule for group applicants +// +extern __declspec(dllexport) void set_group_apply_member_friend(char* operationID, char* groupId, int cRule); + +// GetGroupMemberList retrieves the list of group members +// +extern __declspec(dllexport) void get_group_member_list(char* operationID, char* groupId, int cFilter, int cOffset, int cCount); + +// GetGroupMemberOwnerAndAdmin retrieves the owner and admin members of a group +// +extern __declspec(dllexport) void get_group_member_owner_and_admin(char* operationID, char* groupId); + +// GetGroupMemberListByJoinTimeFilter retrieves the list of group members filtered by join time +// +extern __declspec(dllexport) void get_group_member_list_by_join_time_filter(char* operationID, char* groupId, int cOffset, int cCount, long long int cJoinTimeBegin, long long int cJoinTimeEnd, char* cFilterUserIDList); + +// GetSpecifiedGroupMembersInfo retrieves the information of specified group members +// +extern __declspec(dllexport) void get_specified_group_members_info(char* operationID, char* groupId, char* userIdList); + +// KickGroupMember kicks group members +// +extern __declspec(dllexport) void kick_group_member(char* operationID, char* groupId, char* cReason, char* userIdList); + +// TransferGroupOwner transfers the ownership of a group +// +extern __declspec(dllexport) void transfer_group_owner(char* operationID, char* groupId, char* cNewOwnerUserID); + +// InviteUserToGroup invites users to a group +// +extern __declspec(dllexport) void invite_user_to_group(char* operationID, char* groupId, char* cReason, char* userIdList); + +// GetGroupApplicationListAsRecipient retrieves the group application list as a recipient +// +extern __declspec(dllexport) void get_group_application_list_as_recipient(char* operationID); + +// GetGroupApplicationListAsApplicant retrieves the group application list as an applicant +// +extern __declspec(dllexport) void get_group_application_list_as_applicant(char* operationID); + +// AcceptGroupApplication accepts a group application +// +extern __declspec(dllexport) void accept_group_application(char* operationID, char* groupId, char* fromUserId, char* handleMsg); + +// RefuseGroupApplication refuses a group application +// +extern __declspec(dllexport) void refuse_group_application(char* operationID, char* groupId, char* fromUserId, char* handleMsg); + +// SetGroupMemberNickname sets the nickname of a group member +// +extern __declspec(dllexport) void set_group_member_nickname(char* operationID, char* groupId, char* userId, char* groupMemberNickname); + +// SearchGroupMembers searches for group members +// +extern __declspec(dllexport) void search_group_members(char* operationID, char* searchParam); + +// IsJoinGroup checks if the user has joined a group +// +extern __declspec(dllexport) void is_join_group(char* operationID, char* groupId); + +#ifdef __cplusplus +} +#endif diff --git a/protocol.go b/gen/protocol.go similarity index 100% rename from protocol.go rename to gen/protocol.go diff --git a/go.mod b/go.mod deleted file mode 100644 index 6bde0f1..0000000 --- a/go.mod +++ /dev/null @@ -1,36 +0,0 @@ -module github.com/openimsdk/openim-sdk-cpp - -go 1.18 - -require github.com/openimsdk/openim-sdk-core/v3 v3.5.1-alpha.8 - -require ( - github.com/OpenIMSDK/protocol v0.0.40 // indirect - github.com/OpenIMSDK/tools v0.0.24 // indirect - github.com/bwmarrin/snowflake v0.3.0 // indirect - github.com/golang/protobuf v1.5.3 // indirect - github.com/google/go-cmp v0.5.9 // indirect - github.com/gorilla/websocket v1.4.2 // indirect - github.com/jinzhu/copier v0.3.5 // indirect - github.com/jinzhu/inflection v1.0.0 // indirect - github.com/jinzhu/now v1.1.5 // indirect - github.com/lestrrat-go/file-rotatelogs v2.4.0+incompatible // indirect - github.com/lestrrat-go/strftime v1.0.6 // indirect - github.com/mattn/go-sqlite3 v1.14.12 // indirect - github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect - github.com/patrickmn/go-cache v2.1.0+incompatible // indirect - github.com/pkg/errors v0.9.1 // indirect - go.uber.org/atomic v1.7.0 // indirect - go.uber.org/multierr v1.6.0 // indirect; indirecv3.5.1-alpha.8t - go.uber.org/zap v1.24.0 // indirect - golang.org/x/image v0.14.0 // indirect - golang.org/x/net v0.19.0 // indirect - golang.org/x/sys v0.15.0 // indirect - golang.org/x/text v0.14.0 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20230717213848-3f92550aa753 // indirect - google.golang.org/grpc v1.56.2 // indirect - google.golang.org/protobuf v1.31.0 // indirect - gorm.io/driver/sqlite v1.3.6 // indirect - gorm.io/gorm v1.23.8 // indirect - nhooyr.io/websocket v1.8.10 // indirect -) diff --git a/include/IMSDK.h b/include/IMSDK.h new file mode 100644 index 0000000..a8dce6e --- /dev/null +++ b/include/IMSDK.h @@ -0,0 +1,11 @@ +#include "openimsdk.h" + +namespace OpenIM +{ + enum PlatformID + { + + }; + + void InitSDK(); +} \ No newline at end of file diff --git a/run_test.sh b/run_test.sh deleted file mode 100644 index fb5137b..0000000 --- a/run_test.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - - -# if arg 1 is c,or is none,means test c sdk -# if arg 1 is cc,means test cpp sdk - -rm ./test -if [ "$1" == "c" ] || [ "$1" == "" ]; then - echo "test c sdk" - gcc -o test ./test.c ./openimsdk.so - ./test - exit 0 -elif [ "$1" == "cc" ]; then - echo "test cpp sdk" - g++ -o test ./test.cc ./openimsdk.so ./openimsdkcc.so - ./test - exit 0 -fi \ No newline at end of file diff --git a/src/IMSDK.cpp b/src/IMSDK.cpp new file mode 100644 index 0000000..2911ac2 --- /dev/null +++ b/src/IMSDK.cpp @@ -0,0 +1,20 @@ +#include "IMSDK.h" + +#include +#include +#include "json.hpp" +using json = nlohmann::json; +char *GetOperationId(const char *prefix) +{ + static int operationIndex = 0; + operationIndex = operationIndex + 1; + std::stringstream ss; + ss << prefix << "_" << operationIndex; + return (char *)ss.str().c_str(); +} + +void OpenIM::InitSDK() +{ + + init_sdk(GetOperationId("init_sdk"), ""); +} \ No newline at end of file diff --git a/src/json.hpp b/src/json.hpp new file mode 100644 index 0000000..8b72ea6 --- /dev/null +++ b/src/json.hpp @@ -0,0 +1,24765 @@ +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + +/****************************************************************************\ + * Note on documentation: The source files contain links to the online * + * documentation of the public API at https://json.nlohmann.me. This URL * + * contains the most recent documentation and should also be applicable to * + * previous versions; documentation for deprecated functions is not * + * removed, but marked deprecated. See "Generate documentation" section in * + * file docs/README.md. * +\****************************************************************************/ + +#ifndef INCLUDE_NLOHMANN_JSON_HPP_ +#define INCLUDE_NLOHMANN_JSON_HPP_ + +#include // all_of, find, for_each +#include // nullptr_t, ptrdiff_t, size_t +#include // hash, less +#include // initializer_list +#ifndef JSON_NO_IO + #include // istream, ostream +#endif // JSON_NO_IO +#include // random_access_iterator_tag +#include // unique_ptr +#include // string, stoi, to_string +#include // declval, forward, move, pair, swap +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// This file contains all macro definitions affecting or depending on the ABI + +#ifndef JSON_SKIP_LIBRARY_VERSION_CHECK + #if defined(NLOHMANN_JSON_VERSION_MAJOR) && defined(NLOHMANN_JSON_VERSION_MINOR) && defined(NLOHMANN_JSON_VERSION_PATCH) + #if NLOHMANN_JSON_VERSION_MAJOR != 3 || NLOHMANN_JSON_VERSION_MINOR != 11 || NLOHMANN_JSON_VERSION_PATCH != 3 + #warning "Already included a different version of the library!" + #endif + #endif +#endif + +#define NLOHMANN_JSON_VERSION_MAJOR 3 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_MINOR 11 // NOLINT(modernize-macro-to-enum) +#define NLOHMANN_JSON_VERSION_PATCH 3 // NOLINT(modernize-macro-to-enum) + +#ifndef JSON_DIAGNOSTICS + #define JSON_DIAGNOSTICS 0 +#endif + +#ifndef JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON 0 +#endif + +#if JSON_DIAGNOSTICS + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS _diag +#else + #define NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS +#endif + +#if JSON_USE_LEGACY_DISCARDED_VALUE_COMPARISON + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON _ldvcmp +#else + #define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_NO_VERSION + #define NLOHMANN_JSON_NAMESPACE_NO_VERSION 0 +#endif + +// Construct the namespace ABI tags component +#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b +#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \ + NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) + +#define NLOHMANN_JSON_ABI_TAGS \ + NLOHMANN_JSON_ABI_TAGS_CONCAT( \ + NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \ + NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON) + +// Construct the namespace version component +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \ + _v ## major ## _ ## minor ## _ ## patch +#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(major, minor, patch) \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) + +#if NLOHMANN_JSON_NAMESPACE_NO_VERSION +#define NLOHMANN_JSON_NAMESPACE_VERSION +#else +#define NLOHMANN_JSON_NAMESPACE_VERSION \ + NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT(NLOHMANN_JSON_VERSION_MAJOR, \ + NLOHMANN_JSON_VERSION_MINOR, \ + NLOHMANN_JSON_VERSION_PATCH) +#endif + +// Combine namespace components +#define NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) a ## b +#define NLOHMANN_JSON_NAMESPACE_CONCAT(a, b) \ + NLOHMANN_JSON_NAMESPACE_CONCAT_EX(a, b) + +#ifndef NLOHMANN_JSON_NAMESPACE +#define NLOHMANN_JSON_NAMESPACE \ + nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN +#define NLOHMANN_JSON_NAMESPACE_BEGIN \ + namespace nlohmann \ + { \ + inline namespace NLOHMANN_JSON_NAMESPACE_CONCAT( \ + NLOHMANN_JSON_ABI_TAGS, \ + NLOHMANN_JSON_NAMESPACE_VERSION) \ + { +#endif + +#ifndef NLOHMANN_JSON_NAMESPACE_END +#define NLOHMANN_JSON_NAMESPACE_END \ + } /* namespace (inline namespace) NOLINT(readability/namespace) */ \ + } // namespace nlohmann +#endif + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // transform +#include // array +#include // forward_list +#include // inserter, front_inserter, end +#include // map +#include // string +#include // tuple, make_tuple +#include // is_arithmetic, is_same, is_enum, underlying_type, is_convertible +#include // unordered_map +#include // pair, declval +#include // valarray + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // nullptr_t +#include // exception +#if JSON_DIAGNOSTICS + #include // accumulate +#endif +#include // runtime_error +#include // to_string +#include // vector + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // uint8_t +#include // string + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // declval, pair +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template struct make_void +{ + using type = void; +}; +template using void_t = typename make_void::type; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +// https://en.cppreference.com/w/cpp/experimental/is_detected +struct nonesuch +{ + nonesuch() = delete; + ~nonesuch() = delete; + nonesuch(nonesuch const&) = delete; + nonesuch(nonesuch const&&) = delete; + void operator=(nonesuch const&) = delete; + void operator=(nonesuch&&) = delete; +}; + +template class Op, + class... Args> +struct detector +{ + using value_t = std::false_type; + using type = Default; +}; + +template class Op, class... Args> +struct detector>, Op, Args...> +{ + using value_t = std::true_type; + using type = Op; +}; + +template class Op, class... Args> +using is_detected = typename detector::value_t; + +template class Op, class... Args> +struct is_detected_lazy : is_detected { }; + +template class Op, class... Args> +using detected_t = typename detector::type; + +template class Op, class... Args> +using detected_or = detector; + +template class Op, class... Args> +using detected_or_t = typename detected_or::type; + +template class Op, class... Args> +using is_detected_exact = std::is_same>; + +template class Op, class... Args> +using is_detected_convertible = + std::is_convertible, To>; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + + +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-FileCopyrightText: 2016-2021 Evan Nemerson +// SPDX-License-Identifier: MIT + +/* Hedley - https://nemequ.github.io/hedley + * Created by Evan Nemerson + */ + +#if !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < 15) +#if defined(JSON_HEDLEY_VERSION) + #undef JSON_HEDLEY_VERSION +#endif +#define JSON_HEDLEY_VERSION 15 + +#if defined(JSON_HEDLEY_STRINGIFY_EX) + #undef JSON_HEDLEY_STRINGIFY_EX +#endif +#define JSON_HEDLEY_STRINGIFY_EX(x) #x + +#if defined(JSON_HEDLEY_STRINGIFY) + #undef JSON_HEDLEY_STRINGIFY +#endif +#define JSON_HEDLEY_STRINGIFY(x) JSON_HEDLEY_STRINGIFY_EX(x) + +#if defined(JSON_HEDLEY_CONCAT_EX) + #undef JSON_HEDLEY_CONCAT_EX +#endif +#define JSON_HEDLEY_CONCAT_EX(a,b) a##b + +#if defined(JSON_HEDLEY_CONCAT) + #undef JSON_HEDLEY_CONCAT +#endif +#define JSON_HEDLEY_CONCAT(a,b) JSON_HEDLEY_CONCAT_EX(a,b) + +#if defined(JSON_HEDLEY_CONCAT3_EX) + #undef JSON_HEDLEY_CONCAT3_EX +#endif +#define JSON_HEDLEY_CONCAT3_EX(a,b,c) a##b##c + +#if defined(JSON_HEDLEY_CONCAT3) + #undef JSON_HEDLEY_CONCAT3 +#endif +#define JSON_HEDLEY_CONCAT3(a,b,c) JSON_HEDLEY_CONCAT3_EX(a,b,c) + +#if defined(JSON_HEDLEY_VERSION_ENCODE) + #undef JSON_HEDLEY_VERSION_ENCODE +#endif +#define JSON_HEDLEY_VERSION_ENCODE(major,minor,revision) (((major) * 1000000) + ((minor) * 1000) + (revision)) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MAJOR) + #undef JSON_HEDLEY_VERSION_DECODE_MAJOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MAJOR(version) ((version) / 1000000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_MINOR) + #undef JSON_HEDLEY_VERSION_DECODE_MINOR +#endif +#define JSON_HEDLEY_VERSION_DECODE_MINOR(version) (((version) % 1000000) / 1000) + +#if defined(JSON_HEDLEY_VERSION_DECODE_REVISION) + #undef JSON_HEDLEY_VERSION_DECODE_REVISION +#endif +#define JSON_HEDLEY_VERSION_DECODE_REVISION(version) ((version) % 1000) + +#if defined(JSON_HEDLEY_GNUC_VERSION) + #undef JSON_HEDLEY_GNUC_VERSION +#endif +#if defined(__GNUC__) && defined(__GNUC_PATCHLEVEL__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__) +#elif defined(__GNUC__) + #define JSON_HEDLEY_GNUC_VERSION JSON_HEDLEY_VERSION_ENCODE(__GNUC__, __GNUC_MINOR__, 0) +#endif + +#if defined(JSON_HEDLEY_GNUC_VERSION_CHECK) + #undef JSON_HEDLEY_GNUC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GNUC_VERSION) + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GNUC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION) + #undef JSON_HEDLEY_MSVC_VERSION +#endif +#if defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 140000000) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 10000000, (_MSC_FULL_VER % 10000000) / 100000, (_MSC_FULL_VER % 100000) / 100) +#elif defined(_MSC_FULL_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_FULL_VER / 1000000, (_MSC_FULL_VER % 1000000) / 10000, (_MSC_FULL_VER % 10000) / 10) +#elif defined(_MSC_VER) && !defined(__ICL) + #define JSON_HEDLEY_MSVC_VERSION JSON_HEDLEY_VERSION_ENCODE(_MSC_VER / 100, _MSC_VER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_MSVC_VERSION_CHECK) + #undef JSON_HEDLEY_MSVC_VERSION_CHECK +#endif +#if !defined(JSON_HEDLEY_MSVC_VERSION) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (0) +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 10000000) + (minor * 100000) + (patch))) +#elif defined(_MSC_VER) && (_MSC_VER >= 1200) + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_FULL_VER >= ((major * 1000000) + (minor * 10000) + (patch))) +#else + #define JSON_HEDLEY_MSVC_VERSION_CHECK(major,minor,patch) (_MSC_VER >= ((major * 100) + (minor))) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION) + #undef JSON_HEDLEY_INTEL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, __INTEL_COMPILER_UPDATE) +#elif defined(__INTEL_COMPILER) && !defined(__ICL) + #define JSON_HEDLEY_INTEL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER / 100, __INTEL_COMPILER % 100, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_VERSION) + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #undef JSON_HEDLEY_INTEL_CL_VERSION +#endif +#if defined(__INTEL_COMPILER) && defined(__INTEL_COMPILER_UPDATE) && defined(__ICL) + #define JSON_HEDLEY_INTEL_CL_VERSION JSON_HEDLEY_VERSION_ENCODE(__INTEL_COMPILER, __INTEL_COMPILER_UPDATE, 0) +#endif + +#if defined(JSON_HEDLEY_INTEL_CL_VERSION_CHECK) + #undef JSON_HEDLEY_INTEL_CL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_INTEL_CL_VERSION) + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_INTEL_CL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_INTEL_CL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION) + #undef JSON_HEDLEY_PGI_VERSION +#endif +#if defined(__PGI) && defined(__PGIC__) && defined(__PGIC_MINOR__) && defined(__PGIC_PATCHLEVEL__) + #define JSON_HEDLEY_PGI_VERSION JSON_HEDLEY_VERSION_ENCODE(__PGIC__, __PGIC_MINOR__, __PGIC_PATCHLEVEL__) +#endif + +#if defined(JSON_HEDLEY_PGI_VERSION_CHECK) + #undef JSON_HEDLEY_PGI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PGI_VERSION) + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PGI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PGI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #undef JSON_HEDLEY_SUNPRO_VERSION +#endif +#if defined(__SUNPRO_C) && (__SUNPRO_C > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_C >> 16) & 0xf) * 10) + ((__SUNPRO_C >> 12) & 0xf), (((__SUNPRO_C >> 8) & 0xf) * 10) + ((__SUNPRO_C >> 4) & 0xf), (__SUNPRO_C & 0xf) * 10) +#elif defined(__SUNPRO_C) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_C >> 8) & 0xf, (__SUNPRO_C >> 4) & 0xf, (__SUNPRO_C) & 0xf) +#elif defined(__SUNPRO_CC) && (__SUNPRO_CC > 0x1000) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((((__SUNPRO_CC >> 16) & 0xf) * 10) + ((__SUNPRO_CC >> 12) & 0xf), (((__SUNPRO_CC >> 8) & 0xf) * 10) + ((__SUNPRO_CC >> 4) & 0xf), (__SUNPRO_CC & 0xf) * 10) +#elif defined(__SUNPRO_CC) + #define JSON_HEDLEY_SUNPRO_VERSION JSON_HEDLEY_VERSION_ENCODE((__SUNPRO_CC >> 8) & 0xf, (__SUNPRO_CC >> 4) & 0xf, (__SUNPRO_CC) & 0xf) +#endif + +#if defined(JSON_HEDLEY_SUNPRO_VERSION_CHECK) + #undef JSON_HEDLEY_SUNPRO_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_SUNPRO_VERSION) + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_SUNPRO_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_SUNPRO_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION +#endif +#if defined(__EMSCRIPTEN__) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION JSON_HEDLEY_VERSION_ENCODE(__EMSCRIPTEN_major__, __EMSCRIPTEN_minor__, __EMSCRIPTEN_tiny__) +#endif + +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK) + #undef JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_EMSCRIPTEN_VERSION) + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_EMSCRIPTEN_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_EMSCRIPTEN_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION) + #undef JSON_HEDLEY_ARM_VERSION +#endif +#if defined(__CC_ARM) && defined(__ARMCOMPILER_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCOMPILER_VERSION / 1000000, (__ARMCOMPILER_VERSION % 1000000) / 10000, (__ARMCOMPILER_VERSION % 10000) / 100) +#elif defined(__CC_ARM) && defined(__ARMCC_VERSION) + #define JSON_HEDLEY_ARM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ARMCC_VERSION / 1000000, (__ARMCC_VERSION % 1000000) / 10000, (__ARMCC_VERSION % 10000) / 100) +#endif + +#if defined(JSON_HEDLEY_ARM_VERSION_CHECK) + #undef JSON_HEDLEY_ARM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_ARM_VERSION) + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_ARM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_ARM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION) + #undef JSON_HEDLEY_IBM_VERSION +#endif +#if defined(__ibmxl__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__ibmxl_version__, __ibmxl_release__, __ibmxl_modification__) +#elif defined(__xlC__) && defined(__xlC_ver__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, (__xlC_ver__ >> 8) & 0xff) +#elif defined(__xlC__) + #define JSON_HEDLEY_IBM_VERSION JSON_HEDLEY_VERSION_ENCODE(__xlC__ >> 8, __xlC__ & 0xff, 0) +#endif + +#if defined(JSON_HEDLEY_IBM_VERSION_CHECK) + #undef JSON_HEDLEY_IBM_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IBM_VERSION) + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IBM_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IBM_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_VERSION) + #undef JSON_HEDLEY_TI_VERSION +#endif +#if \ + defined(__TI_COMPILER_VERSION__) && \ + ( \ + defined(__TMS470__) || defined(__TI_ARM__) || \ + defined(__MSP430__) || \ + defined(__TMS320C2000__) \ + ) +#if (__TI_COMPILER_VERSION__ >= 16000000) + #define JSON_HEDLEY_TI_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif +#endif + +#if defined(JSON_HEDLEY_TI_VERSION_CHECK) + #undef JSON_HEDLEY_TI_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_VERSION) + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #undef JSON_HEDLEY_TI_CL2000_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C2000__) + #define JSON_HEDLEY_TI_CL2000_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL2000_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL2000_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL2000_VERSION) + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL2000_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL2000_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #undef JSON_HEDLEY_TI_CL430_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__MSP430__) + #define JSON_HEDLEY_TI_CL430_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL430_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL430_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL430_VERSION) + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL430_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL430_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #undef JSON_HEDLEY_TI_ARMCL_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && (defined(__TMS470__) || defined(__TI_ARM__)) + #define JSON_HEDLEY_TI_ARMCL_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION_CHECK) + #undef JSON_HEDLEY_TI_ARMCL_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_ARMCL_VERSION) + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_ARMCL_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #undef JSON_HEDLEY_TI_CL6X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__TMS320C6X__) + #define JSON_HEDLEY_TI_CL6X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL6X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL6X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL6X_VERSION) + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL6X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL6X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #undef JSON_HEDLEY_TI_CL7X_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__C7000__) + #define JSON_HEDLEY_TI_CL7X_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CL7X_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CL7X_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CL7X_VERSION) + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CL7X_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CL7X_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #undef JSON_HEDLEY_TI_CLPRU_VERSION +#endif +#if defined(__TI_COMPILER_VERSION__) && defined(__PRU__) + #define JSON_HEDLEY_TI_CLPRU_VERSION JSON_HEDLEY_VERSION_ENCODE(__TI_COMPILER_VERSION__ / 1000000, (__TI_COMPILER_VERSION__ % 1000000) / 1000, (__TI_COMPILER_VERSION__ % 1000)) +#endif + +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION_CHECK) + #undef JSON_HEDLEY_TI_CLPRU_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TI_CLPRU_VERSION) + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TI_CLPRU_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION) + #undef JSON_HEDLEY_CRAY_VERSION +#endif +#if defined(_CRAYC) + #if defined(_RELEASE_PATCHLEVEL) + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, _RELEASE_PATCHLEVEL) + #else + #define JSON_HEDLEY_CRAY_VERSION JSON_HEDLEY_VERSION_ENCODE(_RELEASE_MAJOR, _RELEASE_MINOR, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_CRAY_VERSION_CHECK) + #undef JSON_HEDLEY_CRAY_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_CRAY_VERSION) + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_CRAY_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_CRAY_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION) + #undef JSON_HEDLEY_IAR_VERSION +#endif +#if defined(__IAR_SYSTEMS_ICC__) + #if __VER__ > 1000 + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE((__VER__ / 1000000), ((__VER__ / 1000) % 1000), (__VER__ % 1000)) + #else + #define JSON_HEDLEY_IAR_VERSION JSON_HEDLEY_VERSION_ENCODE(__VER__ / 100, __VER__ % 100, 0) + #endif +#endif + +#if defined(JSON_HEDLEY_IAR_VERSION_CHECK) + #undef JSON_HEDLEY_IAR_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_IAR_VERSION) + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_IAR_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_IAR_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION) + #undef JSON_HEDLEY_TINYC_VERSION +#endif +#if defined(__TINYC__) + #define JSON_HEDLEY_TINYC_VERSION JSON_HEDLEY_VERSION_ENCODE(__TINYC__ / 1000, (__TINYC__ / 100) % 10, __TINYC__ % 100) +#endif + +#if defined(JSON_HEDLEY_TINYC_VERSION_CHECK) + #undef JSON_HEDLEY_TINYC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_TINYC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_TINYC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION) + #undef JSON_HEDLEY_DMC_VERSION +#endif +#if defined(__DMC__) + #define JSON_HEDLEY_DMC_VERSION JSON_HEDLEY_VERSION_ENCODE(__DMC__ >> 8, (__DMC__ >> 4) & 0xf, __DMC__ & 0xf) +#endif + +#if defined(JSON_HEDLEY_DMC_VERSION_CHECK) + #undef JSON_HEDLEY_DMC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_DMC_VERSION) + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_DMC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_DMC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #undef JSON_HEDLEY_COMPCERT_VERSION +#endif +#if defined(__COMPCERT_VERSION__) + #define JSON_HEDLEY_COMPCERT_VERSION JSON_HEDLEY_VERSION_ENCODE(__COMPCERT_VERSION__ / 10000, (__COMPCERT_VERSION__ / 100) % 100, __COMPCERT_VERSION__ % 100) +#endif + +#if defined(JSON_HEDLEY_COMPCERT_VERSION_CHECK) + #undef JSON_HEDLEY_COMPCERT_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_COMPCERT_VERSION) + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_COMPCERT_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_COMPCERT_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION) + #undef JSON_HEDLEY_PELLES_VERSION +#endif +#if defined(__POCC__) + #define JSON_HEDLEY_PELLES_VERSION JSON_HEDLEY_VERSION_ENCODE(__POCC__ / 100, __POCC__ % 100, 0) +#endif + +#if defined(JSON_HEDLEY_PELLES_VERSION_CHECK) + #undef JSON_HEDLEY_PELLES_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_PELLES_VERSION) + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_PELLES_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_PELLES_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #undef JSON_HEDLEY_MCST_LCC_VERSION +#endif +#if defined(__LCC__) && defined(__LCC_MINOR__) + #define JSON_HEDLEY_MCST_LCC_VERSION JSON_HEDLEY_VERSION_ENCODE(__LCC__ / 100, __LCC__ % 100, __LCC_MINOR__) +#endif + +#if defined(JSON_HEDLEY_MCST_LCC_VERSION_CHECK) + #undef JSON_HEDLEY_MCST_LCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_MCST_LCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_MCST_LCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION) + #undef JSON_HEDLEY_GCC_VERSION +#endif +#if \ + defined(JSON_HEDLEY_GNUC_VERSION) && \ + !defined(__clang__) && \ + !defined(JSON_HEDLEY_INTEL_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_ARM_VERSION) && \ + !defined(JSON_HEDLEY_CRAY_VERSION) && \ + !defined(JSON_HEDLEY_TI_VERSION) && \ + !defined(JSON_HEDLEY_TI_ARMCL_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL430_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL2000_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL6X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CL7X_VERSION) && \ + !defined(JSON_HEDLEY_TI_CLPRU_VERSION) && \ + !defined(__COMPCERT__) && \ + !defined(JSON_HEDLEY_MCST_LCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION JSON_HEDLEY_GNUC_VERSION +#endif + +#if defined(JSON_HEDLEY_GCC_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_VERSION_CHECK +#endif +#if defined(JSON_HEDLEY_GCC_VERSION) + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (JSON_HEDLEY_GCC_VERSION >= JSON_HEDLEY_VERSION_ENCODE(major, minor, patch)) +#else + #define JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_ATTRIBUTE +#endif +#if \ + defined(__has_attribute) && \ + ( \ + (!defined(JSON_HEDLEY_IAR_VERSION) || JSON_HEDLEY_IAR_VERSION_CHECK(8,5,9)) \ + ) +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) __has_attribute(attribute) +#else +# define JSON_HEDLEY_HAS_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_ATTRIBUTE +#endif +#if defined(__has_attribute) + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE +#endif +#if \ + defined(__has_cpp_attribute) && \ + defined(__cplusplus) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS) + #undef JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS +#endif +#if !defined(__cplusplus) || !defined(__has_cpp_attribute) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#elif \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION) && \ + (!defined(JSON_HEDLEY_SUNPRO_VERSION) || JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0)) && \ + (!defined(JSON_HEDLEY_MSVC_VERSION) || JSON_HEDLEY_MSVC_VERSION_CHECK(19,20,0)) + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(ns::attribute) +#else + #define JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(ns,attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE +#endif +#if defined(__has_cpp_attribute) && defined(__cplusplus) + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) __has_cpp_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_CPP_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_BUILTIN) + #undef JSON_HEDLEY_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_HAS_BUILTIN(builtin) __has_builtin(builtin) +#else + #define JSON_HEDLEY_HAS_BUILTIN(builtin) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_BUILTIN) + #undef JSON_HEDLEY_GNUC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GNUC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_BUILTIN) + #undef JSON_HEDLEY_GCC_HAS_BUILTIN +#endif +#if defined(__has_builtin) + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) __has_builtin(builtin) +#else + #define JSON_HEDLEY_GCC_HAS_BUILTIN(builtin,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_FEATURE) + #undef JSON_HEDLEY_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_HAS_FEATURE(feature) __has_feature(feature) +#else + #define JSON_HEDLEY_HAS_FEATURE(feature) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_FEATURE) + #undef JSON_HEDLEY_GNUC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GNUC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_FEATURE) + #undef JSON_HEDLEY_GCC_HAS_FEATURE +#endif +#if defined(__has_feature) + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) __has_feature(feature) +#else + #define JSON_HEDLEY_GCC_HAS_FEATURE(feature,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_EXTENSION) + #undef JSON_HEDLEY_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_HAS_EXTENSION(extension) __has_extension(extension) +#else + #define JSON_HEDLEY_HAS_EXTENSION(extension) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_EXTENSION) + #undef JSON_HEDLEY_GNUC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GNUC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_EXTENSION) + #undef JSON_HEDLEY_GCC_HAS_EXTENSION +#endif +#if defined(__has_extension) + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) __has_extension(extension) +#else + #define JSON_HEDLEY_GCC_HAS_EXTENSION(extension,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GNUC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE +#endif +#if defined(__has_declspec_attribute) + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) __has_declspec_attribute(attribute) +#else + #define JSON_HEDLEY_GCC_HAS_DECLSPEC_ATTRIBUTE(attribute,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_HAS_WARNING) + #undef JSON_HEDLEY_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_HAS_WARNING(warning) __has_warning(warning) +#else + #define JSON_HEDLEY_HAS_WARNING(warning) (0) +#endif + +#if defined(JSON_HEDLEY_GNUC_HAS_WARNING) + #undef JSON_HEDLEY_GNUC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GNUC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GNUC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_GCC_HAS_WARNING) + #undef JSON_HEDLEY_GCC_HAS_WARNING +#endif +#if defined(__has_warning) + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) __has_warning(warning) +#else + #define JSON_HEDLEY_GCC_HAS_WARNING(warning,major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + defined(__clang__) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,17) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(8,0,0) || \ + (JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) && defined(__C99_PRAGMA_OPERATOR)) + #define JSON_HEDLEY_PRAGMA(value) _Pragma(#value) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_PRAGMA(value) __pragma(value) +#else + #define JSON_HEDLEY_PRAGMA(value) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_PUSH) + #undef JSON_HEDLEY_DIAGNOSTIC_PUSH +#endif +#if defined(JSON_HEDLEY_DIAGNOSTIC_POP) + #undef JSON_HEDLEY_DIAGNOSTIC_POP +#endif +#if defined(__clang__) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("GCC diagnostic push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("GCC diagnostic pop") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH __pragma(warning(push)) + #define JSON_HEDLEY_DIAGNOSTIC_POP __pragma(warning(pop)) +#elif JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("pop") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("diag_push") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("diag_pop") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_PUSH _Pragma("warning(push)") + #define JSON_HEDLEY_DIAGNOSTIC_POP _Pragma("warning(pop)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_PUSH + #define JSON_HEDLEY_DIAGNOSTIC_POP +#endif + +/* JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_ +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat") +# if JSON_HEDLEY_HAS_WARNING("-Wc++17-extensions") +# if JSON_HEDLEY_HAS_WARNING("-Wc++1z-extensions") +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + _Pragma("clang diagnostic ignored \"-Wc++1z-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + _Pragma("clang diagnostic ignored \"-Wc++17-extensions\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# else +# define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(xpr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wc++98-compat\"") \ + xpr \ + JSON_HEDLEY_DIAGNOSTIC_POP +# endif +# endif +#endif +#if !defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(x) x +#endif + +#if defined(JSON_HEDLEY_CONST_CAST) + #undef JSON_HEDLEY_CONST_CAST +#endif +#if defined(__cplusplus) +# define JSON_HEDLEY_CONST_CAST(T, expr) (const_cast(expr)) +#elif \ + JSON_HEDLEY_HAS_WARNING("-Wcast-qual") || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_CONST_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_CONST_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_REINTERPRET_CAST) + #undef JSON_HEDLEY_REINTERPRET_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) (reinterpret_cast(expr)) +#else + #define JSON_HEDLEY_REINTERPRET_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_STATIC_CAST) + #undef JSON_HEDLEY_STATIC_CAST +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_STATIC_CAST(T, expr) (static_cast(expr)) +#else + #define JSON_HEDLEY_STATIC_CAST(T, expr) ((T) (expr)) +#endif + +#if defined(JSON_HEDLEY_CPP_CAST) + #undef JSON_HEDLEY_CPP_CAST +#endif +#if defined(__cplusplus) +# if JSON_HEDLEY_HAS_WARNING("-Wold-style-cast") +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wold-style-cast\"") \ + ((T) (expr)) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# elif JSON_HEDLEY_IAR_VERSION_CHECK(8,3,0) +# define JSON_HEDLEY_CPP_CAST(T, expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("diag_suppress=Pe137") \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_CPP_CAST(T, expr) ((T) (expr)) +# endif +#else +# define JSON_HEDLEY_CPP_CAST(T, expr) (expr) +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wdeprecated-declarations") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warning(disable:1478 1786)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:1478 1786)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1216,1444,1445") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED __pragma(warning(disable:4996)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1215,1444") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress 1291,1718") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && !defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,E_DEPRECATED_ATT,E_DEPRECATED_ATT_MESS)") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("error_messages(off,symdeprecated,symdeprecated2)") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("diag_suppress=Pe1444,Pe1215") +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,90,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED _Pragma("warn(disable:2241)") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("clang diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("warning(disable:161)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:161)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 1675") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("GCC diagnostic ignored \"-Wunknown-pragmas\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS __pragma(warning(disable:4068)) +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(16,9,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 163") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress=Pe161") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS _Pragma("diag_suppress 161") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-attributes") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("clang diagnostic ignored \"-Wunknown-attributes\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(4,6,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("warning(disable:1292)") +#elif JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:1292)) +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES __pragma(warning(disable:5030)) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(20,7,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097,1098") +#elif JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("error_messages(off,attrskipunsup)") +#elif \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1173") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress=Pe1097") +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES _Pragma("diag_suppress 1097") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_CPP_ATTRIBUTES +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wcast-qual") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("clang diagnostic ignored \"-Wcast-qual\"") +#elif JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("warning(disable:2203 2331)") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_CAST_QUAL +#endif + +#if defined(JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION) + #undef JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunused-function") + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("clang diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("GCC diagnostic ignored \"-Wunused-function\"") +#elif JSON_HEDLEY_MSVC_VERSION_CHECK(1,0,0) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION __pragma(warning(disable:4505)) +#elif JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION _Pragma("diag_suppress 3142") +#else + #define JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNUSED_FUNCTION +#endif + +#if defined(JSON_HEDLEY_DEPRECATED) + #undef JSON_HEDLEY_DEPRECATED +#endif +#if defined(JSON_HEDLEY_DEPRECATED_FOR) + #undef JSON_HEDLEY_DEPRECATED_FOR +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated("Since " # since)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated("Since " #since "; use " #replacement)) +#elif \ + (JSON_HEDLEY_HAS_EXTENSION(attribute_deprecated_with_message) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,13,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(18,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,3,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,3,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__("Since " #since))) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__("Since " #since "; use " #replacement))) +#elif defined(__cplusplus) && (__cplusplus >= 201402L) + #define JSON_HEDLEY_DEPRECATED(since) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since)]]) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[deprecated("Since " #since "; use " #replacement)]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(deprecated) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_DEPRECATED(since) __attribute__((__deprecated__)) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __attribute__((__deprecated__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_PELLES_VERSION_CHECK(6,50,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_DEPRECATED(since) __declspec(deprecated) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) __declspec(deprecated) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_DEPRECATED(since) _Pragma("deprecated") + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) _Pragma("deprecated") +#else + #define JSON_HEDLEY_DEPRECATED(since) + #define JSON_HEDLEY_DEPRECATED_FOR(since, replacement) +#endif + +#if defined(JSON_HEDLEY_UNAVAILABLE) + #undef JSON_HEDLEY_UNAVAILABLE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warning) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNAVAILABLE(available_since) __attribute__((__warning__("Not available until " #available_since))) +#else + #define JSON_HEDLEY_UNAVAILABLE(available_since) +#endif + +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT +#endif +#if defined(JSON_HEDLEY_WARN_UNUSED_RESULT_MSG) + #undef JSON_HEDLEY_WARN_UNUSED_RESULT_MSG +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(warn_unused_result) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_WARN_UNUSED_RESULT __attribute__((__warn_unused_result__)) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) __attribute__((__warn_unused_result__)) +#elif (JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) >= 201907L) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard(msg)]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(nodiscard) + #define JSON_HEDLEY_WARN_UNUSED_RESULT JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[nodiscard]]) +#elif defined(_Check_return_) /* SAL */ + #define JSON_HEDLEY_WARN_UNUSED_RESULT _Check_return_ + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) _Check_return_ +#else + #define JSON_HEDLEY_WARN_UNUSED_RESULT + #define JSON_HEDLEY_WARN_UNUSED_RESULT_MSG(msg) +#endif + +#if defined(JSON_HEDLEY_SENTINEL) + #undef JSON_HEDLEY_SENTINEL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(sentinel) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_SENTINEL(position) __attribute__((__sentinel__(position))) +#else + #define JSON_HEDLEY_SENTINEL(position) +#endif + +#if defined(JSON_HEDLEY_NO_RETURN) + #undef JSON_HEDLEY_NO_RETURN +#endif +#if JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NO_RETURN __noreturn +#elif \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L + #define JSON_HEDLEY_NO_RETURN _Noreturn +#elif defined(__cplusplus) && (__cplusplus >= 201103L) + #define JSON_HEDLEY_NO_RETURN JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[noreturn]]) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(noreturn) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,2,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NO_RETURN __attribute__((__noreturn__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_NO_RETURN _Pragma("does_not_return") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NO_RETURN _Pragma("FUNC_NEVER_RETURNS;") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NO_RETURN __attribute((noreturn)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NO_RETURN __declspec(noreturn) +#else + #define JSON_HEDLEY_NO_RETURN +#endif + +#if defined(JSON_HEDLEY_NO_ESCAPE) + #undef JSON_HEDLEY_NO_ESCAPE +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(noescape) + #define JSON_HEDLEY_NO_ESCAPE __attribute__((__noescape__)) +#else + #define JSON_HEDLEY_NO_ESCAPE +#endif + +#if defined(JSON_HEDLEY_UNREACHABLE) + #undef JSON_HEDLEY_UNREACHABLE +#endif +#if defined(JSON_HEDLEY_UNREACHABLE_RETURN) + #undef JSON_HEDLEY_UNREACHABLE_RETURN +#endif +#if defined(JSON_HEDLEY_ASSUME) + #undef JSON_HEDLEY_ASSUME +#endif +#if \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_ASSUME(expr) __assume(expr) +#elif JSON_HEDLEY_HAS_BUILTIN(__builtin_assume) + #define JSON_HEDLEY_ASSUME(expr) __builtin_assume(expr) +#elif \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #if defined(__cplusplus) + #define JSON_HEDLEY_ASSUME(expr) std::_nassert(expr) + #else + #define JSON_HEDLEY_ASSUME(expr) _nassert(expr) + #endif +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_unreachable) && (!defined(JSON_HEDLEY_ARM_VERSION))) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,5,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,10,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,5) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(10,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_UNREACHABLE() __builtin_unreachable() +#elif defined(JSON_HEDLEY_ASSUME) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif +#if !defined(JSON_HEDLEY_ASSUME) + #if defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, ((expr) ? 1 : (JSON_HEDLEY_UNREACHABLE(), 1))) + #else + #define JSON_HEDLEY_ASSUME(expr) JSON_HEDLEY_STATIC_CAST(void, expr) + #endif +#endif +#if defined(JSON_HEDLEY_UNREACHABLE) + #if \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (JSON_HEDLEY_STATIC_CAST(void, JSON_HEDLEY_ASSUME(0)), (value)) + #else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) JSON_HEDLEY_UNREACHABLE() + #endif +#else + #define JSON_HEDLEY_UNREACHABLE_RETURN(value) return (value) +#endif +#if !defined(JSON_HEDLEY_UNREACHABLE) + #define JSON_HEDLEY_UNREACHABLE() JSON_HEDLEY_ASSUME(0) +#endif + +JSON_HEDLEY_DIAGNOSTIC_PUSH +#if JSON_HEDLEY_HAS_WARNING("-Wpedantic") + #pragma clang diagnostic ignored "-Wpedantic" +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wc++98-compat-pedantic") && defined(__cplusplus) + #pragma clang diagnostic ignored "-Wc++98-compat-pedantic" +#endif +#if JSON_HEDLEY_GCC_HAS_WARNING("-Wvariadic-macros",4,0,0) + #if defined(__clang__) + #pragma clang diagnostic ignored "-Wvariadic-macros" + #elif defined(JSON_HEDLEY_GCC_VERSION) + #pragma GCC diagnostic ignored "-Wvariadic-macros" + #endif +#endif +#if defined(JSON_HEDLEY_NON_NULL) + #undef JSON_HEDLEY_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NON_NULL(...) __attribute__((__nonnull__(__VA_ARGS__))) +#else + #define JSON_HEDLEY_NON_NULL(...) +#endif +JSON_HEDLEY_DIAGNOSTIC_POP + +#if defined(JSON_HEDLEY_PRINTF_FORMAT) + #undef JSON_HEDLEY_PRINTF_FORMAT +#endif +#if defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && !defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(ms_printf, string_idx, first_to_check))) +#elif defined(__MINGW32__) && JSON_HEDLEY_GCC_HAS_ATTRIBUTE(format,4,4,0) && defined(__USE_MINGW_ANSI_STDIO) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(gnu_printf, string_idx, first_to_check))) +#elif \ + JSON_HEDLEY_HAS_ATTRIBUTE(format) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,6,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __attribute__((__format__(__printf__, string_idx, first_to_check))) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(6,0,0) + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) __declspec(vaformat(printf,string_idx,first_to_check)) +#else + #define JSON_HEDLEY_PRINTF_FORMAT(string_idx,first_to_check) +#endif + +#if defined(JSON_HEDLEY_CONSTEXPR) + #undef JSON_HEDLEY_CONSTEXPR +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_CONSTEXPR JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(constexpr) + #endif +#endif +#if !defined(JSON_HEDLEY_CONSTEXPR) + #define JSON_HEDLEY_CONSTEXPR +#endif + +#if defined(JSON_HEDLEY_PREDICT) + #undef JSON_HEDLEY_PREDICT +#endif +#if defined(JSON_HEDLEY_LIKELY) + #undef JSON_HEDLEY_LIKELY +#endif +#if defined(JSON_HEDLEY_UNLIKELY) + #undef JSON_HEDLEY_UNLIKELY +#endif +#if defined(JSON_HEDLEY_UNPREDICTABLE) + #undef JSON_HEDLEY_UNPREDICTABLE +#endif +#if JSON_HEDLEY_HAS_BUILTIN(__builtin_unpredictable) + #define JSON_HEDLEY_UNPREDICTABLE(expr) __builtin_unpredictable((expr)) +#endif +#if \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect_with_probability) && !defined(JSON_HEDLEY_PGI_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(9,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, value, probability) __builtin_expect_with_probability( (expr), (value), (probability)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) __builtin_expect_with_probability(!!(expr), 1 , (probability)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) __builtin_expect_with_probability(!!(expr), 0 , (probability)) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect (!!(expr), 1 ) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect (!!(expr), 0 ) +#elif \ + (JSON_HEDLEY_HAS_BUILTIN(__builtin_expect) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,15,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,7,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,27) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PREDICT(expr, expected, probability) \ + (((probability) >= 0.9) ? __builtin_expect((expr), (expected)) : (JSON_HEDLEY_STATIC_CAST(void, expected), (expr))) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 1) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 0) : !!(expr))); \ + })) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) \ + (__extension__ ({ \ + double hedley_probability_ = (probability); \ + ((hedley_probability_ >= 0.9) ? __builtin_expect(!!(expr), 0) : ((hedley_probability_ <= 0.1) ? __builtin_expect(!!(expr), 1) : !!(expr))); \ + })) +# define JSON_HEDLEY_LIKELY(expr) __builtin_expect(!!(expr), 1) +# define JSON_HEDLEY_UNLIKELY(expr) __builtin_expect(!!(expr), 0) +#else +# define JSON_HEDLEY_PREDICT(expr, expected, probability) (JSON_HEDLEY_STATIC_CAST(void, expected), (expr)) +# define JSON_HEDLEY_PREDICT_TRUE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_PREDICT_FALSE(expr, probability) (!!(expr)) +# define JSON_HEDLEY_LIKELY(expr) (!!(expr)) +# define JSON_HEDLEY_UNLIKELY(expr) (!!(expr)) +#endif +#if !defined(JSON_HEDLEY_UNPREDICTABLE) + #define JSON_HEDLEY_UNPREDICTABLE(expr) JSON_HEDLEY_PREDICT(expr, 1, 0.5) +#endif + +#if defined(JSON_HEDLEY_MALLOC) + #undef JSON_HEDLEY_MALLOC +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(malloc) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_MALLOC __attribute__((__malloc__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_MALLOC _Pragma("returns_new_memory") +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_MALLOC __declspec(restrict) +#else + #define JSON_HEDLEY_MALLOC +#endif + +#if defined(JSON_HEDLEY_PURE) + #undef JSON_HEDLEY_PURE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(pure) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,96,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PURE __attribute__((__pure__)) +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) +# define JSON_HEDLEY_PURE _Pragma("does_not_write_global_data") +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(2,0,1) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) \ + ) +# define JSON_HEDLEY_PURE _Pragma("FUNC_IS_PURE;") +#else +# define JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_CONST) + #undef JSON_HEDLEY_CONST +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(const) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(2,5,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_CONST __attribute__((__const__)) +#elif \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) + #define JSON_HEDLEY_CONST _Pragma("no_side_effect") +#else + #define JSON_HEDLEY_CONST JSON_HEDLEY_PURE +#endif + +#if defined(JSON_HEDLEY_RESTRICT) + #undef JSON_HEDLEY_RESTRICT +#endif +#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT restrict +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(14,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(17,10,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,4) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,14,0) && defined(__cplusplus)) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) || \ + defined(__clang__) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RESTRICT __restrict +#elif JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,3,0) && !defined(__cplusplus) + #define JSON_HEDLEY_RESTRICT _Restrict +#else + #define JSON_HEDLEY_RESTRICT +#endif + +#if defined(JSON_HEDLEY_INLINE) + #undef JSON_HEDLEY_INLINE +#endif +#if \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)) || \ + (defined(__cplusplus) && (__cplusplus >= 199711L)) + #define JSON_HEDLEY_INLINE inline +#elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(6,2,0) + #define JSON_HEDLEY_INLINE __inline__ +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,1,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(3,1,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,2,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(8,0,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_INLINE __inline +#else + #define JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_ALWAYS_INLINE) + #undef JSON_HEDLEY_ALWAYS_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(always_inline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) +# define JSON_HEDLEY_ALWAYS_INLINE __attribute__((__always_inline__)) JSON_HEDLEY_INLINE +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(12,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_ALWAYS_INLINE __forceinline +#elif defined(__cplusplus) && \ + ( \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) \ + ) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("FUNC_ALWAYS_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_ALWAYS_INLINE _Pragma("inline=forced") +#else +# define JSON_HEDLEY_ALWAYS_INLINE JSON_HEDLEY_INLINE +#endif + +#if defined(JSON_HEDLEY_NEVER_INLINE) + #undef JSON_HEDLEY_NEVER_INLINE +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(noinline) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(10,1,0) || \ + JSON_HEDLEY_TI_VERSION_CHECK(15,12,0) || \ + (JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(4,8,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_ARMCL_VERSION_CHECK(5,2,0) || \ + (JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL2000_VERSION_CHECK(6,4,0) || \ + (JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,0,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(4,3,0) || \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) || \ + JSON_HEDLEY_TI_CL7X_VERSION_CHECK(1,2,0) || \ + JSON_HEDLEY_TI_CLPRU_VERSION_CHECK(2,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) || \ + JSON_HEDLEY_IAR_VERSION_CHECK(8,10,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute__((__noinline__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,10,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#elif JSON_HEDLEY_PGI_VERSION_CHECK(10,2,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("noinline") +#elif JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,0,0) && defined(__cplusplus) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("FUNC_CANNOT_INLINE;") +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) + #define JSON_HEDLEY_NEVER_INLINE _Pragma("inline=never") +#elif JSON_HEDLEY_COMPCERT_VERSION_CHECK(3,2,0) + #define JSON_HEDLEY_NEVER_INLINE __attribute((noinline)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(9,0,0) + #define JSON_HEDLEY_NEVER_INLINE __declspec(noinline) +#else + #define JSON_HEDLEY_NEVER_INLINE +#endif + +#if defined(JSON_HEDLEY_PRIVATE) + #undef JSON_HEDLEY_PRIVATE +#endif +#if defined(JSON_HEDLEY_PUBLIC) + #undef JSON_HEDLEY_PUBLIC +#endif +#if defined(JSON_HEDLEY_IMPORT) + #undef JSON_HEDLEY_IMPORT +#endif +#if defined(_WIN32) || defined(__CYGWIN__) +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC __declspec(dllexport) +# define JSON_HEDLEY_IMPORT __declspec(dllimport) +#else +# if \ + JSON_HEDLEY_HAS_ATTRIBUTE(visibility) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,11,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + ( \ + defined(__TI_EABI__) && \ + ( \ + (JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,2,0) && defined(__TI_GNU_ATTRIBUTE_SUPPORT__)) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(7,5,0) \ + ) \ + ) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) +# define JSON_HEDLEY_PRIVATE __attribute__((__visibility__("hidden"))) +# define JSON_HEDLEY_PUBLIC __attribute__((__visibility__("default"))) +# else +# define JSON_HEDLEY_PRIVATE +# define JSON_HEDLEY_PUBLIC +# endif +# define JSON_HEDLEY_IMPORT extern +#endif + +#if defined(JSON_HEDLEY_NO_THROW) + #undef JSON_HEDLEY_NO_THROW +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(nothrow) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,3,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_NO_THROW __attribute__((__nothrow__)) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) + #define JSON_HEDLEY_NO_THROW __declspec(nothrow) +#else + #define JSON_HEDLEY_NO_THROW +#endif + +#if defined(JSON_HEDLEY_FALL_THROUGH) + #undef JSON_HEDLEY_FALL_THROUGH +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(fallthrough) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(7,0,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_FALL_THROUGH __attribute__((__fallthrough__)) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE_NS(clang,fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[clang::fallthrough]]) +#elif JSON_HEDLEY_HAS_CPP_ATTRIBUTE(fallthrough) + #define JSON_HEDLEY_FALL_THROUGH JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_([[fallthrough]]) +#elif defined(__fallthrough) /* SAL */ + #define JSON_HEDLEY_FALL_THROUGH __fallthrough +#else + #define JSON_HEDLEY_FALL_THROUGH +#endif + +#if defined(JSON_HEDLEY_RETURNS_NON_NULL) + #undef JSON_HEDLEY_RETURNS_NON_NULL +#endif +#if \ + JSON_HEDLEY_HAS_ATTRIBUTE(returns_nonnull) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_RETURNS_NON_NULL __attribute__((__returns_nonnull__)) +#elif defined(_Ret_notnull_) /* SAL */ + #define JSON_HEDLEY_RETURNS_NON_NULL _Ret_notnull_ +#else + #define JSON_HEDLEY_RETURNS_NON_NULL +#endif + +#if defined(JSON_HEDLEY_ARRAY_PARAM) + #undef JSON_HEDLEY_ARRAY_PARAM +#endif +#if \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) && \ + !defined(__STDC_NO_VLA__) && \ + !defined(__cplusplus) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_TINYC_VERSION) + #define JSON_HEDLEY_ARRAY_PARAM(name) (name) +#else + #define JSON_HEDLEY_ARRAY_PARAM(name) +#endif + +#if defined(JSON_HEDLEY_IS_CONSTANT) + #undef JSON_HEDLEY_IS_CONSTANT +#endif +#if defined(JSON_HEDLEY_REQUIRE_CONSTEXPR) + #undef JSON_HEDLEY_REQUIRE_CONSTEXPR +#endif +/* JSON_HEDLEY_IS_CONSTEXPR_ is for + HEDLEY INTERNAL USE ONLY. API subject to change without notice. */ +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #undef JSON_HEDLEY_IS_CONSTEXPR_ +#endif +#if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_constant_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,19) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(4,1,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_TI_CL6X_VERSION_CHECK(6,1,0) || \ + (JSON_HEDLEY_SUNPRO_VERSION_CHECK(5,10,0) && !defined(__cplusplus)) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_MCST_LCC_VERSION_CHECK(1,25,10) + #define JSON_HEDLEY_IS_CONSTANT(expr) __builtin_constant_p(expr) +#endif +#if !defined(__cplusplus) +# if \ + JSON_HEDLEY_HAS_BUILTIN(__builtin_types_compatible_p) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(3,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(13,1,0) || \ + JSON_HEDLEY_CRAY_VERSION_CHECK(8,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,4,0) || \ + JSON_HEDLEY_TINYC_VERSION_CHECK(0,9,24) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0)), int*) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) __builtin_types_compatible_p(__typeof__((1 ? (void*) ((intptr_t) ((expr) * 0)) : (int*) 0)), int*) +#endif +# elif \ + ( \ + defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) && \ + !defined(JSON_HEDLEY_SUNPRO_VERSION) && \ + !defined(JSON_HEDLEY_PGI_VERSION) && \ + !defined(JSON_HEDLEY_IAR_VERSION)) || \ + (JSON_HEDLEY_HAS_EXTENSION(c_generic_selections) && !defined(JSON_HEDLEY_IAR_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,9,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(17,0,0) || \ + JSON_HEDLEY_IBM_VERSION_CHECK(12,1,0) || \ + JSON_HEDLEY_ARM_VERSION_CHECK(5,3,0) +#if defined(__INTPTR_TYPE__) + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((__INTPTR_TYPE__) ((expr) * 0)) : (int*) 0), int*: 1, void*: 0) +#else + #include + #define JSON_HEDLEY_IS_CONSTEXPR_(expr) _Generic((1 ? (void*) ((intptr_t) * 0) : (int*) 0), int*: 1, void*: 0) +#endif +# elif \ + defined(JSON_HEDLEY_GCC_VERSION) || \ + defined(JSON_HEDLEY_INTEL_VERSION) || \ + defined(JSON_HEDLEY_TINYC_VERSION) || \ + defined(JSON_HEDLEY_TI_ARMCL_VERSION) || \ + JSON_HEDLEY_TI_CL430_VERSION_CHECK(18,12,0) || \ + defined(JSON_HEDLEY_TI_CL2000_VERSION) || \ + defined(JSON_HEDLEY_TI_CL6X_VERSION) || \ + defined(JSON_HEDLEY_TI_CL7X_VERSION) || \ + defined(JSON_HEDLEY_TI_CLPRU_VERSION) || \ + defined(__clang__) +# define JSON_HEDLEY_IS_CONSTEXPR_(expr) ( \ + sizeof(void) != \ + sizeof(*( \ + 1 ? \ + ((void*) ((expr) * 0L) ) : \ +((struct { char v[sizeof(void) * 2]; } *) 1) \ + ) \ + ) \ + ) +# endif +#endif +#if defined(JSON_HEDLEY_IS_CONSTEXPR_) + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) JSON_HEDLEY_IS_CONSTEXPR_(expr) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (JSON_HEDLEY_IS_CONSTEXPR_(expr) ? (expr) : (-1)) +#else + #if !defined(JSON_HEDLEY_IS_CONSTANT) + #define JSON_HEDLEY_IS_CONSTANT(expr) (0) + #endif + #define JSON_HEDLEY_REQUIRE_CONSTEXPR(expr) (expr) +#endif + +#if defined(JSON_HEDLEY_BEGIN_C_DECLS) + #undef JSON_HEDLEY_BEGIN_C_DECLS +#endif +#if defined(JSON_HEDLEY_END_C_DECLS) + #undef JSON_HEDLEY_END_C_DECLS +#endif +#if defined(JSON_HEDLEY_C_DECL) + #undef JSON_HEDLEY_C_DECL +#endif +#if defined(__cplusplus) + #define JSON_HEDLEY_BEGIN_C_DECLS extern "C" { + #define JSON_HEDLEY_END_C_DECLS } + #define JSON_HEDLEY_C_DECL extern "C" +#else + #define JSON_HEDLEY_BEGIN_C_DECLS + #define JSON_HEDLEY_END_C_DECLS + #define JSON_HEDLEY_C_DECL +#endif + +#if defined(JSON_HEDLEY_STATIC_ASSERT) + #undef JSON_HEDLEY_STATIC_ASSERT +#endif +#if \ + !defined(__cplusplus) && ( \ + (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)) || \ + (JSON_HEDLEY_HAS_FEATURE(c_static_assert) && !defined(JSON_HEDLEY_INTEL_CL_VERSION)) || \ + JSON_HEDLEY_GCC_VERSION_CHECK(6,0,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) || \ + defined(_Static_assert) \ + ) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) _Static_assert(expr, message) +#elif \ + (defined(__cplusplus) && (__cplusplus >= 201103L)) || \ + JSON_HEDLEY_MSVC_VERSION_CHECK(16,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(static_assert(expr, message)) +#else +# define JSON_HEDLEY_STATIC_ASSERT(expr, message) +#endif + +#if defined(JSON_HEDLEY_NULL) + #undef JSON_HEDLEY_NULL +#endif +#if defined(__cplusplus) + #if __cplusplus >= 201103L + #define JSON_HEDLEY_NULL JSON_HEDLEY_DIAGNOSTIC_DISABLE_CPP98_COMPAT_WRAP_(nullptr) + #elif defined(NULL) + #define JSON_HEDLEY_NULL NULL + #else + #define JSON_HEDLEY_NULL JSON_HEDLEY_STATIC_CAST(void*, 0) + #endif +#elif defined(NULL) + #define JSON_HEDLEY_NULL NULL +#else + #define JSON_HEDLEY_NULL ((void*) 0) +#endif + +#if defined(JSON_HEDLEY_MESSAGE) + #undef JSON_HEDLEY_MESSAGE +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_MESSAGE(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(message msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message msg) +#elif JSON_HEDLEY_CRAY_VERSION_CHECK(5,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(_CRI message msg) +#elif JSON_HEDLEY_IAR_VERSION_CHECK(8,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#elif JSON_HEDLEY_PELLES_VERSION_CHECK(2,0,0) +# define JSON_HEDLEY_MESSAGE(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_WARNING) + #undef JSON_HEDLEY_WARNING +#endif +#if JSON_HEDLEY_HAS_WARNING("-Wunknown-pragmas") +# define JSON_HEDLEY_WARNING(msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + JSON_HEDLEY_DIAGNOSTIC_DISABLE_UNKNOWN_PRAGMAS \ + JSON_HEDLEY_PRAGMA(clang warning msg) \ + JSON_HEDLEY_DIAGNOSTIC_POP +#elif \ + JSON_HEDLEY_GCC_VERSION_CHECK(4,8,0) || \ + JSON_HEDLEY_PGI_VERSION_CHECK(18,4,0) || \ + JSON_HEDLEY_INTEL_VERSION_CHECK(13,0,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(GCC warning msg) +#elif \ + JSON_HEDLEY_MSVC_VERSION_CHECK(15,0,0) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_PRAGMA(message(msg)) +#else +# define JSON_HEDLEY_WARNING(msg) JSON_HEDLEY_MESSAGE(msg) +#endif + +#if defined(JSON_HEDLEY_REQUIRE) + #undef JSON_HEDLEY_REQUIRE +#endif +#if defined(JSON_HEDLEY_REQUIRE_MSG) + #undef JSON_HEDLEY_REQUIRE_MSG +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(diagnose_if) +# if JSON_HEDLEY_HAS_WARNING("-Wgcc-compat") +# define JSON_HEDLEY_REQUIRE(expr) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), #expr, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("clang diagnostic ignored \"-Wgcc-compat\"") \ + __attribute__((diagnose_if(!(expr), msg, "error"))) \ + JSON_HEDLEY_DIAGNOSTIC_POP +# else +# define JSON_HEDLEY_REQUIRE(expr) __attribute__((diagnose_if(!(expr), #expr, "error"))) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) __attribute__((diagnose_if(!(expr), msg, "error"))) +# endif +#else +# define JSON_HEDLEY_REQUIRE(expr) +# define JSON_HEDLEY_REQUIRE_MSG(expr,msg) +#endif + +#if defined(JSON_HEDLEY_FLAGS) + #undef JSON_HEDLEY_FLAGS +#endif +#if JSON_HEDLEY_HAS_ATTRIBUTE(flag_enum) && (!defined(__cplusplus) || JSON_HEDLEY_HAS_WARNING("-Wbitfield-enum-conversion")) + #define JSON_HEDLEY_FLAGS __attribute__((__flag_enum__)) +#else + #define JSON_HEDLEY_FLAGS +#endif + +#if defined(JSON_HEDLEY_FLAGS_CAST) + #undef JSON_HEDLEY_FLAGS_CAST +#endif +#if JSON_HEDLEY_INTEL_VERSION_CHECK(19,0,0) +# define JSON_HEDLEY_FLAGS_CAST(T, expr) (__extension__ ({ \ + JSON_HEDLEY_DIAGNOSTIC_PUSH \ + _Pragma("warning(disable:188)") \ + ((T) (expr)); \ + JSON_HEDLEY_DIAGNOSTIC_POP \ + })) +#else +# define JSON_HEDLEY_FLAGS_CAST(T, expr) JSON_HEDLEY_STATIC_CAST(T, expr) +#endif + +#if defined(JSON_HEDLEY_EMPTY_BASES) + #undef JSON_HEDLEY_EMPTY_BASES +#endif +#if \ + (JSON_HEDLEY_MSVC_VERSION_CHECK(19,0,23918) && !JSON_HEDLEY_MSVC_VERSION_CHECK(20,0,0)) || \ + JSON_HEDLEY_INTEL_CL_VERSION_CHECK(2021,1,0) + #define JSON_HEDLEY_EMPTY_BASES __declspec(empty_bases) +#else + #define JSON_HEDLEY_EMPTY_BASES +#endif + +/* Remaining macros are deprecated. */ + +#if defined(JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK) + #undef JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK +#endif +#if defined(__clang__) + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) (0) +#else + #define JSON_HEDLEY_GCC_NOT_CLANG_VERSION_CHECK(major,minor,patch) JSON_HEDLEY_GCC_VERSION_CHECK(major,minor,patch) +#endif + +#if defined(JSON_HEDLEY_CLANG_HAS_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_CPP_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_CPP_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_BUILTIN) + #undef JSON_HEDLEY_CLANG_HAS_BUILTIN +#endif +#define JSON_HEDLEY_CLANG_HAS_BUILTIN(builtin) JSON_HEDLEY_HAS_BUILTIN(builtin) + +#if defined(JSON_HEDLEY_CLANG_HAS_FEATURE) + #undef JSON_HEDLEY_CLANG_HAS_FEATURE +#endif +#define JSON_HEDLEY_CLANG_HAS_FEATURE(feature) JSON_HEDLEY_HAS_FEATURE(feature) + +#if defined(JSON_HEDLEY_CLANG_HAS_EXTENSION) + #undef JSON_HEDLEY_CLANG_HAS_EXTENSION +#endif +#define JSON_HEDLEY_CLANG_HAS_EXTENSION(extension) JSON_HEDLEY_HAS_EXTENSION(extension) + +#if defined(JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE) + #undef JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE +#endif +#define JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE(attribute) JSON_HEDLEY_HAS_DECLSPEC_ATTRIBUTE(attribute) + +#if defined(JSON_HEDLEY_CLANG_HAS_WARNING) + #undef JSON_HEDLEY_CLANG_HAS_WARNING +#endif +#define JSON_HEDLEY_CLANG_HAS_WARNING(warning) JSON_HEDLEY_HAS_WARNING(warning) + +#endif /* !defined(JSON_HEDLEY_VERSION) || (JSON_HEDLEY_VERSION < X) */ + + +// This file contains all internal macro definitions (except those affecting ABI) +// You MUST include macro_unscope.hpp at the end of json.hpp to undef all of them + +// #include + + +// exclude unsupported compilers +#if !defined(JSON_SKIP_UNSUPPORTED_COMPILER_CHECK) + #if defined(__clang__) + #if (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) < 30400 + #error "unsupported Clang version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #elif defined(__GNUC__) && !(defined(__ICC) || defined(__INTEL_COMPILER)) + #if (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) < 40800 + #error "unsupported GCC version - see https://github.com/nlohmann/json#supported-compilers" + #endif + #endif +#endif + +// C++ language standard detection +// if the user manually specified the used c++ version this is skipped +#if !defined(JSON_HAS_CPP_20) && !defined(JSON_HAS_CPP_17) && !defined(JSON_HAS_CPP_14) && !defined(JSON_HAS_CPP_11) + #if (defined(__cplusplus) && __cplusplus >= 202002L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 202002L) + #define JSON_HAS_CPP_20 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 + #define JSON_HAS_CPP_17 + #define JSON_HAS_CPP_14 + #elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) + #define JSON_HAS_CPP_14 + #endif + // the cpp 11 flag is always specified because it is the minimal required version + #define JSON_HAS_CPP_11 +#endif + +#ifdef __has_include + #if __has_include() + #include + #endif +#endif + +#if !defined(JSON_HAS_FILESYSTEM) && !defined(JSON_HAS_EXPERIMENTAL_FILESYSTEM) + #ifdef JSON_HAS_CPP_17 + #if defined(__cpp_lib_filesystem) + #define JSON_HAS_FILESYSTEM 1 + #elif defined(__cpp_lib_experimental_filesystem) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif !defined(__has_include) + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_FILESYSTEM 1 + #elif __has_include() + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 1 + #endif + + // std::filesystem does not work on MinGW GCC 8: https://sourceforge.net/p/mingw-w64/bugs/737/ + #if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ == 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before GCC 8: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__GNUC__) && !defined(__clang__) && __GNUC__ < 8 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before Clang 7: https://en.cppreference.com/w/cpp/compiler_support + #if defined(__clang_major__) && __clang_major__ < 7 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before MSVC 19.14: https://en.cppreference.com/w/cpp/compiler_support + #if defined(_MSC_VER) && _MSC_VER < 1914 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before iOS 13 + #if defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 130000 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + + // no filesystem support before macOS Catalina + #if defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500 + #undef JSON_HAS_FILESYSTEM + #undef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #endif + #endif +#endif + +#ifndef JSON_HAS_EXPERIMENTAL_FILESYSTEM + #define JSON_HAS_EXPERIMENTAL_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_FILESYSTEM + #define JSON_HAS_FILESYSTEM 0 +#endif + +#ifndef JSON_HAS_THREE_WAY_COMPARISON + #if defined(__cpp_impl_three_way_comparison) && __cpp_impl_three_way_comparison >= 201907L \ + && defined(__cpp_lib_three_way_comparison) && __cpp_lib_three_way_comparison >= 201907L + #define JSON_HAS_THREE_WAY_COMPARISON 1 + #else + #define JSON_HAS_THREE_WAY_COMPARISON 0 + #endif +#endif + +#ifndef JSON_HAS_RANGES + // ranges header shipping in GCC 11.1.0 (released 2021-04-27) has syntax error + #if defined(__GLIBCXX__) && __GLIBCXX__ == 20210427 + #define JSON_HAS_RANGES 0 + #elif defined(__cpp_lib_ranges) + #define JSON_HAS_RANGES 1 + #else + #define JSON_HAS_RANGES 0 + #endif +#endif + +#ifndef JSON_HAS_STATIC_RTTI + #if !defined(_HAS_STATIC_RTTI) || _HAS_STATIC_RTTI != 0 + #define JSON_HAS_STATIC_RTTI 1 + #else + #define JSON_HAS_STATIC_RTTI 0 + #endif +#endif + +#ifdef JSON_HAS_CPP_17 + #define JSON_INLINE_VARIABLE inline +#else + #define JSON_INLINE_VARIABLE +#endif + +#if JSON_HEDLEY_HAS_ATTRIBUTE(no_unique_address) + #define JSON_NO_UNIQUE_ADDRESS [[no_unique_address]] +#else + #define JSON_NO_UNIQUE_ADDRESS +#endif + +// disable documentation warnings on clang +#if defined(__clang__) + #pragma clang diagnostic push + #pragma clang diagnostic ignored "-Wdocumentation" + #pragma clang diagnostic ignored "-Wdocumentation-unknown-command" +#endif + +// allow disabling exceptions +#if (defined(__cpp_exceptions) || defined(__EXCEPTIONS) || defined(_CPPUNWIND)) && !defined(JSON_NOEXCEPTION) + #define JSON_THROW(exception) throw exception + #define JSON_TRY try + #define JSON_CATCH(exception) catch(exception) + #define JSON_INTERNAL_CATCH(exception) catch(exception) +#else + #include + #define JSON_THROW(exception) std::abort() + #define JSON_TRY if(true) + #define JSON_CATCH(exception) if(false) + #define JSON_INTERNAL_CATCH(exception) if(false) +#endif + +// override exception macros +#if defined(JSON_THROW_USER) + #undef JSON_THROW + #define JSON_THROW JSON_THROW_USER +#endif +#if defined(JSON_TRY_USER) + #undef JSON_TRY + #define JSON_TRY JSON_TRY_USER +#endif +#if defined(JSON_CATCH_USER) + #undef JSON_CATCH + #define JSON_CATCH JSON_CATCH_USER + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_CATCH_USER +#endif +#if defined(JSON_INTERNAL_CATCH_USER) + #undef JSON_INTERNAL_CATCH + #define JSON_INTERNAL_CATCH JSON_INTERNAL_CATCH_USER +#endif + +// allow overriding assert +#if !defined(JSON_ASSERT) + #include // assert + #define JSON_ASSERT(x) assert(x) +#endif + +// allow to access some private functions (needed by the test suite) +#if defined(JSON_TESTS_PRIVATE) + #define JSON_PRIVATE_UNLESS_TESTED public +#else + #define JSON_PRIVATE_UNLESS_TESTED private +#endif + +/*! +@brief macro to briefly define a mapping between an enum and JSON +@def NLOHMANN_JSON_SERIALIZE_ENUM +@since version 3.4.0 +*/ +#define NLOHMANN_JSON_SERIALIZE_ENUM(ENUM_TYPE, ...) \ + template \ + inline void to_json(BasicJsonType& j, const ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [e](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.first == e; \ + }); \ + j = ((it != std::end(m)) ? it : std::begin(m))->second; \ + } \ + template \ + inline void from_json(const BasicJsonType& j, ENUM_TYPE& e) \ + { \ + static_assert(std::is_enum::value, #ENUM_TYPE " must be an enum!"); \ + static const std::pair m[] = __VA_ARGS__; \ + auto it = std::find_if(std::begin(m), std::end(m), \ + [&j](const std::pair& ej_pair) -> bool \ + { \ + return ej_pair.second == j; \ + }); \ + e = ((it != std::end(m)) ? it : std::begin(m))->first; \ + } + +// Ugly macros to avoid uglier copy-paste when specializing basic_json. They +// may be removed in the future once the class is split. + +#define NLOHMANN_BASIC_JSON_TPL_DECLARATION \ + template class ObjectType, \ + template class ArrayType, \ + class StringType, class BooleanType, class NumberIntegerType, \ + class NumberUnsignedType, class NumberFloatType, \ + template class AllocatorType, \ + template class JSONSerializer, \ + class BinaryType, \ + class CustomBaseClass> + +#define NLOHMANN_BASIC_JSON_TPL \ + basic_json + +// Macros to simplify conversion from/to types + +#define NLOHMANN_JSON_EXPAND( x ) x +#define NLOHMANN_JSON_GET_MACRO(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61, _62, _63, _64, NAME,...) NAME +#define NLOHMANN_JSON_PASTE(...) NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_GET_MACRO(__VA_ARGS__, \ + NLOHMANN_JSON_PASTE64, \ + NLOHMANN_JSON_PASTE63, \ + NLOHMANN_JSON_PASTE62, \ + NLOHMANN_JSON_PASTE61, \ + NLOHMANN_JSON_PASTE60, \ + NLOHMANN_JSON_PASTE59, \ + NLOHMANN_JSON_PASTE58, \ + NLOHMANN_JSON_PASTE57, \ + NLOHMANN_JSON_PASTE56, \ + NLOHMANN_JSON_PASTE55, \ + NLOHMANN_JSON_PASTE54, \ + NLOHMANN_JSON_PASTE53, \ + NLOHMANN_JSON_PASTE52, \ + NLOHMANN_JSON_PASTE51, \ + NLOHMANN_JSON_PASTE50, \ + NLOHMANN_JSON_PASTE49, \ + NLOHMANN_JSON_PASTE48, \ + NLOHMANN_JSON_PASTE47, \ + NLOHMANN_JSON_PASTE46, \ + NLOHMANN_JSON_PASTE45, \ + NLOHMANN_JSON_PASTE44, \ + NLOHMANN_JSON_PASTE43, \ + NLOHMANN_JSON_PASTE42, \ + NLOHMANN_JSON_PASTE41, \ + NLOHMANN_JSON_PASTE40, \ + NLOHMANN_JSON_PASTE39, \ + NLOHMANN_JSON_PASTE38, \ + NLOHMANN_JSON_PASTE37, \ + NLOHMANN_JSON_PASTE36, \ + NLOHMANN_JSON_PASTE35, \ + NLOHMANN_JSON_PASTE34, \ + NLOHMANN_JSON_PASTE33, \ + NLOHMANN_JSON_PASTE32, \ + NLOHMANN_JSON_PASTE31, \ + NLOHMANN_JSON_PASTE30, \ + NLOHMANN_JSON_PASTE29, \ + NLOHMANN_JSON_PASTE28, \ + NLOHMANN_JSON_PASTE27, \ + NLOHMANN_JSON_PASTE26, \ + NLOHMANN_JSON_PASTE25, \ + NLOHMANN_JSON_PASTE24, \ + NLOHMANN_JSON_PASTE23, \ + NLOHMANN_JSON_PASTE22, \ + NLOHMANN_JSON_PASTE21, \ + NLOHMANN_JSON_PASTE20, \ + NLOHMANN_JSON_PASTE19, \ + NLOHMANN_JSON_PASTE18, \ + NLOHMANN_JSON_PASTE17, \ + NLOHMANN_JSON_PASTE16, \ + NLOHMANN_JSON_PASTE15, \ + NLOHMANN_JSON_PASTE14, \ + NLOHMANN_JSON_PASTE13, \ + NLOHMANN_JSON_PASTE12, \ + NLOHMANN_JSON_PASTE11, \ + NLOHMANN_JSON_PASTE10, \ + NLOHMANN_JSON_PASTE9, \ + NLOHMANN_JSON_PASTE8, \ + NLOHMANN_JSON_PASTE7, \ + NLOHMANN_JSON_PASTE6, \ + NLOHMANN_JSON_PASTE5, \ + NLOHMANN_JSON_PASTE4, \ + NLOHMANN_JSON_PASTE3, \ + NLOHMANN_JSON_PASTE2, \ + NLOHMANN_JSON_PASTE1)(__VA_ARGS__)) +#define NLOHMANN_JSON_PASTE2(func, v1) func(v1) +#define NLOHMANN_JSON_PASTE3(func, v1, v2) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE2(func, v2) +#define NLOHMANN_JSON_PASTE4(func, v1, v2, v3) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE3(func, v2, v3) +#define NLOHMANN_JSON_PASTE5(func, v1, v2, v3, v4) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE4(func, v2, v3, v4) +#define NLOHMANN_JSON_PASTE6(func, v1, v2, v3, v4, v5) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE5(func, v2, v3, v4, v5) +#define NLOHMANN_JSON_PASTE7(func, v1, v2, v3, v4, v5, v6) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE6(func, v2, v3, v4, v5, v6) +#define NLOHMANN_JSON_PASTE8(func, v1, v2, v3, v4, v5, v6, v7) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE7(func, v2, v3, v4, v5, v6, v7) +#define NLOHMANN_JSON_PASTE9(func, v1, v2, v3, v4, v5, v6, v7, v8) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE8(func, v2, v3, v4, v5, v6, v7, v8) +#define NLOHMANN_JSON_PASTE10(func, v1, v2, v3, v4, v5, v6, v7, v8, v9) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE9(func, v2, v3, v4, v5, v6, v7, v8, v9) +#define NLOHMANN_JSON_PASTE11(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE10(func, v2, v3, v4, v5, v6, v7, v8, v9, v10) +#define NLOHMANN_JSON_PASTE12(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE11(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) +#define NLOHMANN_JSON_PASTE13(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE12(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) +#define NLOHMANN_JSON_PASTE14(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE13(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) +#define NLOHMANN_JSON_PASTE15(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE14(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) +#define NLOHMANN_JSON_PASTE16(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE15(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) +#define NLOHMANN_JSON_PASTE17(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE16(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) +#define NLOHMANN_JSON_PASTE18(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE17(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17) +#define NLOHMANN_JSON_PASTE19(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE18(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18) +#define NLOHMANN_JSON_PASTE20(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE19(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19) +#define NLOHMANN_JSON_PASTE21(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE20(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20) +#define NLOHMANN_JSON_PASTE22(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE21(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21) +#define NLOHMANN_JSON_PASTE23(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE22(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22) +#define NLOHMANN_JSON_PASTE24(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE23(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23) +#define NLOHMANN_JSON_PASTE25(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE24(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24) +#define NLOHMANN_JSON_PASTE26(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE25(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25) +#define NLOHMANN_JSON_PASTE27(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE26(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26) +#define NLOHMANN_JSON_PASTE28(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE27(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27) +#define NLOHMANN_JSON_PASTE29(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE28(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28) +#define NLOHMANN_JSON_PASTE30(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE29(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29) +#define NLOHMANN_JSON_PASTE31(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE30(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30) +#define NLOHMANN_JSON_PASTE32(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE31(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31) +#define NLOHMANN_JSON_PASTE33(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE32(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32) +#define NLOHMANN_JSON_PASTE34(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE33(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33) +#define NLOHMANN_JSON_PASTE35(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE34(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34) +#define NLOHMANN_JSON_PASTE36(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE35(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35) +#define NLOHMANN_JSON_PASTE37(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE36(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36) +#define NLOHMANN_JSON_PASTE38(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE37(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37) +#define NLOHMANN_JSON_PASTE39(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE38(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38) +#define NLOHMANN_JSON_PASTE40(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE39(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39) +#define NLOHMANN_JSON_PASTE41(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE40(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40) +#define NLOHMANN_JSON_PASTE42(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE41(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41) +#define NLOHMANN_JSON_PASTE43(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE42(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42) +#define NLOHMANN_JSON_PASTE44(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE43(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43) +#define NLOHMANN_JSON_PASTE45(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE44(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44) +#define NLOHMANN_JSON_PASTE46(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE45(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45) +#define NLOHMANN_JSON_PASTE47(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE46(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46) +#define NLOHMANN_JSON_PASTE48(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE47(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47) +#define NLOHMANN_JSON_PASTE49(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE48(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48) +#define NLOHMANN_JSON_PASTE50(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE49(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49) +#define NLOHMANN_JSON_PASTE51(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE50(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50) +#define NLOHMANN_JSON_PASTE52(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE51(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51) +#define NLOHMANN_JSON_PASTE53(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE52(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52) +#define NLOHMANN_JSON_PASTE54(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE53(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53) +#define NLOHMANN_JSON_PASTE55(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE54(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54) +#define NLOHMANN_JSON_PASTE56(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE55(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55) +#define NLOHMANN_JSON_PASTE57(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE56(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56) +#define NLOHMANN_JSON_PASTE58(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE57(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57) +#define NLOHMANN_JSON_PASTE59(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE58(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58) +#define NLOHMANN_JSON_PASTE60(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE59(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59) +#define NLOHMANN_JSON_PASTE61(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE60(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60) +#define NLOHMANN_JSON_PASTE62(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE61(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61) +#define NLOHMANN_JSON_PASTE63(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE62(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62) +#define NLOHMANN_JSON_PASTE64(func, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) NLOHMANN_JSON_PASTE2(func, v1) NLOHMANN_JSON_PASTE63(func, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20, v21, v22, v23, v24, v25, v26, v27, v28, v29, v30, v31, v32, v33, v34, v35, v36, v37, v38, v39, v40, v41, v42, v43, v44, v45, v46, v47, v48, v49, v50, v51, v52, v53, v54, v55, v56, v57, v58, v59, v60, v61, v62, v63) + +#define NLOHMANN_JSON_TO(v1) nlohmann_json_j[#v1] = nlohmann_json_t.v1; +#define NLOHMANN_JSON_FROM(v1) nlohmann_json_j.at(#v1).get_to(nlohmann_json_t.v1); +#define NLOHMANN_JSON_FROM_WITH_DEFAULT(v1) nlohmann_json_t.v1 = nlohmann_json_j.value(#v1, nlohmann_json_default_obj.v1); + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + friend void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ + friend void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +/*! +@brief macro +@def NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE +@since version 3.9.0 +*/ +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_ONLY_SERIALIZE(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } + +#define NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(Type, ...) \ + inline void to_json(nlohmann::json& nlohmann_json_j, const Type& nlohmann_json_t) { NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_TO, __VA_ARGS__)) } \ + inline void from_json(const nlohmann::json& nlohmann_json_j, Type& nlohmann_json_t) { const Type nlohmann_json_default_obj{}; NLOHMANN_JSON_EXPAND(NLOHMANN_JSON_PASTE(NLOHMANN_JSON_FROM_WITH_DEFAULT, __VA_ARGS__)) } + +// inspired from https://stackoverflow.com/a/26745591 +// allows to call any std function as if (e.g. with begin): +// using std::begin; begin(x); +// +// it allows using the detected idiom to retrieve the return type +// of such an expression +#define NLOHMANN_CAN_CALL_STD_FUNC_IMPL(std_name) \ + namespace detail { \ + using std::std_name; \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + } \ + \ + namespace detail2 { \ + struct std_name##_tag \ + { \ + }; \ + \ + template \ + std_name##_tag std_name(T&&...); \ + \ + template \ + using result_of_##std_name = decltype(std_name(std::declval()...)); \ + \ + template \ + struct would_call_std_##std_name \ + { \ + static constexpr auto const value = ::nlohmann::detail:: \ + is_detected_exact::value; \ + }; \ + } /* namespace detail2 */ \ + \ + template \ + struct would_call_std_##std_name : detail2::would_call_std_##std_name \ + { \ + } + +#ifndef JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_USE_IMPLICIT_CONVERSIONS 1 +#endif + +#if JSON_USE_IMPLICIT_CONVERSIONS + #define JSON_EXPLICIT +#else + #define JSON_EXPLICIT explicit +#endif + +#ifndef JSON_DISABLE_ENUM_SERIALIZATION + #define JSON_DISABLE_ENUM_SERIALIZATION 0 +#endif + +#ifndef JSON_USE_GLOBAL_UDLS + #define JSON_USE_GLOBAL_UDLS 1 +#endif + +#if JSON_HAS_THREE_WAY_COMPARISON + #include // partial_ordering +#endif + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/////////////////////////// +// JSON type enumeration // +/////////////////////////// + +/*! +@brief the JSON type enumeration + +This enumeration collects the different JSON types. It is internally used to +distinguish the stored values, and the functions @ref basic_json::is_null(), +@ref basic_json::is_object(), @ref basic_json::is_array(), +@ref basic_json::is_string(), @ref basic_json::is_boolean(), +@ref basic_json::is_number() (with @ref basic_json::is_number_integer(), +@ref basic_json::is_number_unsigned(), and @ref basic_json::is_number_float()), +@ref basic_json::is_discarded(), @ref basic_json::is_primitive(), and +@ref basic_json::is_structured() rely on it. + +@note There are three enumeration entries (number_integer, number_unsigned, and +number_float), because the library distinguishes these three types for numbers: +@ref basic_json::number_unsigned_t is used for unsigned integers, +@ref basic_json::number_integer_t is used for signed integers, and +@ref basic_json::number_float_t is used for floating-point numbers or to +approximate integers which do not fit in the limits of their respective type. + +@sa see @ref basic_json::basic_json(const value_t value_type) -- create a JSON +value with the default value for a given type + +@since version 1.0.0 +*/ +enum class value_t : std::uint8_t +{ + null, ///< null value + object, ///< object (unordered set of name/value pairs) + array, ///< array (ordered collection of values) + string, ///< string value + boolean, ///< boolean value + number_integer, ///< number value (signed integer) + number_unsigned, ///< number value (unsigned integer) + number_float, ///< number value (floating-point) + binary, ///< binary array (ordered collection of bytes) + discarded ///< discarded by the parser callback function +}; + +/*! +@brief comparison operator for JSON types + +Returns an ordering that is similar to Python: +- order: null < boolean < number < object < array < string < binary +- furthermore, each type is not smaller than itself +- discarded values are not comparable +- binary is represented as a b"" string in python and directly comparable to a + string; however, making a binary array directly comparable with a string would + be surprising behavior in a JSON file. + +@since version 1.0.0 +*/ +#if JSON_HAS_THREE_WAY_COMPARISON + inline std::partial_ordering operator<=>(const value_t lhs, const value_t rhs) noexcept // *NOPAD* +#else + inline bool operator<(const value_t lhs, const value_t rhs) noexcept +#endif +{ + static constexpr std::array order = {{ + 0 /* null */, 3 /* object */, 4 /* array */, 5 /* string */, + 1 /* boolean */, 2 /* integer */, 2 /* unsigned */, 2 /* float */, + 6 /* binary */ + } + }; + + const auto l_index = static_cast(lhs); + const auto r_index = static_cast(rhs); +#if JSON_HAS_THREE_WAY_COMPARISON + if (l_index < order.size() && r_index < order.size()) + { + return order[l_index] <=> order[r_index]; // *NOPAD* + } + return std::partial_ordering::unordered; +#else + return l_index < order.size() && r_index < order.size() && order[l_index] < order[r_index]; +#endif +} + +// GCC selects the built-in operator< over an operator rewritten from +// a user-defined spaceship operator +// Clang, MSVC, and ICC select the rewritten candidate +// (see GCC bug https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105200) +#if JSON_HAS_THREE_WAY_COMPARISON && defined(__GNUC__) +inline bool operator<(const value_t lhs, const value_t rhs) noexcept +{ + return std::is_lt(lhs <=> rhs); // *NOPAD* +} +#endif + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/*! +@brief replace all occurrences of a substring by another string + +@param[in,out] s the string to manipulate; changed so that all + occurrences of @a f are replaced with @a t +@param[in] f the substring to replace with @a t +@param[in] t the string to replace @a f + +@pre The search string @a f must not be empty. **This precondition is +enforced with an assertion.** + +@since version 2.0.0 +*/ +template +inline void replace_substring(StringType& s, const StringType& f, + const StringType& t) +{ + JSON_ASSERT(!f.empty()); + for (auto pos = s.find(f); // find first occurrence of f + pos != StringType::npos; // make sure f was found + s.replace(pos, f.size(), t), // replace with t, and + pos = s.find(f, pos + t.size())) // find next occurrence of f + {} +} + +/*! + * @brief string escaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to escape + * @return escaped string + * + * Note the order of escaping "~" to "~0" and "/" to "~1" is important. + */ +template +inline StringType escape(StringType s) +{ + replace_substring(s, StringType{"~"}, StringType{"~0"}); + replace_substring(s, StringType{"/"}, StringType{"~1"}); + return s; +} + +/*! + * @brief string unescaping as described in RFC 6901 (Sect. 4) + * @param[in] s string to unescape + * @return unescaped string + * + * Note the order of escaping "~1" to "/" and "~0" to "~" is important. + */ +template +static void unescape(StringType& s) +{ + replace_substring(s, StringType{"~1"}, StringType{"/"}); + replace_substring(s, StringType{"~0"}, StringType{"~"}); +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // size_t + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +/// struct to capture the start position of the current token +struct position_t +{ + /// the total number of characters read + std::size_t chars_read_total = 0; + /// the number of characters read in the current line + std::size_t chars_read_current_line = 0; + /// the number of lines read + std::size_t lines_read = 0; + + /// conversion to size_t to preserve SAX interface + constexpr operator size_t() const + { + return chars_read_total; + } +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-FileCopyrightText: 2018 The Abseil Authors +// SPDX-License-Identifier: MIT + + + +#include // array +#include // size_t +#include // conditional, enable_if, false_type, integral_constant, is_constructible, is_integral, is_same, remove_cv, remove_reference, true_type +#include // index_sequence, make_index_sequence, index_sequence_for + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +using uncvref_t = typename std::remove_cv::type>::type; + +#ifdef JSON_HAS_CPP_14 + +// the following utilities are natively available in C++14 +using std::enable_if_t; +using std::index_sequence; +using std::make_index_sequence; +using std::index_sequence_for; + +#else + +// alias templates to reduce boilerplate +template +using enable_if_t = typename std::enable_if::type; + +// The following code is taken from https://github.com/abseil/abseil-cpp/blob/10cb35e459f5ecca5b2ff107635da0bfa41011b4/absl/utility/utility.h +// which is part of Google Abseil (https://github.com/abseil/abseil-cpp), licensed under the Apache License 2.0. + +//// START OF CODE FROM GOOGLE ABSEIL + +// integer_sequence +// +// Class template representing a compile-time integer sequence. An instantiation +// of `integer_sequence` has a sequence of integers encoded in its +// type through its template arguments (which is a common need when +// working with C++11 variadic templates). `absl::integer_sequence` is designed +// to be a drop-in replacement for C++14's `std::integer_sequence`. +// +// Example: +// +// template< class T, T... Ints > +// void user_function(integer_sequence); +// +// int main() +// { +// // user_function's `T` will be deduced to `int` and `Ints...` +// // will be deduced to `0, 1, 2, 3, 4`. +// user_function(make_integer_sequence()); +// } +template +struct integer_sequence +{ + using value_type = T; + static constexpr std::size_t size() noexcept + { + return sizeof...(Ints); + } +}; + +// index_sequence +// +// A helper template for an `integer_sequence` of `size_t`, +// `absl::index_sequence` is designed to be a drop-in replacement for C++14's +// `std::index_sequence`. +template +using index_sequence = integer_sequence; + +namespace utility_internal +{ + +template +struct Extend; + +// Note that SeqSize == sizeof...(Ints). It's passed explicitly for efficiency. +template +struct Extend, SeqSize, 0> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)... >; +}; + +template +struct Extend, SeqSize, 1> +{ + using type = integer_sequence < T, Ints..., (Ints + SeqSize)..., 2 * SeqSize >; +}; + +// Recursion helper for 'make_integer_sequence'. +// 'Gen::type' is an alias for 'integer_sequence'. +template +struct Gen +{ + using type = + typename Extend < typename Gen < T, N / 2 >::type, N / 2, N % 2 >::type; +}; + +template +struct Gen +{ + using type = integer_sequence; +}; + +} // namespace utility_internal + +// Compile-time sequences of integers + +// make_integer_sequence +// +// This template alias is equivalent to +// `integer_sequence`, and is designed to be a drop-in +// replacement for C++14's `std::make_integer_sequence`. +template +using make_integer_sequence = typename utility_internal::Gen::type; + +// make_index_sequence +// +// This template alias is equivalent to `index_sequence<0, 1, ..., N-1>`, +// and is designed to be a drop-in replacement for C++14's +// `std::make_index_sequence`. +template +using make_index_sequence = make_integer_sequence; + +// index_sequence_for +// +// Converts a typename pack into an index sequence of the same length, and +// is designed to be a drop-in replacement for C++14's +// `std::index_sequence_for()` +template +using index_sequence_for = make_index_sequence; + +//// END OF CODE FROM GOOGLE ABSEIL + +#endif + +// dispatch utility (taken from ranges-v3) +template struct priority_tag : priority_tag < N - 1 > {}; +template<> struct priority_tag<0> {}; + +// taken from ranges-v3 +template +struct static_const +{ + static JSON_INLINE_VARIABLE constexpr T value{}; +}; + +#ifndef JSON_HAS_CPP_17 + template + constexpr T static_const::value; +#endif + +template +inline constexpr std::array make_array(Args&& ... args) +{ + return std::array {{static_cast(std::forward(args))...}}; +} + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // numeric_limits +#include // false_type, is_constructible, is_integral, is_same, true_type +#include // declval +#include // tuple +#include // char_traits + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +#include // random_access_iterator_tag + +// #include + +// #include + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN +namespace detail +{ + +template +struct iterator_types {}; + +template +struct iterator_types < + It, + void_t> +{ + using difference_type = typename It::difference_type; + using value_type = typename It::value_type; + using pointer = typename It::pointer; + using reference = typename It::reference; + using iterator_category = typename It::iterator_category; +}; + +// This is required as some compilers implement std::iterator_traits in a way that +// doesn't work with SFINAE. See https://github.com/nlohmann/json/issues/1341. +template +struct iterator_traits +{ +}; + +template +struct iterator_traits < T, enable_if_t < !std::is_pointer::value >> + : iterator_types +{ +}; + +template +struct iterator_traits::value>> +{ + using iterator_category = std::random_access_iterator_tag; + using value_type = T; + using difference_type = ptrdiff_t; + using pointer = T*; + using reference = T&; +}; + +} // namespace detail +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(begin); + +NLOHMANN_JSON_NAMESPACE_END + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + + + +// #include + + +NLOHMANN_JSON_NAMESPACE_BEGIN + +NLOHMANN_CAN_CALL_STD_FUNC_IMPL(end); + +NLOHMANN_JSON_NAMESPACE_END + +// #include + +// #include + +// #include +// __ _____ _____ _____ +// __| | __| | | | JSON for Modern C++ +// | | |__ | | | | | | version 3.11.3 +// |_____|_____|_____|_|___| https://github.com/nlohmann/json +// +// SPDX-FileCopyrightText: 2013-2023 Niels Lohmann +// SPDX-License-Identifier: MIT + +#ifndef INCLUDE_NLOHMANN_JSON_FWD_HPP_ + #define INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + #include // int64_t, uint64_t + #include // map + #include // allocator + #include // string + #include // vector + + // #include + + + /*! + @brief namespace for Niels Lohmann + @see https://github.com/nlohmann + @since version 1.0.0 + */ + NLOHMANN_JSON_NAMESPACE_BEGIN + + /*! + @brief default JSONSerializer template argument + + This serializer ignores the template arguments and uses ADL + ([argument-dependent lookup](https://en.cppreference.com/w/cpp/language/adl)) + for serialization. + */ + template + struct adl_serializer; + + /// a class to store JSON values + /// @sa https://json.nlohmann.me/api/basic_json/ + template class ObjectType = + std::map, + template class ArrayType = std::vector, + class StringType = std::string, class BooleanType = bool, + class NumberIntegerType = std::int64_t, + class NumberUnsignedType = std::uint64_t, + class NumberFloatType = double, + template class AllocatorType = std::allocator, + template class JSONSerializer = + adl_serializer, + class BinaryType = std::vector, // cppcheck-suppress syntaxError + class CustomBaseClass = void> + class basic_json; + + /// @brief JSON Pointer defines a string syntax for identifying a specific value within a JSON document + /// @sa https://json.nlohmann.me/api/json_pointer/ + template + class json_pointer; + + /*! + @brief default specialization + @sa https://json.nlohmann.me/api/json/ + */ + using json = basic_json<>; + + /// @brief a minimal map-like container that preserves insertion order + /// @sa https://json.nlohmann.me/api/ordered_map/ + template + struct ordered_map; + + /// @brief specialization that maintains the insertion order of object keys + /// @sa https://json.nlohmann.me/api/ordered_json/ + using ordered_json = basic_json; + + NLOHMANN_JSON_NAMESPACE_END + +#endif // INCLUDE_NLOHMANN_JSON_FWD_HPP_ + + +NLOHMANN_JSON_NAMESPACE_BEGIN +/*! +@brief detail namespace with internal helper functions + +This namespace collects functions that should not be exposed, +implementations of some @ref basic_json methods, and meta-programming helpers. + +@since version 2.1.0 +*/ +namespace detail +{ + +///////////// +// helpers // +///////////// + +// Note to maintainers: +// +// Every trait in this file expects a non CV-qualified type. +// The only exceptions are in the 'aliases for detected' section +// (i.e. those of the form: decltype(T::member_function(std::declval()))) +// +// In this case, T has to be properly CV-qualified to constraint the function arguments +// (e.g. to_json(BasicJsonType&, const T&)) + +template struct is_basic_json : std::false_type {}; + +NLOHMANN_BASIC_JSON_TPL_DECLARATION +struct is_basic_json : std::true_type {}; + +// used by exceptions create() member functions +// true_type for pointer to possibly cv-qualified basic_json or std::nullptr_t +// false_type otherwise +template +struct is_basic_json_context : + std::integral_constant < bool, + is_basic_json::type>::type>::value + || std::is_same::value > +{}; + +////////////////////// +// json_ref helpers // +////////////////////// + +template +class json_ref; + +template +struct is_json_ref : std::false_type {}; + +template +struct is_json_ref> : std::true_type {}; + +////////////////////////// +// aliases for detected // +////////////////////////// + +template +using mapped_type_t = typename T::mapped_type; + +template +using key_type_t = typename T::key_type; + +template +using value_type_t = typename T::value_type; + +template +using difference_type_t = typename T::difference_type; + +template +using pointer_t = typename T::pointer; + +template +using reference_t = typename T::reference; + +template +using iterator_category_t = typename T::iterator_category; + +template +using to_json_function = decltype(T::to_json(std::declval()...)); + +template +using from_json_function = decltype(T::from_json(std::declval()...)); + +template +using get_template_function = decltype(std::declval().template get()); + +// trait checking if JSONSerializer::from_json(json const&, udt&) exists +template +struct has_from_json : std::false_type {}; + +// trait checking if j.get is valid +// use this trait instead of std::is_constructible or std::is_convertible, +// both rely on, or make use of implicit conversions, and thus fail when T +// has several constructors/operator= (see https://github.com/nlohmann/json/issues/958) +template +struct is_getable +{ + static constexpr bool value = is_detected::value; +}; + +template +struct has_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if JSONSerializer::from_json(json const&) exists +// this overload is used for non-default-constructible user-defined-types +template +struct has_non_default_from_json : std::false_type {}; + +template +struct has_non_default_from_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +// This trait checks if BasicJsonType::json_serializer::to_json exists +// Do not evaluate the trait when T is a basic_json type, to avoid template instantiation infinite recursion. +template +struct has_to_json : std::false_type {}; + +template +struct has_to_json < BasicJsonType, T, enable_if_t < !is_basic_json::value >> +{ + using serializer = typename BasicJsonType::template json_serializer; + + static constexpr bool value = + is_detected_exact::value; +}; + +template +using detect_key_compare = typename T::key_compare; + +template +struct has_key_compare : std::integral_constant::value> {}; + +// obtains the actual object key comparator +template +struct actual_object_comparator +{ + using object_t = typename BasicJsonType::object_t; + using object_comparator_t = typename BasicJsonType::default_object_comparator_t; + using type = typename std::conditional < has_key_compare::value, + typename object_t::key_compare, object_comparator_t>::type; +}; + +template +using actual_object_comparator_t = typename actual_object_comparator::type; + +///////////////// +// char_traits // +///////////////// + +// Primary template of char_traits calls std char_traits +template +struct char_traits : std::char_traits +{}; + +// Explicitly define char traits for unsigned char since it is not standard +template<> +struct char_traits : std::char_traits +{ + using char_type = unsigned char; + using int_type = uint64_t; + + // Redefine to_int_type function + static int_type to_int_type(char_type c) noexcept + { + return static_cast(c); + } + + static char_type to_char_type(int_type i) noexcept + { + return static_cast(i); + } + + static constexpr int_type eof() noexcept + { + return static_cast(EOF); + } +}; + +// Explicitly define char traits for signed char since it is not standard +template<> +struct char_traits : std::char_traits +{ + using char_type = signed char; + using int_type = uint64_t; + + // Redefine to_int_type function + static int_type to_int_type(char_type c) noexcept + { + return static_cast(c); + } + + static char_type to_char_type(int_type i) noexcept + { + return static_cast(i); + } + + static constexpr int_type eof() noexcept + { + return static_cast(EOF); + } +}; + +/////////////////// +// is_ functions // +/////////////////// + +// https://en.cppreference.com/w/cpp/types/conjunction +template struct conjunction : std::true_type { }; +template struct conjunction : B { }; +template +struct conjunction +: std::conditional(B::value), conjunction, B>::type {}; + +// https://en.cppreference.com/w/cpp/types/negation +template struct negation : std::integral_constant < bool, !B::value > { }; + +// Reimplementation of is_constructible and is_default_constructible, due to them being broken for +// std::pair and std::tuple until LWG 2367 fix (see https://cplusplus.github.io/LWG/lwg-defects.html#2367). +// This causes compile errors in e.g. clang 3.5 or gcc 4.9. +template +struct is_default_constructible : std::is_default_constructible {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction, is_default_constructible> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_default_constructible> + : conjunction...> {}; + +template +struct is_constructible : std::is_constructible {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_constructible> : is_default_constructible> {}; + +template +struct is_iterator_traits : std::false_type {}; + +template +struct is_iterator_traits> +{ + private: + using traits = iterator_traits; + + public: + static constexpr auto value = + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value && + is_detected::value; +}; + +template +struct is_range +{ + private: + using t_ref = typename std::add_lvalue_reference::type; + + using iterator = detected_t; + using sentinel = detected_t; + + // to be 100% correct, it should use https://en.cppreference.com/w/cpp/iterator/input_or_output_iterator + // and https://en.cppreference.com/w/cpp/iterator/sentinel_for + // but reimplementing these would be too much work, as a lot of other concepts are used underneath + static constexpr auto is_iterator_begin = + is_iterator_traits>::value; + + public: + static constexpr bool value = !std::is_same::value && !std::is_same::value && is_iterator_begin; +}; + +template +using iterator_t = enable_if_t::value, result_of_begin())>>; + +template +using range_value_t = value_type_t>>; + +// The following implementation of is_complete_type is taken from +// https://blogs.msdn.microsoft.com/vcblog/2015/12/02/partial-support-for-expression-sfinae-in-vs-2015-update-1/ +// and is written by Xiang Fan who agreed to using it in this library. + +template +struct is_complete_type : std::false_type {}; + +template +struct is_complete_type : std::true_type {}; + +template +struct is_compatible_object_type_impl : std::false_type {}; + +template +struct is_compatible_object_type_impl < + BasicJsonType, CompatibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + // macOS's is_constructible does not play well with nonesuch... + static constexpr bool value = + is_constructible::value && + is_constructible::value; +}; + +template +struct is_compatible_object_type + : is_compatible_object_type_impl {}; + +template +struct is_constructible_object_type_impl : std::false_type {}; + +template +struct is_constructible_object_type_impl < + BasicJsonType, ConstructibleObjectType, + enable_if_t < is_detected::value&& + is_detected::value >> +{ + using object_t = typename BasicJsonType::object_t; + + static constexpr bool value = + (is_default_constructible::value && + (std::is_move_assignable::value || + std::is_copy_assignable::value) && + (is_constructible::value && + std::is_same < + typename object_t::mapped_type, + typename ConstructibleObjectType::mapped_type >::value)) || + (has_from_json::value || + has_non_default_from_json < + BasicJsonType, + typename ConstructibleObjectType::mapped_type >::value); +}; + +template +struct is_constructible_object_type + : is_constructible_object_type_impl {}; + +template +struct is_compatible_string_type +{ + static constexpr auto value = + is_constructible::value; +}; + +template +struct is_constructible_string_type +{ + // launder type through decltype() to fix compilation failure on ICPC +#ifdef __INTEL_COMPILER + using laundered_type = decltype(std::declval()); +#else + using laundered_type = ConstructibleStringType; +#endif + + static constexpr auto value = + conjunction < + is_constructible, + is_detected_exact>::value; +}; + +template +struct is_compatible_array_type_impl : std::false_type {}; + +template +struct is_compatible_array_type_impl < + BasicJsonType, CompatibleArrayType, + enable_if_t < + is_detected::value&& + is_iterator_traits>>::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 + !std::is_same>::value >> +{ + static constexpr bool value = + is_constructible>::value; +}; + +template +struct is_compatible_array_type + : is_compatible_array_type_impl {}; + +template +struct is_constructible_array_type_impl : std::false_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t::value >> + : std::true_type {}; + +template +struct is_constructible_array_type_impl < + BasicJsonType, ConstructibleArrayType, + enable_if_t < !std::is_same::value&& + !is_compatible_string_type::value&& + is_default_constructible::value&& +(std::is_move_assignable::value || + std::is_copy_assignable::value)&& +is_detected::value&& +is_iterator_traits>>::value&& +is_detected::value&& +// special case for types like std::filesystem::path whose iterator's value_type are themselves +// c.f. https://github.com/nlohmann/json/pull/3073 +!std::is_same>::value&& + is_complete_type < + detected_t>::value >> +{ + using value_type = range_value_t; + + static constexpr bool value = + std::is_same::value || + has_from_json::value || + has_non_default_from_json < + BasicJsonType, + value_type >::value; +}; + +template +struct is_constructible_array_type + : is_constructible_array_type_impl {}; + +template +struct is_compatible_integer_type_impl : std::false_type {}; + +template +struct is_compatible_integer_type_impl < + RealIntegerType, CompatibleNumberIntegerType, + enable_if_t < std::is_integral::value&& + std::is_integral::value&& + !std::is_same::value >> +{ + // is there an assert somewhere on overflows? + using RealLimits = std::numeric_limits; + using CompatibleLimits = std::numeric_limits; + + static constexpr auto value = + is_constructible::value && + CompatibleLimits::is_integer && + RealLimits::is_signed == CompatibleLimits::is_signed; +}; + +template +struct is_compatible_integer_type + : is_compatible_integer_type_impl {}; + +template +struct is_compatible_type_impl: std::false_type {}; + +template +struct is_compatible_type_impl < + BasicJsonType, CompatibleType, + enable_if_t::value >> +{ + static constexpr bool value = + has_to_json::value; +}; + +template +struct is_compatible_type + : is_compatible_type_impl {}; + +template +struct is_constructible_tuple : std::false_type {}; + +template +struct is_constructible_tuple> : conjunction...> {}; + +template +struct is_json_iterator_of : std::false_type {}; + +template +struct is_json_iterator_of : std::true_type {}; + +template +struct is_json_iterator_of : std::true_type +{}; + +// checks if a given type T is a template specialization of Primary +template