source: wkhtmltox/trunk/fuentes/src/lib/reflect.cc @ 51

Last change on this file since 51 was 51, checked in by mabarracus, 4 years ago

wip

File size: 3.1 KB
Line 
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
22#include "reflect.hh"
23
24namespace wkhtmltopdf {
25namespace settings {
26
27bool ReflectSimple::set(const char * name, const QString & value) {
28        bool ok=false;
29        if (name[0]=='\0') set(value, &ok);
30        return ok;
31}
32
33QString ReflectClass::get(const char * name) {
34        int i=0;
35        while (name[i] !=0 && name[i] != '.' && name[i] != '[') ++i;
36        if (!elms.contains(QString::fromLocal8Bit(name, i))) return QString();
37        return elms[QString::fromLocal8Bit(name,i)]->get(name + (name[i] == '.'?i+1:i));
38}
39
40bool ReflectClass::set(const char * name, const QString & value) {
41        int i=0;
42        while (name[i] !=0 && name[i] != '.' && name[i] != '[') ++i;
43        if (!elms.contains(QString::fromLocal8Bit(name, i))) return false;
44        return elms[QString::fromLocal8Bit(name,i)]->set(name + (name[i] == '.'?i+1:i), value);
45}
46
47
48ReflectClass::~ReflectClass() {
49        for (QMap<QString, Reflect *>::iterator i=elms.begin(); i != elms.end(); ++i)
50                delete i.value();
51}
52
53ReflectImpl<LoadGlobal>::ReflectImpl(LoadGlobal & c) {
54        WKHTMLTOPDF_REFLECT(cookieJar);
55}
56
57ReflectImpl<LoadPage>::ReflectImpl(LoadPage & c) {
58        WKHTMLTOPDF_REFLECT(username);
59        WKHTMLTOPDF_REFLECT(password);
60        WKHTMLTOPDF_REFLECT(jsdelay);
61        WKHTMLTOPDF_REFLECT(windowStatus);
62        WKHTMLTOPDF_REFLECT(zoomFactor);
63        WKHTMLTOPDF_REFLECT(customHeaders);
64        WKHTMLTOPDF_REFLECT(repeatCustomHeaders);
65        WKHTMLTOPDF_REFLECT(cookies);
66        WKHTMLTOPDF_REFLECT(post);
67        WKHTMLTOPDF_REFLECT(blockLocalFileAccess);
68        WKHTMLTOPDF_REFLECT(allowed);
69        WKHTMLTOPDF_REFLECT(stopSlowScripts);
70        WKHTMLTOPDF_REFLECT(debugJavascript);
71        WKHTMLTOPDF_REFLECT(loadErrorHandling);
72        WKHTMLTOPDF_REFLECT(proxy);
73        WKHTMLTOPDF_REFLECT(runScript);
74        WKHTMLTOPDF_REFLECT(checkboxSvg);
75        WKHTMLTOPDF_REFLECT(checkboxCheckedSvg);
76        WKHTMLTOPDF_REFLECT(radiobuttonSvg);
77        WKHTMLTOPDF_REFLECT(radiobuttonCheckedSvg);
78        WKHTMLTOPDF_REFLECT(cacheDir);
79        WKHTMLTOPDF_REFLECT(bypassProxyForHosts);
80}
81
82ReflectImpl<Web>::ReflectImpl(Web & c) {
83        WKHTMLTOPDF_REFLECT(background);
84        WKHTMLTOPDF_REFLECT(loadImages);
85        WKHTMLTOPDF_REFLECT(enableJavascript);
86        WKHTMLTOPDF_REFLECT(enableIntelligentShrinking);
87        WKHTMLTOPDF_REFLECT(minimumFontSize);
88        WKHTMLTOPDF_REFLECT(printMediaType);
89        WKHTMLTOPDF_REFLECT(defaultEncoding);
90        WKHTMLTOPDF_REFLECT(userStyleSheet);
91        WKHTMLTOPDF_REFLECT(enablePlugins);
92}
93
94}
95}
Note: See TracBrowser for help on using the repository browser.