Utils: Use data member instead of inheritance in FileName

Change-Id: Ib0a9889dfa34ea877ee413881e87ab12c3a54956
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2019-05-10 12:23:27 +02:00
parent b997214abb
commit 648f983f49
2 changed files with 55 additions and 64 deletions

View File

@@ -60,7 +60,7 @@ QT_END_NAMESPACE
namespace Utils {
class QTCREATOR_UTILS_EXPORT FileName : private QString
class QTCREATOR_UTILS_EXPORT FileName
{
public:
FileName();
@@ -97,11 +97,13 @@ public:
FileName &appendString(const QString &str);
FileName &appendString(QChar str);
using QString::clear;
using QString::isEmpty;
void clear() { m_data.clear(); }
bool isEmpty() const { return m_data.isEmpty(); }
uint hash(uint seed) const;
private:
FileName(const QString &string);
QString m_data;
};
QTCREATOR_UTILS_EXPORT QTextStream &operator<<(QTextStream &s, const FileName &fn);
@@ -239,11 +241,9 @@ private:
bool m_autoRemove = true;
};
} // namespace Utils
inline uint qHash(const Utils::FileName &a, uint seed = 0) { return a.hash(seed); }
QT_BEGIN_NAMESPACE
QTCREATOR_UTILS_EXPORT uint qHash(const Utils::FileName &a);
QT_END_NAMESPACE
} // namespace Utils
namespace std {
template<> struct hash<Utils::FileName>