1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
23 #include "SimplePDF_decls.h"
26 #include "pdfstructure.h"
36 RefCountPtr
< std::istream
> is
;
39 RefCountPtr
< PDF_Dictionary
> resources
;
40 RefCountPtr
< PDF_Vector
> pages
;
42 RefCountPtr
< PDF_Object
> readObjectAt( std::streamoff pos
);
43 std::streamoff
xreflookup( size_t i
, size_t v
);
44 RefCountPtr
< PDF_Object
> parse( );
49 SimplePDF::PDF_in
& in
;
51 PageIterator( SimplePDF::PDF_in
& _in
, int _pageNo
);
52 PageIterator( const PageIterator
& orig
);
53 PageIterator
& operator = ( const PageIterator
& orig
);
54 bool operator == ( const PageIterator
& i2
) const;
55 bool operator != ( const PageIterator
& i2
) const;
56 RefCountPtr
< PDF_Dictionary
> operator * ( );
57 PageIterator
operator ++ ();
58 PageIterator
operator -- ();
59 PageIterator
operator ++ ( int );
60 PageIterator
operator -- ( int );
61 PageIterator
& operator += ( int diff
);
62 PageIterator
& operator -= ( int diff
);
65 PDF_in( RefCountPtr
< std::istream
> _is
);
68 RefCountPtr
< PDF_Object
> readObjectNumbered( size_t i
, size_t v
);
70 RefCountPtr
< S
> follow( RefCountPtr
< PDF_Object
> maybeIndirect
);
71 RefCountPtr
< PDF_Object
> follow( RefCountPtr
< PDF_Object
> maybeIndirect
);
72 size_t getPageCount( );
73 PageIterator
beginPages( );
74 PageIterator
endPages( );
75 RefCountPtr
< PDF_Dictionary
> getPage( size_t pageNo
);
79 RefCountPtr
< S
> PDF_in::follow( RefCountPtr
< PDF_Object
> maybeIndirect
)
81 PDF_Indirect
* tmp( dynamic_cast< PDF_Indirect
* >( maybeIndirect
.getPtr( ) ) );
84 RefCountPtr
< S
> res( maybeIndirect
.down_cast
< S
>( ) );
85 if( res
== NullPtr
< S
>( ) )
87 throw( "Downcast in PDF_in::follow failed" );
91 return follow
< S
>( readObjectNumbered( tmp
->i
, tmp
->v
) );