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

kjsembed

  • kjsembed
  • kjsembed
url.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 "url.h"
23
24#include <QtCore/QDebug>
25#include <QtCore/QUrl>
26
27using namespace KJSEmbed;
28
29const KJS::ClassInfo UrlBinding::info = { "QUrl", &VariantBinding::info, 0, 0 };
30UrlBinding::UrlBinding( KJS::ExecState *exec, const QUrl &value )
31 : VariantBinding(exec, value )
32{
33 StaticBinding::publish( exec, this, VariantFactory::methods() );
34 StaticBinding::publish( exec, this, Url::methods() );
35}
36
37namespace UrlNS
38{
39
40START_VARIANT_METHOD( callisValid, QUrl )
41 bool cppValue = value.isValid();
42 result = KJS::jsBoolean(cppValue);
43END_VARIANT_METHOD
44
45START_VARIANT_METHOD( toString, QUrl )
46 QUrl::FormattingOptions opts = (QUrl::FormattingOptions)KJSEmbed::extractInt(exec, args, 0, QUrl::None);
47 result = KJS::jsString( value.toString( opts ) );
48END_VARIANT_METHOD
49}
50
51START_METHOD_LUT( Url )
52 {"toString", 0, KJS::DontDelete|KJS::ReadOnly, &UrlNS::toString},
53 {"isValid", 0, KJS::DontDelete|KJS::ReadOnly, &UrlNS::callisValid}
54END_METHOD_LUT
55
56START_ENUM_LUT( Url )
57 {"None", QUrl::None},
58 {"RemoveScheme", QUrl::RemoveScheme},
59 {"RemovePassword", QUrl::RemovePassword},
60 {"RemoveUserInfo", QUrl::RemoveUserInfo},
61 {"RemovePort", QUrl::RemovePort},
62 {"RemoveAuthority", QUrl::RemoveAuthority},
63 {"RemovePath", QUrl::RemovePath},
64 {"RemoveQuery", QUrl::RemoveQuery},
65 {"RemoveFragment", QUrl::RemoveFragment},
66 {"StripTrailingSlash", QUrl::StripTrailingSlash}
67END_ENUM_LUT
68
69NO_STATICS( Url )
70
71START_CTOR( Url, QUrl, 0 )
72 if( args.size() == 1 )
73 {
74 return new KJSEmbed::UrlBinding(exec, QUrl( KJSEmbed::extractQString( exec, args, 0 ) ) );
75 }
76
77 return new KJSEmbed::UrlBinding( exec, QUrl() );
78END_CTOR
79
80//kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;
81
START_METHOD_LUT
#define START_METHOD_LUT(TYPE)
Definition: binding_support.h:127
START_ENUM_LUT
#define START_ENUM_LUT(TYPE)
Definition: binding_support.h:139
END_CTOR
#define END_CTOR
Definition: binding_support.h:166
NO_STATICS
#define NO_STATICS(TYPE)
Definition: binding_support.h:153
START_CTOR
#define START_CTOR(TYPE, JSNAME, ARGS)
Definition: binding_support.h:157
END_METHOD_LUT
#define END_METHOD_LUT
Definition: binding_support.h:135
END_ENUM_LUT
#define END_ENUM_LUT
Definition: binding_support.h:143
KJSEmbed::StaticBinding::publish
static void publish(KJS::ExecState *exec, KJS::JSObject *object, const Method *methods)
Publishes an array of Methods to an object.
Definition: static_binding.cpp:60
KJSEmbed::UrlBinding
Definition: url.h:36
KJSEmbed::UrlBinding::UrlBinding
UrlBinding(KJS::ExecState *exec, const QUrl &value)
Definition: url.cpp:30
KJSEmbed::UrlBinding::info
static const KJS::ClassInfo info
Definition: url.h:40
KJSEmbed::VariantBinding
QVariant based binding.
Definition: variant_binding.h:89
KJSEmbed::VariantBinding::info
static const KJS::ClassInfo info
Definition: variant_binding.h:123
KJSEmbed::VariantFactory::methods
static const Method * methods()
Definition: variant_binding.h:251
result
END_VARIANT_METHOD result
Definition: color.cpp:85
if
if(file->open((QIODevice::OpenModeFlag) KJSEmbed::extractInt(exec, args, 0)))
Definition: fileio.cpp:64
KJSEmbed
Definition: application.h:33
KJSEmbed::extractQString
QString KJSEMBED_EXPORT extractQString(KJS::ExecState *exec, const KJS::List &args, int idx, const QString defaultValue=QString())
Extracts a QString from an argument list.
Definition: binding_support.cpp:34
KJSEmbed::extractInt
int KJSEMBED_EXPORT extractInt(KJS::ExecState *exec, const KJS::List &args, int idx, int defaultValue=0)
Extracts an integer from an argument list.
Definition: binding_support.cpp:72
KJS
Implement QString-KJS::UString conversion methods.
Definition: kjs_object_model.h:29
UrlNS
Definition: url.cpp:38
cppValue
END_OBJECT_METHOD QBrush cppValue
Definition: qpainter_binding.cpp:97
value
QVariant value
Definition: settings.cpp:35
url.h
None
@ None
Definition: variant_binding.cpp:130
START_VARIANT_METHOD
#define START_VARIANT_METHOD(METHODNAME, TYPE)
A simple variant syle method.
Definition: variant_binding.h:42
END_VARIANT_METHOD
#define END_VARIANT_METHOD
End a variant method started by START_VARIANT_METHOD.
Definition: variant_binding.h:56
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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.14.38 API Reference

Skip menu "kdelibs-4.14.38 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