2020-05-24 02:15:43 +02:00
|
|
|
/***********************************************************************
|
|
|
|
* fstringstream.cpp - I/O operations on FString based streams *
|
|
|
|
* *
|
2020-07-08 21:32:47 +02:00
|
|
|
* This file is part of the FINAL CUT widget toolkit *
|
2020-05-24 02:15:43 +02:00
|
|
|
* *
|
|
|
|
* Copyright 2020 Markus Gans *
|
|
|
|
* *
|
2020-07-08 21:32:47 +02:00
|
|
|
* FINAL CUT is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU Lesser General Public License as *
|
|
|
|
* published by the Free Software Foundation; either version 3 of *
|
2020-05-24 02:15:43 +02:00
|
|
|
* the License, or (at your option) any later version. *
|
|
|
|
* *
|
2020-07-08 21:32:47 +02:00
|
|
|
* FINAL CUT is distributed in the hope that it will be useful, but *
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
2020-05-24 02:15:43 +02:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
|
|
|
* GNU Lesser General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public *
|
|
|
|
* License along with this program. If not, see *
|
|
|
|
* <http://www.gnu.org/licenses/>. *
|
|
|
|
***********************************************************************/
|
|
|
|
|
2020-08-23 00:32:41 +02:00
|
|
|
#include <utility>
|
|
|
|
|
2020-05-24 02:15:43 +02:00
|
|
|
#include "final/fstring.h"
|
|
|
|
#include "final/fstringstream.h"
|
|
|
|
|
|
|
|
namespace finalcut
|
|
|
|
{
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// class FStringStream
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
|
|
|
|
// constructors and destructor
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FStringStream::FStringStream (openmode mode)
|
|
|
|
: std::wiostream{&buffer}
|
|
|
|
, buffer{mode}
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FStringStream::FStringStream (const FString& str, openmode mode)
|
|
|
|
: std::wiostream{&buffer}
|
|
|
|
, buffer{str.wc_str(), mode}
|
|
|
|
{ }
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-05-24 23:55:08 +02:00
|
|
|
FStringStream::FStringStream (FStringStream&& sstream) noexcept
|
2020-05-24 02:15:43 +02:00
|
|
|
: std::wiostream{std::move(sstream)}
|
|
|
|
, buffer{std::move(sstream.buffer)}
|
|
|
|
{
|
|
|
|
std::wiostream::set_rdbuf(&buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
FStringStream::~FStringStream() // destructor
|
|
|
|
{ }
|
|
|
|
|
|
|
|
// public methods of FStringStream
|
|
|
|
//----------------------------------------------------------------------
|
2020-05-30 23:02:53 +02:00
|
|
|
FStringStream& FStringStream::operator = (FStringStream&& sstream) noexcept
|
2020-05-24 02:15:43 +02:00
|
|
|
{
|
|
|
|
std::wiostream::operator = (std::move(sstream));
|
|
|
|
buffer = std::move(sstream.buffer);
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
2020-05-24 23:55:08 +02:00
|
|
|
void FStringStream::swap (FStringStream& sstream) noexcept
|
2020-05-24 02:15:43 +02:00
|
|
|
{
|
|
|
|
std::wiostream::swap(sstream);
|
|
|
|
buffer.swap(sstream.buffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace finalcut
|
|
|
|
|