mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Merge branch 'gyp_xcode' into dev
This commit is contained in:
@@ -168,6 +168,8 @@ template <typename T, size_t N> char(&ArraySizeHelper(T(&array)[N]))[N];
|
||||
|
||||
// For QFlags<> declared in private section of a class we need to declare
|
||||
// operators from Q_DECLARE_OPERATORS_FOR_FLAGS as friend functions.
|
||||
#ifndef OS_MAC_OLD
|
||||
|
||||
#define Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags) \
|
||||
friend Q_DECL_CONSTEXPR QIncompatibleFlag operator|(Flags::enum_type f1, int f2) Q_DECL_NOTHROW;
|
||||
|
||||
@@ -176,6 +178,18 @@ friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1,
|
||||
friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2) Q_DECL_NOTHROW; \
|
||||
Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags)
|
||||
|
||||
#else // OS_MAC_OLD
|
||||
|
||||
#define Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags) \
|
||||
friend Q_DECL_CONSTEXPR QIncompatibleFlag operator|(Flags::enum_type f1, int f2);
|
||||
|
||||
#define Q_DECLARE_FRIEND_OPERATORS_FOR_FLAGS(Flags) \
|
||||
friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1, Flags::enum_type f2); \
|
||||
friend Q_DECL_CONSTEXPR QFlags<Flags::enum_type> operator|(Flags::enum_type f1, QFlags<Flags::enum_type> f2); \
|
||||
Q_DECLARE_FRIEND_INCOMPATIBLE_FLAGS(Flags)
|
||||
|
||||
#endif // OS_MAC_OLD
|
||||
|
||||
// using for_const instead of plain range-based for loop to ensure usage of const_iterator
|
||||
// it is important for the copy-on-write Qt containers
|
||||
// if you have "QVector<T*> v" then "for (T * const p : v)" will still call QVector::detach(),
|
||||
@@ -212,7 +226,11 @@ public:
|
||||
}
|
||||
constexpr char operator[](std::size_t n) const {
|
||||
return (n < _size) ? _str[n] :
|
||||
#ifndef OS_MAC_OLD
|
||||
throw std::out_of_range("");
|
||||
#else // OS_MAC_OLD
|
||||
throw std::exception();
|
||||
#endif // OS_MAC_OLD
|
||||
}
|
||||
constexpr std::size_t size() const { return _size; }
|
||||
const char *c_str() const { return _str; }
|
||||
@@ -250,6 +268,11 @@ typedef double float64;
|
||||
|
||||
using std::string;
|
||||
using std::exception;
|
||||
#ifdef OS_MAC_OLD
|
||||
namespace std {
|
||||
using nullptr_t = decltype(nullptr);
|
||||
}
|
||||
#endif // OS_MAC_OLD
|
||||
|
||||
// we copy some parts of C++11/14/17 std:: library, because on OS X 10.6+
|
||||
// version we can use C++11/14/17, but we can not use its library :(
|
||||
@@ -915,7 +938,7 @@ public:
|
||||
template <typename... Args>
|
||||
void makeIfNull(Args&&... args) {
|
||||
if (isNull()) {
|
||||
reset(new T(std::forward<Args>(args)...));
|
||||
reset(new T(std_::forward<Args>(args)...));
|
||||
}
|
||||
};
|
||||
|
||||
|
@@ -52,8 +52,10 @@ enum class RegExOption {
|
||||
InvertedGreediness = QRegularExpression::InvertedGreedinessOption,
|
||||
DontCapture = QRegularExpression::DontCaptureOption,
|
||||
UseUnicodeProperties = QRegularExpression::UseUnicodePropertiesOption,
|
||||
#ifndef OS_MAC_OLD
|
||||
OptimizeOnFirstUsage = QRegularExpression::OptimizeOnFirstUsageOption,
|
||||
DontAutomaticallyOptimize = QRegularExpression::DontAutomaticallyOptimizeOption,
|
||||
#endif // OS_MAC_OLD
|
||||
};
|
||||
Q_DECLARE_FLAGS(RegExOptions, RegExOption);
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(RegExOptions);
|
||||
@@ -65,7 +67,11 @@ inline RegularExpressionMatch regex_match(const QString &string, const QString &
|
||||
|
||||
inline RegularExpressionMatch regex_match(const QString &string, const QStringRef &subjectRef, RegExOptions options = 0) {
|
||||
auto qtOptions = QRegularExpression::PatternOptions(static_cast<int>(options));
|
||||
#ifndef OS_MAC_OLD
|
||||
return RegularExpressionMatch(QRegularExpression(string, qtOptions).match(subjectRef));
|
||||
#else // OS_MAC_OLD
|
||||
return RegularExpressionMatch(QRegularExpression(string, qtOptions).match(subjectRef.toString()));
|
||||
#endif // OS_MAC_OLD
|
||||
}
|
||||
|
||||
} // namespace qthelp
|
||||
|
@@ -143,7 +143,11 @@ public:
|
||||
}
|
||||
inline const T &at(int index) const {
|
||||
if (index < 0 || index >= _size) {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 5, 0)
|
||||
throw std::exception();
|
||||
#else // QT_VERSION < 5.5.0
|
||||
throw std::out_of_range("");
|
||||
#endif // QT_VERSION < 5.5.0
|
||||
}
|
||||
return data()[index];
|
||||
}
|
||||
|
Reference in New Issue
Block a user