mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-14 01:03:08 -07:00
Use nested namespaces definition syntax
This commit is contained in:
parent
04a9ce6e81
commit
552ff0489d
10 changed files with 196 additions and 226 deletions
|
@ -33,9 +33,7 @@
|
||||||
|
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::ByteArray
|
||||||
{
|
|
||||||
namespace ByteArray
|
|
||||||
{
|
{
|
||||||
// Mimic QString::splitRef(sep, behavior)
|
// Mimic QString::splitRef(sep, behavior)
|
||||||
QVector<QByteArray> splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior = QString::KeepEmptyParts);
|
QVector<QByteArray> splitToViews(const QByteArray &in, const QByteArray &sep, const QString::SplitBehavior behavior = QString::KeepEmptyParts);
|
||||||
|
@ -44,4 +42,3 @@ namespace Utils
|
||||||
// we only return a partial view
|
// we only return a partial view
|
||||||
const QByteArray midView(const QByteArray &in, int pos, int len = -1);
|
const QByteArray midView(const QByteArray &in, int pos, int len = -1);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -33,9 +33,7 @@
|
||||||
|
|
||||||
#include "base/utils/version.h"
|
#include "base/utils/version.h"
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::ForeignApps
|
||||||
{
|
|
||||||
namespace ForeignApps
|
|
||||||
{
|
{
|
||||||
struct PythonInfo
|
struct PythonInfo
|
||||||
{
|
{
|
||||||
|
@ -50,4 +48,3 @@ namespace Utils
|
||||||
|
|
||||||
PythonInfo pythonInfo();
|
PythonInfo pythonInfo();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -34,9 +34,7 @@
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::Fs
|
||||||
{
|
|
||||||
namespace Fs
|
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Converts a path to a string suitable for display.
|
* Converts a path to a string suitable for display.
|
||||||
|
@ -77,4 +75,3 @@ namespace Utils
|
||||||
bool isNetworkFileSystem(const QString &path);
|
bool isNetworkFileSystem(const QString &path);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -31,11 +31,8 @@
|
||||||
|
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::Gzip
|
||||||
{
|
|
||||||
namespace Gzip
|
|
||||||
{
|
{
|
||||||
QByteArray compress(const QByteArray &data, int level = 6, bool *ok = nullptr);
|
QByteArray compress(const QByteArray &data, int level = 6, bool *ok = nullptr);
|
||||||
QByteArray decompress(const QByteArray &data, bool *ok = nullptr);
|
QByteArray decompress(const QByteArray &data, bool *ok = nullptr);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -34,9 +34,7 @@
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
class QFileDevice;
|
class QFileDevice;
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::IO
|
||||||
{
|
|
||||||
namespace IO
|
|
||||||
{
|
{
|
||||||
// A wrapper class that satisfy LegacyOutputIterator requirement
|
// A wrapper class that satisfy LegacyOutputIterator requirement
|
||||||
class FileDeviceOutputIterator
|
class FileDeviceOutputIterator
|
||||||
|
@ -77,4 +75,3 @@ namespace Utils
|
||||||
int m_bufferSize;
|
int m_bufferSize;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -41,9 +41,7 @@ enum class ShutdownDialogAction;
|
||||||
|
|
||||||
/* Miscellaneous functions that can be useful */
|
/* Miscellaneous functions that can be useful */
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::Misc
|
||||||
{
|
|
||||||
namespace Misc
|
|
||||||
{
|
{
|
||||||
// use binary prefix standards from IEC 60027-2
|
// use binary prefix standards from IEC 60027-2
|
||||||
// see http://en.wikipedia.org/wiki/Kilobyte
|
// see http://en.wikipedia.org/wiki/Kilobyte
|
||||||
|
@ -106,4 +104,3 @@ namespace Utils
|
||||||
}
|
}
|
||||||
#endif // Q_OS_WIN
|
#endif // Q_OS_WIN
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -35,9 +35,7 @@ class QSslCertificate;
|
||||||
class QSslKey;
|
class QSslKey;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::Net
|
||||||
{
|
|
||||||
namespace Net
|
|
||||||
{
|
{
|
||||||
using Subnet = QPair<QHostAddress, int>;
|
using Subnet = QPair<QHostAddress, int>;
|
||||||
|
|
||||||
|
@ -55,4 +53,3 @@ namespace Utils
|
||||||
QSslKey loadSSLKey(const QByteArray &data);
|
QSslKey loadSSLKey(const QByteArray &data);
|
||||||
bool isSSLKeyValid(const QByteArray &data);
|
bool isSSLKeyValid(const QByteArray &data);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -31,9 +31,7 @@
|
||||||
class QByteArray;
|
class QByteArray;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::Password
|
||||||
{
|
|
||||||
namespace Password
|
|
||||||
{
|
{
|
||||||
// Implements constant-time comparison to protect against timing attacks
|
// Implements constant-time comparison to protect against timing attacks
|
||||||
// Taken from https://crackstation.net/hashing-security.htm
|
// Taken from https://crackstation.net/hashing-security.htm
|
||||||
|
@ -48,4 +46,3 @@ namespace Utils
|
||||||
bool verify(const QByteArray &secret, const QByteArray &password);
|
bool verify(const QByteArray &secret, const QByteArray &password);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -31,10 +31,7 @@
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::Random
|
||||||
{
|
|
||||||
namespace Random
|
|
||||||
{
|
{
|
||||||
uint32_t rand(uint32_t min = 0, uint32_t max = std::numeric_limits<uint32_t>::max());
|
uint32_t rand(uint32_t min = 0, uint32_t max = std::numeric_limits<uint32_t>::max());
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
@ -37,9 +37,7 @@
|
||||||
|
|
||||||
class QStringRef;
|
class QStringRef;
|
||||||
|
|
||||||
namespace Utils
|
namespace Utils::String
|
||||||
{
|
|
||||||
namespace String
|
|
||||||
{
|
{
|
||||||
QString fromDouble(double n, int precision);
|
QString fromDouble(double n, int precision);
|
||||||
|
|
||||||
|
@ -92,4 +90,3 @@ namespace Utils
|
||||||
return (ok ? value : defaultValue);
|
return (ok ? value : defaultValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue