StdinPDFDocBuilder.cc 1.19 KB
Newer Older
1 2 3 4 5 6 7
//========================================================================
//
// StdinPDFDocBuilder.cc
//
// This file is licensed under the GPLv2 or later
//
// Copyright 2010 Hib Eris <hib@hiberis.nl>
Albert Astals Cid's avatar
Albert Astals Cid committed
8
// Copyright 2010, 2017 Albert Astals Cid <aacid@kde.org>
9 10 11 12 13 14 15 16 17 18 19 20 21 22
//
//========================================================================

#include <config.h>

#include "StdinPDFDocBuilder.h"
#include "CachedFile.h"
#include "StdinCachedFile.h"

//------------------------------------------------------------------------
// StdinPDFDocBuilder
//------------------------------------------------------------------------

PDFDoc *
23
StdinPDFDocBuilder::buildPDFDoc(const GooString &uri, GooString *ownerPassword,
24 25
                                    GooString *userPassword, void *guiDataA)
{
26
  CachedFile *cachedFile = new CachedFile(new StdinCacheLoader(), nullptr);
27
  return new PDFDoc(new CachedFileStream(cachedFile, 0, gFalse,
Albert Astals Cid's avatar
Albert Astals Cid committed
28
                                         cachedFile->getLength(), Object(objNull)),
29 30 31
                    ownerPassword, userPassword);
}

32
GBool StdinPDFDocBuilder::supports(const GooString &uri)
33
{
34
  if (uri.cmpN("fd://0", 6) == 0) {
35 36 37 38 39 40
    return gTrue;
  } else {
    return gFalse;
  }
}