Geometrize  1.0
An application for geometrizing images into geometric primitives
Public Member Functions | Private Attributes | List of all members
geometrize::serialization::StreamView Class Reference

The StreamView class defines a custom stream buffer view that allows Cereal to work with Qt resources packed into executables. This is necessary because Cereal uses istreams directly, but we need to work with Qt resources. More...

#include <streamview.h>

Inheritance diagram for geometrize::serialization::StreamView:
Inheritance graph
[legend]
Collaboration diagram for geometrize::serialization::StreamView:
Collaboration graph
[legend]

Public Member Functions

 StreamView (const std::string &filePath)
 
virtual ~StreamView ()=default
 

Private Attributes

QByteArray m_byteArray
 

Detailed Description

The StreamView class defines a custom stream buffer view that allows Cereal to work with Qt resources packed into executables. This is necessary because Cereal uses istreams directly, but we need to work with Qt resources.

Constructor & Destructor Documentation

◆ StreamView()

geometrize::serialization::StreamView::StreamView ( const std::string &  filePath)
16 {
17  QFile file(QString::fromStdString(filePath));
18  if(!file.open(QFile::ReadOnly)) {
19  assert(0 && "Failed to read file");
20  return;
21  }
22  m_byteArray = file.readAll();
23 
24  char* data = (char*)m_byteArray.data();
25  this->setg(data, data, data + m_byteArray.size());
26 }

◆ ~StreamView()

virtual geometrize::serialization::StreamView::~StreamView ( )
virtualdefault

Member Data Documentation

◆ m_byteArray

QByteArray geometrize::serialization::StreamView::m_byteArray
private

The documentation for this class was generated from the following files:
geometrize::serialization::StreamView::m_byteArray
QByteArray m_byteArray
Definition: streamview.h:26