pdf_object.hpp
上传用户:yhdzpy8989
上传日期:2007-06-13
资源大小:13604k
文件大小:5k
- /*
- * ===========================================================================
- * PRODUCTION $Log: pdf_object.hpp,v $
- * PRODUCTION Revision 1000.1 2004/06/01 21:03:47 gouriano
- * PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- * PRODUCTION
- * ===========================================================================
- */
- #ifndef GUI_UTILS__PDF_OBJECT_HPP
- #define GUI_UTILS__PDF_OBJECT_HPP
- /* $Id: pdf_object.hpp,v 1000.1 2004/06/01 21:03:47 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:
- * CPdfObject - Stream for output of Adobe PDF objects
- */
- #include <corelib/ncbiobj.hpp>
- #include <gui/gui.hpp>
- #include "pdf_obj.hpp"
- BEGIN_NCBI_SCOPE
- class NCBI_GUIUTILS_EXPORT CPdfObject : public CObject
- {
- public:
- typedef CRef<CPdfObj> TPdfObjRef;
- CPdfObject(unsigned int obj_num,
- unsigned int generation = 0,
- bool allowCompression = true
- );
- virtual ~CPdfObject();
- enum EPdfObjectFormat
- {
- eUncompressed,
- eCompressed
- };
- //virtual EPdfObjectFormat GetObjectFormat(void) const = 0;
- // direct access to write buffer
- CNcbiOstream& GetWriteBuffer(void);
- unsigned int GetObjNum(void) const;
- unsigned int GetGeneration(void) const;
- virtual string GetSeparator(void) const;
- // print the CPdfObject
- virtual void PrintTo(CNcbiOstream& stream) const;
- CPdfObject& operator<<(CPdfObject& (*pf)(CPdfObject&));
- CPdfDictionary& GetDictionary(void);
- TPdfObjRef& operator[](const string& key);
- protected:
- void x_PrintTo(CNcbiOstream& stream);
- private:
- unsigned int m_ObjNum;
- unsigned int m_Generation;
- string m_Obj;
- CNcbiStrstream m_Buffer;
- string m_Separator;
- CPdfDictionary m_Dictionary;
- bool m_AllowCompression;
- };
- inline CPdfObject& pdfbrk(CPdfObject& pdfstrm)
- {
- pdfstrm.GetWriteBuffer() << pdfstrm.GetSeparator();
- return pdfstrm;
- }
- template <typename T>
- inline CPdfObject& operator<<(CPdfObject& pdfobj, const T& obj)
- {
- pdfobj.GetWriteBuffer() << obj;
- return pdfobj;
- }
- inline CNcbiOstream& operator<<(CNcbiOstream& strm, const CPdfObject& obj)
- {
- obj.PrintTo(strm);
- return strm;
- }
- class NCBI_GUIUTILS_EXPORT CPdfTrailer : public CPdfObject
- {
- public:
- CPdfTrailer();
- virtual ~CPdfTrailer();
- virtual void PrintTo(CNcbiOstream& stream) const;
- };
- template <typename T>
- inline CPdfTrailer& operator<<(CPdfTrailer& pdfobj, const T& obj)
- {
- NCBI_THROW(CException, eUnknown, "CPdfObject::operator<< - illegal use of CPdfTrailer");
- }
- END_NCBI_SCOPE
- #endif // GUI_UTILS__PDF_OBJECT_HPP
- /*
- * ===========================================================================
- * $Log: pdf_object.hpp,v $
- * Revision 1000.1 2004/06/01 21:03:47 gouriano
- * PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.7
- *
- * Revision 1.7 2004/05/03 13:21:36 dicuccio
- * Added gui/gui.hpp
- *
- * Revision 1.6 2003/07/16 17:22:19 ucko
- * Fix typo (missing comma)
- *
- * Revision 1.5 2003/07/16 15:42:30 meric
- * Add flag to specify if object may be compressed
- *
- * 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:27 meric
- * Final phase of print reorg: remove dependence on gui/opengl and OpenGL
- *
- * Revision 1.2 2003/06/16 12:46:21 dicuccio
- * Clean-up after initial commit
- *
- * Revision 1.1 2003/06/13 19:00:30 meric
- * Initial version
- *
- *
- * ===========================================================================
- */