Initial setup

This commit is contained in:
Blue 2023-11-21 19:19:08 -03:00
parent 3a0fa57a06
commit 68e795f0e6
Signed by: blue
GPG key ID: 9B203B252A63EE38
17 changed files with 466 additions and 8 deletions

11
stream/CMakeLists.txt Normal file
View file

@ -0,0 +1,11 @@
set(HEADERS
stream.h
ostream.h
)
set(SOURCES
stream.cpp
ostream.cpp
)
target_sources(pica PRIVATE ${SOURCES})

9
stream/ostream.cpp Normal file
View file

@ -0,0 +1,9 @@
#include "ostream.h"
OStream::OStream(FCGX_Stream* _raw):
Stream(_raw),
std(&raw)
{
}
OStream::~OStream() {}

24
stream/ostream.h Normal file
View file

@ -0,0 +1,24 @@
#pragma once
#include <ios>
#include "stream.h"
class Request;
class OStream : Stream {
friend class Request;
private:
OStream(FCGX_Stream* raw);
public:
~OStream();
template <typename T>
OStream& operator << (const T& value) {
std << value;
return *this;
};
private:
std::ostream std;
};

8
stream/stream.cpp Normal file
View file

@ -0,0 +1,8 @@
#include "stream.h"
Stream::Stream(FCGX_Stream* raw):
raw(raw)
{}
Stream::~Stream() {
}

18
stream/stream.h Normal file
View file

@ -0,0 +1,18 @@
#pragma once
#include <fcgio.h>
class Stream {
protected:
Stream(FCGX_Stream* raw);
Stream(const Stream& other) = delete;
Stream(Stream&& other) = delete;
Stream& operator = (const Stream& other) = delete;
Stream& operator = (Stream&& other) = delete;
virtual ~Stream();
public:
protected:
fcgi_streambuf raw;
};