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

kjsembed

  • sources
  • kde-4.12
  • kdelibs
  • kjsembed
  • kjsembed
object_binding.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 
23 #include "object_binding.h"
24 
25 #include <QtCore/QArgument>
26 #include <QtCore/QDebug>
27 
28 #include "static_binding.h"
29 #include "variant_binding.h"
30 
31 using namespace KJSEmbed;
32 
33 const KJS::ClassInfo ObjectBinding::info = { "ObjectBinding", 0, 0, 0 };
34 
35 ObjectBinding::~ObjectBinding()
36 {
37  if( m_owner == JSOwned )
38  {
39  m_value->cleanup();
40  }
41 
42  delete m_value;
43 }
44 
45 const char *ObjectBinding::typeName() const
46 {
47  return m_name;
48 }
49 
50 KJS::UString ObjectBinding::toString(KJS::ExecState * /*exec*/) const
51 {
52  return KJS::UString( typeName() );
53 }
54 
55 KJS::UString ObjectBinding::className() const
56 {
57  return KJS::UString( typeName() );
58 }
59 
60 KJS::JSType ObjectBinding::type() const
61 {
62  return KJS::ObjectType;
63 }
64 
65 ObjectBinding::Ownership ObjectBinding::ownership() const
66 {
67  return m_owner;
68 }
69 
70 void ObjectBinding::setOwnership( ObjectBinding::Ownership owner )
71 {
72  m_owner = owner;
73 }
74 
75 KJS::JSValue *callPointerName( KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &/*args*/ )
76 {
77  KJSEmbed::ObjectBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::ObjectBinding>(exec, self );
78  if( imp )
79  {
80  return KJS::jsString( imp->typeName() );
81  }
82  return KJS::jsNull();
83 }
84 
85 KJS::JSValue *callPointerCast( KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &/*args*/ )
86 {
87  KJSEmbed::ObjectBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::ObjectBinding>(exec, self );
88  if( imp )
89  {
90  return KJS::jsBoolean(false);
91  }
92  return KJS::jsNull();
93 }
94 
95 KJS::JSValue *callPointerToString( KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &/*args*/ )
96 {
97  KJSEmbed::ObjectBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::ObjectBinding>(exec, self );
98  if( imp )
99  {
100  qDebug("Object to string");
101  return KJS::jsString( imp->typeName() );
102  }
103  return KJS::jsNull();
104 }
105 
106 const Method ObjectFactory::ObjectMethods[] =
107 {
108  {"type", 0, KJS::DontDelete|KJS::ReadOnly, &callPointerName },
109  {"cast", 1, KJS::DontDelete|KJS::ReadOnly, &callPointerCast },
110  {"toString", 0, KJS::DontDelete|KJS::ReadOnly, &callPointerToString },
111  {0, 0, 0, 0 }
112 };
113 
114 //kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;
KJSEmbed::ObjectBinding::className
KJS::UString className() const
Definition: object_binding.cpp:55
KJSEmbed::ObjectBinding::Ownership
Ownership
Definition: object_binding.h:91
KJSEmbed::ObjectBinding::JSOwned
Definition: object_binding.h:91
callPointerCast
KJS::JSValue * callPointerCast(KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &)
Definition: object_binding.cpp:85
KJSEmbed::ObjectBinding::info
static const KJS::ClassInfo info
Definition: object_binding.h:92
KJSEmbed::Method
Method structure.
Definition: binding_support.h:294
KJSEmbed::ObjectBinding
Definition: object_binding.h:88
object_binding.h
KJSEmbed::ObjectBinding::toString
KJS::UString toString(KJS::ExecState *exec) const
Definition: object_binding.cpp:50
KJSEmbed::ObjectBinding::type
KJS::JSType type() const
Definition: object_binding.cpp:60
KJSEmbed::ObjectBinding::~ObjectBinding
virtual ~ObjectBinding()
Definition: object_binding.cpp:35
KJSEmbed::ObjectBinding::typeName
const char * typeName() const
Definition: object_binding.cpp:45
KJSEmbed::ObjectBinding::setOwnership
void setOwnership(Ownership owner)
Definition: object_binding.cpp:70
KJSEmbed::ObjectBinding::ownership
Ownership ownership() const
Definition: object_binding.cpp:65
AttrElementNS::owner
END_VALUE_METHOD QDomElement owner
Definition: dom.cpp:644
callPointerName
KJS::JSValue * callPointerName(KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &)
Definition: object_binding.cpp:75
KJSEmbed::ObjectFactory::ObjectMethods
static const Method ObjectMethods[]
Definition: object_binding.h:84
KJS::jsString
KJS::JSCell * jsString(const QString &s)
Definition: kjseglobal.h:73
List
Definition: variant_binding.cpp:130
static_binding.h
callPointerToString
KJS::JSValue * callPointerToString(KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &)
Definition: object_binding.cpp:95
variant_binding.h
PointerBase::cleanup
virtual void cleanup()=0
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:47:53 by doxygen 1.8.7 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 API Reference

Skip menu "kdelibs 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
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



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