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

kjsembed

  • 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;
This file is part of the KDE documentation.
Documentation copyright © 1996-2013 The KDE developers.
Generated on Fri Jul 12 2013 08:51:12 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.5 API Reference

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