Files
ResInsight/Fwk/AppFwk/cafProjectDataModel/cafPdmCore/cafFilePath.cpp
T
Kristian Bendiksen 23202c9f15 #6018 Remove unnecessary caf::FilePath assignement operator
In C++11 implicit generation of the copy constructor is deprecated if the
class has a user-declared copy assignment operator or a user-declared destructor.
2020-06-03 22:06:30 +02:00

72 lines
2.3 KiB
C++

#include "cafFilePath.h"
#include <QTextStream>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::FilePath::FilePath() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
caf::FilePath::FilePath(const QString& filePath) : m_filePath(filePath) {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString caf::FilePath::path() const
{
return m_filePath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void caf::FilePath::setPath(const QString& filePath)
{
m_filePath = filePath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool caf::FilePath::operator==(const FilePath& other) const
{
return m_filePath == other.m_filePath;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QTextStream& operator>>(QTextStream& str, caf::FilePath& filePath)
{
QString text;
while (str.status() == QTextStream::Ok)
{
// Read QChar to avoid white space trimming when reading QString
QChar singleChar;
str >> singleChar;
if (!singleChar.isNull())
{
text += singleChar;
}
}
filePath.setPath(text);
return str;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QTextStream& operator<<(QTextStream& str, const caf::FilePath& filePath)
{
str << filePath.path();
return str;
}