• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.10.4 API Reference
  • KDE Home
  • Contact Us
 

kjsembed

  • kjsembed
  • kjsembed
binding_support.cpp
Go to the documentation of this file.
1 /* This file is part of the KDE libraries
2  Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
3  Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
4  Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
5  Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License as published by the Free Software Foundation; either
10  version 2 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Library General Public License for more details.
16 
17  You should have received a copy of the GNU Library General Public License
18  along with this library; see the file COPYING.LIB. If not, write to
19  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  Boston, MA 02110-1301, USA.
21 */
22 #include "binding_support.h"
23 #include <kjs/interpreter.h>
24 
25 
26 using namespace KJSEmbed;
27 
28 ProxyBinding::ProxyBinding( KJS::ExecState *exec )
29  : KJS::JSObject(exec->lexicalInterpreter()->builtinObjectPrototype())
30 {
31 
32 }
33 
34 QString KJSEmbed::extractQString( KJS::ExecState *exec, const KJS::List &args, int idx, const QString defaultValue )
35 {
36  if( args.size() > idx )
37  {
38  return extractQString( exec, args[idx] );
39  }
40  return defaultValue;
41 }
42 
43 QString KJSEmbed::extractQString( KJS::ExecState *exec, KJS::JSValue *value, const QString defaultValue )
44 {
45  if( !value )
46  return defaultValue;
47  return toQString(value->toString(exec));
48 }
49 
50 QByteArray KJSEmbed::extractQByteArray( KJS::ExecState *exec, const KJS::List &args, int idx, const QByteArray &defaultValue )
51 {
52  if( args.size() > idx )
53  {
54  return extractQByteArray( exec, args[idx] );
55  }
56  return defaultValue;
57 }
58 
59 QByteArray KJSEmbed::extractQByteArray( KJS::ExecState *exec, KJS::JSValue *value, const QByteArray &defaultValue )
60 {
61  if( !value )
62  return defaultValue;
63  return toQString(value->toString(exec)).toLatin1();
64 }
65 
66 KJS::JSValue *KJSEmbed::createQByteArray( KJS::ExecState *exec, const QByteArray &value )
67 {
68  Q_UNUSED( exec );
69  return KJS::jsString( value.data() );
70 }
71 
72 int KJSEmbed::extractInt( KJS::ExecState *exec, const KJS::List &args, int idx, int defaultValue )
73 {
74  if( args.size() > idx )
75  {
76  return extractInt( exec, args[idx] );
77  }
78  return defaultValue;
79 }
80 
81 int KJSEmbed::extractInt( KJS::ExecState *exec, KJS::JSValue *value, int defaultValue )
82 {
83  if( !value )
84  return defaultValue;
85  return int( value->toInteger(exec) );
86 }
87 
88 KJS::JSValue *KJSEmbed::createQString( KJS::ExecState *exec, const QString &value )
89 {
90  Q_UNUSED( exec );
91  return KJS::jsString( toUString(value) );
92 }
93 
94 KJS::JSValue *KJSEmbed::createInt( KJS::ExecState *exec, int value )
95 {
96  Q_UNUSED( exec );
97  return KJS::jsNumber( value );
98 }
99 
100 double KJSEmbed::extractDouble( KJS::ExecState *exec, const KJS::List &args, int idx, double defaultValue )
101 {
102  if( args.size() > idx )
103  {
104  return extractDouble( exec, args[idx] );
105  }
106  return defaultValue;
107 }
108 
109 double KJSEmbed::extractDouble( KJS::ExecState *exec, KJS::JSValue *value, double defaultValue )
110 {
111  if( !value )
112  return defaultValue;
113  return (double) value->toNumber(exec);
114 }
115 
116 
117 KJS::JSValue *KJSEmbed::createDouble( KJS::ExecState *exec, double value )
118 {
119  Q_UNUSED( exec );
120  return KJS::jsNumber( value );
121 }
122 
123 
124 float KJSEmbed::extractFloat( KJS::ExecState *exec, const KJS::List &args, int idx, float defaultValue )
125 {
126  if( args.size() > idx )
127  {
128  return extractFloat( exec, args[idx] );
129  }
130  return defaultValue;
131 }
132 
133 
134 float KJSEmbed::extractFloat( KJS::ExecState *exec, KJS::JSValue *value, float defaultValue )
135 {
136  if( !value )
137  return defaultValue;
138  return (float) value->toNumber(exec);
139 }
140 
141 
142 KJS::JSValue *KJSEmbed::createFloat( KJS::ExecState *exec, float value )
143 {
144  Q_UNUSED( exec );
145  return KJS::jsNumber( value );
146 }
147 
148 
149 bool KJSEmbed::extractBool( KJS::ExecState *exec, const KJS::List &args, int idx, bool defaultValue )
150 {
151  if( args.size() > idx )
152  {
153  return extractBool( exec, args[idx] );
154  }
155  return defaultValue;
156 }
157 
158 
159 bool KJSEmbed::extractBool( KJS::ExecState *exec, KJS::JSValue *value, bool defaultValue )
160 {
161  if( !value )
162  return defaultValue;
163  return value->toBoolean(exec);
164 }
165 
166 
167 KJS::JSValue *KJSEmbed::createBool( KJS::ExecState *exec, bool value )
168 {
169  Q_UNUSED( exec );
170  return KJS::jsBoolean( value );
171 }
172 
173 
174 QDateTime KJSEmbed::extractQDateTime( KJS::ExecState* /* exec */, const KJS::List& /* args */, int /* idx */, const QDateTime& /* defaultValue */ )
175 {
176  return QDateTime();
177 }
178 
179 
180 QDateTime KJSEmbed::extractQDateTime( KJS::ExecState* /* exec */, KJS::JSValue* /* value */, const QDateTime& /* defaultValue */ )
181 {
182  return QDateTime();
183 }
184 
185 
186 KJS::JSValue *KJSEmbed::createQDateTime( KJS::ExecState* /* exec */, const QDateTime& /* value */ )
187 {
188 // return new KJS::JSValue();
189  return 0;
190 }
191 
192 
193 QDate KJSEmbed::extractQDate( KJS::ExecState* /* exec */, const KJS::List& /* args */, int /* idx */, const QDate& /* defaultValue */ )
194 {
195  return QDate();
196 }
197 
198 
199 QDate KJSEmbed::extractQDate( KJS::ExecState* /*exec*/, KJS::JSValue* /*value*/, const QDate& /*defaultValue*/ )
200 {
201  return QDate();
202 }
203 
204 
205 KJS::JSValue *KJSEmbed::createQDate( KJS::ExecState* /*exec*/, const QDate& /*value*/ )
206 {
207 // return new KJS::JSValue();
208  return 0;
209 }
210 
211 
212 QTime KJSEmbed::extractQTime( KJS::ExecState* /*exec*/, const KJS::List& /*args*/, int /*idx*/, const QTime& /*defaultValue*/ )
213 {
214  return QTime();
215 }
216 
217 
218 QTime KJSEmbed::extractQTime( KJS::ExecState * /*exec*/, KJS::JSValue* /*value*/, const QTime &/*defaultValue*/ )
219 {
220  return QTime();
221 }
222 
223 
224 KJS::JSValue *KJSEmbed::createQTime( KJS::ExecState * /*exec*/, const QTime &/*value*/ )
225 {
226 // return new KJS::JSValue();
227  return 0;
228 }
229 
230 
231 QStringList KJSEmbed::extractQStringList( KJS::ExecState * /*exec*/, const KJS::List &/*args*/, int /*idx*/, const QStringList &/*defaultValue*/ )
232 {
233  return QStringList();
234 }
235 
236 
237 QStringList KJSEmbed::extractQStringList( KJS::ExecState * /*exec*/, KJS::JSValue* /*value*/, const QStringList &/*defaultValue*/ )
238 {
239  return QStringList();
240 }
241 
242 
243 KJS::JSValue *KJSEmbed::createQStringList( KJS::ExecState * /*exec*/, const QStringList &/*value*/ )
244 {
245 // return new KJS::JSValue();
246  return 0;
247 }
248 //kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;
249 
250 
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Wed Jun 5 2013 18:36:11 by doxygen 1.8.3.1 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kjsembed

Skip menu "kjsembed"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdelibs-4.10.4 API Reference

Skip menu "kdelibs-4.10.4 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal