From 6a99d9bf65aa5878cb409945ed2bdbdcb916d047 Mon Sep 17 00:00:00 2001 From: chenqiyang <1406175257@qq.com> Date: 星期五, 02 九月 2022 14:56:40 +0800 Subject: [PATCH] 更新linphone sdk --- Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/linphone.framework/Headers/utils/utils.h | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/linphone.framework/Headers/utils/utils.h b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/linphone.framework/Headers/utils/utils.h old mode 100644 new mode 100755 index 0bf5883..46f195f --- a/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/linphone.framework/Headers/utils/utils.h +++ b/Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/linphone.framework/Headers/utils/utils.h @@ -26,6 +26,7 @@ #include <string> #include <utility> #include <vector> +#include <map> #include "linphone/utils/enum-generator.h" @@ -83,8 +84,11 @@ LINPHONE_PUBLIC std::string toString (long double val); LINPHONE_PUBLIC std::string toString (const void *val); - template<typename T, typename = typename std::enable_if<IsDefinedEnum<T>::value, T>::type> - LINPHONE_PUBLIC inline std::string toString (const T &val) { return getEnumValueAsString(val); } + template<typename T> + LINPHONE_PUBLIC inline std::string toString (const T &val) { + std::ostringstream ss; + ss << val; + return ss.str(); } LINPHONE_PUBLIC int stoi (const std::string &str, size_t *idx = 0, int base = 10); LINPHONE_PUBLIC long long stoll (const std::string &str, size_t *idx = 0, int base = 10); @@ -102,6 +106,7 @@ LINPHONE_PUBLIC std::string stringToLower (const std::string &str); LINPHONE_PUBLIC char *utf8ToChar (uint32_t ic); + LINPHONE_PUBLIC std::string utf8ToString (const std::vector<uint32_t>& chars); LINPHONE_PUBLIC inline std::string cStringToCppString (const char *str) { return str ? str : ""; @@ -150,8 +155,48 @@ LINPHONE_PUBLIC std::string localeToUtf8 (const std::string &str); LINPHONE_PUBLIC std::string utf8ToLocale (const std::string &str); LINPHONE_PUBLIC std::string convertAnyToUtf8 (const std::string &str, const std::string &encoding); + LINPHONE_PUBLIC std::string quoteStringIfNotAlready(const std::string &str); + + + class Version{ + public: + LINPHONE_PUBLIC Version() = default; + LINPHONE_PUBLIC Version(int major, int minor); + LINPHONE_PUBLIC Version(int major, int minor, int patch); + LINPHONE_PUBLIC Version(const std::string &version); + + LINPHONE_PUBLIC int compare(const Version &other) const; + LINPHONE_PUBLIC inline bool operator<(const Version &other)const{ + return compare(other) < 0; + } + LINPHONE_PUBLIC inline bool operator<=(const Version &other)const{ + return compare(other) <= 0; + } + LINPHONE_PUBLIC inline bool operator>(const Version &other)const{ + return compare(other) > 0; + } + LINPHONE_PUBLIC inline bool operator>=(const Version &other)const{ + return compare(other) >= 0; + } + LINPHONE_PUBLIC inline bool operator==(const Version &other)const{ + return compare(other) == 0; + } + LINPHONE_PUBLIC inline int getMajor()const {return mMajor;}; + LINPHONE_PUBLIC inline int getMinor()const {return mMinor;}; + LINPHONE_PUBLIC inline int getPatch()const {return mPatch;}; + private: + int mMajor = 0, mMinor = 0, mPatch = 0; + }; + + /** + * Parse a capability descriptor string such our org.linphone.specs, made of comma separated keyword with optional version numbers: + * "lime,groupchat/1.1,ephemeral". If absent, the version number is arbitrary supposed to be 1.0. + */ + LINPHONE_PUBLIC std::map<std::string, Version> parseCapabilityDescriptor(const std::string &descriptor); } +LINPHONE_PUBLIC std::ostream &operator<<(std::ostream & ostr, const Utils::Version &version); + LINPHONE_END_NAMESPACE #endif // ifndef _L_UTILS_H_ -- Gitblit v1.8.0