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

kjsembed

object_binding.cpp

Go to the documentation of this file.
00001 /* This file is part of the KDE libraries
00002     Copyright (C) 2005, 2006 Ian Reinhart Geiser <geiseri@kde.org>
00003     Copyright (C) 2005, 2006 Matt Broadstone <mbroadst@gmail.com>
00004     Copyright (C) 2005, 2006 Richard J. Moore <rich@kde.org>
00005     Copyright (C) 2005, 2006 Erik L. Bunce <kde@bunce.us>
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Library General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Library General Public License for more details.
00016 
00017     You should have received a copy of the GNU Library General Public License
00018     along with this library; see the file COPYING.LIB.  If not, write to
00019     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00020     Boston, MA 02110-1301, USA.
00021 */
00022 
00023 #include "object_binding.h"
00024 
00025 #include <QtCore/QArgument>
00026 #include <QtCore/QDebug>
00027 
00028 #include "static_binding.h"
00029 #include "variant_binding.h"
00030 
00031 using namespace KJSEmbed;
00032 
00033 const KJS::ClassInfo ObjectBinding::info = { "ObjectBinding", 0, 0, 0 };
00034 
00035 ObjectBinding::~ObjectBinding()
00036 {
00037     if( m_owner == JSOwned )
00038     {
00039         m_value->cleanup();
00040     }
00041 
00042     delete m_value;
00043 }
00044 
00045 const char *ObjectBinding::typeName() const
00046 {
00047     return m_name;
00048 }
00049 
00050 KJS::UString ObjectBinding::toString(KJS::ExecState * /*exec*/) const
00051 {
00052     return KJS::UString( typeName() );
00053 }
00054 
00055 KJS::UString ObjectBinding::className() const
00056 {
00057     return KJS::UString( typeName() );
00058 }
00059 
00060 KJS::JSType ObjectBinding::type() const
00061 {
00062     return KJS::ObjectType;
00063 }
00064 
00065 ObjectBinding::Ownership ObjectBinding::ownership() const
00066 {
00067     return m_owner;
00068 }
00069 
00070 void ObjectBinding::setOwnership( ObjectBinding::Ownership owner )
00071 {
00072     m_owner = owner;
00073 }
00074 
00075 KJS::JSValue *callPointerName( KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &/*args*/ )
00076 {
00077     KJSEmbed::ObjectBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::ObjectBinding>(exec,  self );
00078     if( imp )
00079     {
00080         return KJS::jsString( imp->typeName() );
00081     }
00082     return KJS::jsNull();
00083 }
00084 
00085 KJS::JSValue *callPointerCast( KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &/*args*/ )
00086 {
00087     KJSEmbed::ObjectBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::ObjectBinding>(exec,  self );
00088     if( imp )
00089     {
00090         return KJS::jsBoolean(false);
00091     }
00092     return KJS::jsNull();
00093 }
00094 
00095 KJS::JSValue *callPointerToString( KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &/*args*/ )
00096 {
00097     KJSEmbed::ObjectBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::ObjectBinding>(exec,  self );
00098     if( imp )
00099     {
00100         qDebug("Object to string");
00101         return KJS::jsString( imp->typeName() );
00102     }
00103     return KJS::jsNull();
00104 }
00105 
00106 const Method ObjectFactory::ObjectMethods[] =
00107 {
00108     {"type", 0, KJS::DontDelete|KJS::ReadOnly, &callPointerName },
00109     {"cast", 1, KJS::DontDelete|KJS::ReadOnly, &callPointerCast },
00110     {"toString", 0, KJS::DontDelete|KJS::ReadOnly, &callPointerToString },
00111     {0, 0, 0, 0 }
00112 };
00113 
00114 //kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;

kjsembed

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.6.1
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal