chenqiyang
2022-09-02 6a99d9bf65aa5878cb409945ed2bdbdcb916d047
Shared.IOS.HDLLinphoneSDK/Shared.IOS.HDLLinphoneSDK/Library/linphone.framework/Headers/utils/utils.h
old mode 100644 new mode 100755
@@ -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_