pdf_object_writer.cpp
来自「ncbi源码」· C++ 代码 · 共 136 行
CPP
136 行
/* * =========================================================================== * PRODUCTION $Log: pdf_object_writer.cpp,v $ * PRODUCTION Revision 1000.2 2004/06/01 21:03:49 gouriano * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * PRODUCTION * =========================================================================== *//* $Id: pdf_object_writer.cpp,v 1000.2 2004/06/01 21:03:49 gouriano Exp $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software / database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software / database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Authors: Peter Meric * * File Description: * CPdfObjectWriter - write PDF objects to an output stream */#include <ncbi_pch.hpp>#include "pdf_object_writer.hpp"#include "pdf_object.hpp"#include <algorithm>BEGIN_NCBI_SCOPECPdfObjectWriter::CPdfObjectWriter(CNcbiOstream* ostream): m_Strm(ostream){}CPdfObjectWriter::~CPdfObjectWriter(){}void CPdfObjectWriter::SetOutputStream(CNcbiOstream* ostream){ m_Strm = ostream;}void CPdfObjectWriter::x_SaveObjectOffset(const CRef<CPdfObject>& obj){ ObjOffset off(obj->GetObjNum(), obj->GetGeneration(), m_Strm->tellp() - CT_POS_TYPE(0)); m_ObjOffsets.push_back(off);}void CPdfObjectWriter::WriteObject(const CRef<CPdfObject>& obj){ x_SaveObjectOffset(obj); *m_Strm << *obj;}CT_POS_TYPE CPdfObjectWriter::WriteXRef(unsigned int obj_num){ const CT_POS_TYPE xref_start = m_Strm->tellp(); // write the cross - reference *m_Strm << "xref" << pdfeol; *m_Strm << "0 " << obj_num << pdfeol; *m_Strm << setfill('0'); *m_Strm << setw(10) << 0 << " 65535 f" << pdfeol; sort(m_ObjOffsets.begin(), m_ObjOffsets.end(), ObjOffsetCompare()); ITERATE(vector<ObjOffset>, it, m_ObjOffsets) { const ObjOffset& off = *it; *m_Strm << setw(10) << off.m_Offset << ' '; *m_Strm << setw(5) << off.m_Generation; *m_Strm << " n" << pdfeol; } return xref_start;}END_NCBI_SCOPE/* * =========================================================================== * $Log: pdf_object_writer.cpp,v $ * Revision 1000.2 2004/06/01 21:03:49 gouriano * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.6 * * Revision 1.6 2004/05/21 22:27:50 gorelenk * Added PCH ncbi_pch.hpp * * Revision 1.5 2004/02/20 20:03:27 ucko * Fix to compile with stricter implementations of CT_POS_TYPE * * Revision 1.4 2003/06/25 18:02:51 meric * Source rearrangement: move "private" headers into the src/ tree * * Revision 1.3 2003/06/18 17:25:39 meric * Final phase of print reorg: remove dependence on gui/opengl and OpenGL * * Revision 1.2 2003/06/16 12:44:52 dicuccio * Clean-up after initial commit * * Revision 1.1 2003 / 06 / 13 18:13:56 meric * Initial version * * * =========================================================================== */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?