2018-01-11 06:48:47 -06:00
|
|
|
#include "cafFilePath.h"
|
|
|
|
|
|
|
|
#include <QTextStream>
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-06-19 00:53:59 -05:00
|
|
|
caf::FilePath::FilePath()
|
|
|
|
{
|
|
|
|
}
|
2018-01-11 06:48:47 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-06-19 00:53:59 -05:00
|
|
|
caf::FilePath::FilePath( const QString& filePath )
|
|
|
|
: m_filePath( filePath )
|
|
|
|
{
|
|
|
|
}
|
2018-01-11 06:48:47 -06:00
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
QString caf::FilePath::path() const
|
|
|
|
{
|
|
|
|
return m_filePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-06-19 00:53:59 -05:00
|
|
|
void caf::FilePath::setPath( const QString& filePath )
|
2018-01-11 06:48:47 -06:00
|
|
|
{
|
|
|
|
m_filePath = filePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-06-19 00:53:59 -05:00
|
|
|
bool caf::FilePath::operator==( const FilePath& other ) const
|
2018-01-11 06:48:47 -06:00
|
|
|
{
|
|
|
|
return m_filePath == other.m_filePath;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-06-19 00:53:59 -05:00
|
|
|
QTextStream& operator>>( QTextStream& str, caf::FilePath& filePath )
|
2018-01-11 06:48:47 -06:00
|
|
|
{
|
|
|
|
QString text;
|
2018-01-17 07:32:44 -06:00
|
|
|
|
2020-06-19 00:53:59 -05:00
|
|
|
while ( str.status() == QTextStream::Ok )
|
2018-01-17 07:32:44 -06:00
|
|
|
{
|
|
|
|
// Read QChar to avoid white space trimming when reading QString
|
|
|
|
QChar singleChar;
|
|
|
|
str >> singleChar;
|
|
|
|
|
2020-06-19 00:53:59 -05:00
|
|
|
if ( !singleChar.isNull() )
|
2018-01-17 07:32:44 -06:00
|
|
|
{
|
|
|
|
text += singleChar;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-06-19 00:53:59 -05:00
|
|
|
filePath.setPath( text );
|
2018-01-11 06:48:47 -06:00
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
|
|
|
///
|
|
|
|
//--------------------------------------------------------------------------------------------------
|
2020-06-19 00:53:59 -05:00
|
|
|
QTextStream& operator<<( QTextStream& str, const caf::FilePath& filePath )
|
2018-01-11 06:48:47 -06:00
|
|
|
{
|
|
|
|
str << filePath.path();
|
|
|
|
|
|
|
|
return str;
|
|
|
|
}
|