1 | // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*- |
---|
2 | // vi:set ts=4 sts=4 sw=4 noet : |
---|
3 | // |
---|
4 | // Copyright 2010, 2011 wkhtmltopdf authors |
---|
5 | // |
---|
6 | // This file is part of wkhtmltopdf. |
---|
7 | // |
---|
8 | // wkhtmltopdf is free software: you can redistribute it and/or modify |
---|
9 | // it under the terms of the GNU Lesser General Public License as published by |
---|
10 | // the Free Software Foundation, either version 3 of the License, or |
---|
11 | // (at your option) any later version. |
---|
12 | // |
---|
13 | // wkhtmltopdf is distributed in the hope that it will be useful, |
---|
14 | // but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | // GNU General Public License for more details. |
---|
17 | // |
---|
18 | // You should have received a copy of the GNU Lesser General Public License |
---|
19 | // along with wkhtmltopdf. If not, see <http://www.gnu.org/licenses/>. |
---|
20 | |
---|
21 | #ifndef __PDFCOMMANDLINEPARSER_HH__ |
---|
22 | #define __PDFCOMMANDLINEPARSER_HH__ |
---|
23 | #include "commandlineparserbase.hh" |
---|
24 | #include <cstdio> |
---|
25 | #include <wkhtmltox/pdfsettings.hh> |
---|
26 | |
---|
27 | class PdfCommandLineParser: public CommandLineParserBase { |
---|
28 | public: |
---|
29 | const static int global = 1; |
---|
30 | const static int page = 2; |
---|
31 | const static int toc = 4; |
---|
32 | bool readArgsFromStdin; |
---|
33 | wkhtmltopdf::settings::PdfGlobal & globalSettings; |
---|
34 | QList<wkhtmltopdf::settings::PdfObject> & pageSettings; |
---|
35 | |
---|
36 | wkhtmltopdf::settings::PdfObject od; |
---|
37 | |
---|
38 | //Arguments.cc |
---|
39 | PdfCommandLineParser(wkhtmltopdf::settings::PdfGlobal & globalSettings, |
---|
40 | QList<wkhtmltopdf::settings::PdfObject> & pageSettings); |
---|
41 | |
---|
42 | //docparts.cc |
---|
43 | void outputManName(Outputter * o) const; |
---|
44 | void outputSynopsis(Outputter * o) const; |
---|
45 | void outputDescripton(Outputter * o) const; |
---|
46 | void outputPageSizes(Outputter * o) const; |
---|
47 | void outputArgsFromStdin(Outputter * o) const; |
---|
48 | void outputHeaderFooterDoc(Outputter * o) const; |
---|
49 | void outputTableOfContentDoc(Outputter * o) const; |
---|
50 | void outputOutlineDoc(Outputter * o) const; |
---|
51 | void outputNotPatched(Outputter * o, bool sure) const; |
---|
52 | void outputPageBreakDoc(Outputter * o) const; |
---|
53 | void outputContact(Outputter * o) const; |
---|
54 | void outputDocStart(Outputter * o) const; |
---|
55 | void outputInstallation(Outputter * o) const; |
---|
56 | void outputExamples(Outputter * o) const; |
---|
57 | |
---|
58 | //commandlineparser.cc |
---|
59 | virtual QString appName() const {return "wkhtmltopdf";} |
---|
60 | virtual void usage(FILE * fd, bool extended) const; |
---|
61 | virtual void manpage(FILE * fd) const; |
---|
62 | virtual void readme(FILE * fd, bool html) const; |
---|
63 | |
---|
64 | void parseArguments(int argc, const char ** argv, bool fromStdin=false); |
---|
65 | |
---|
66 | virtual char * mapAddress(char * d, char * ns) const { |
---|
67 | const char * _od = reinterpret_cast<const char *>(&od); |
---|
68 | if (_od > d || d >= _od + sizeof(wkhtmltopdf::settings::PdfObject)) return d;; |
---|
69 | return d - _od + ns; |
---|
70 | } |
---|
71 | |
---|
72 | }; |
---|
73 | #endif //__PDFCOMMANDLINEPARSER_HH__ |
---|