Files
ptyqt/core/ptyqt.cpp
T

49 lines
1.0 KiB
C++

#include "ptyqt.h"
#include <utility>
#ifdef Q_OS_WIN
#include "winptyprocess.h"
#include "conptynamedpipeprocess.h"
#include "conptyanonymouspipeprocess.h"
#endif
#ifdef Q_OS_UNIX
#include "unixptyprocess.h"
#endif
IPtyProcess *PtyQt::createPtyProcess(IPtyProcess::PtyType ptyType)
{
switch (ptyType)
{
#ifdef Q_OS_WIN
case IPtyProcess::PtyType::WinPty:
return new WinPtyProcess();
break;
case IPtyProcess::PtyType::ConPtyNamedPipe:
return new ConPtyNamedPipeProcess();
break;
case IPtyProcess::PtyType::ConPtyAnonPipe:
return new ConPtyAnonymousPipeProcess();
break;
#endif
#ifdef Q_OS_UNIX
case IPtyProcess::PtyType::UnixPty:
return new UnixPtyProcess();
break;
#endif
case IPtyProcess::PtyType::AutoPty:
default:
break;
}
#ifdef Q_OS_WIN
if (ConPtyNamedPipeProcess().isAvailable())
return new ConPtyNamedPipeProcess();
else
return new WinPtyProcess();
#endif
#ifdef Q_OS_UNIX
return new UnixPtyProcess();
#endif
}