• 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
value_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 #include "value_binding.h"
23 #include "static_binding.h"
24 
25 using namespace KJSEmbed;
26 
27 const KJS::ClassInfo ValueBinding::info = { "ValueBinding", 0, 0, 0 };
28 
29 KJS::JSValue *callValueType( KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &args )
30 {
31  Q_UNUSED(args);
32  KJSEmbed::ValueBinding *imp = KJSEmbed::extractBindingImp<KJSEmbed::ValueBinding>(exec, self );
33  if( imp )
34  {
35  return KJS::jsString( imp->className().ascii() );
36  }
37  return KJS::jsNull();
38 }
39 
40 const Method ValueFactory::ValueMethods[] =
41 {
42  {"type", 0, KJS::DontDelete|KJS::ReadOnly, &callValueType },
43  //{"cast", 1, KJS::DontDelete|KJS::ReadOnly, &callPointerCast },
44  //{"toString", 0, KJS::DontDelete|KJS::ReadOnly, &callPointerToString },
45  {0, 0, 0, 0 }
46 };
47 
48 const Method *ValueFactory::methods()
49 {
50  return ValueMethods;
51 }
52 
53 ValueBinding::ValueBinding( KJS::ExecState *exec, const char *typeName)
54  : ProxyBinding( exec ),
55  m_value(0),
56  m_name(typeName)
57 {
58  StaticBinding::publish( exec, this, ValueFactory::methods() );
59 }
60 
61 ValueBinding::~ValueBinding()
62 {
63  delete m_value;
64 }
65 
66 KJS::UString ValueBinding::toString(KJS::ExecState *exec) const
67 {
68  Q_UNUSED(exec);
69  return m_value->type().name();
70 }
71 
72 //kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;
KJSEmbed::ValueFactory::ValueMethods
static const Method ValueMethods[]
Definition: value_binding.h:96
KJSEmbed::ValueBinding::toString
KJS::UString toString(KJS::ExecState *exec) const
Definition: value_binding.cpp:66
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::ProxyBinding
Definition: binding_support.h:247
KJSEmbed::ValueBinding::ValueBinding
ValueBinding(KJS::ExecState *exec, const char *typeName, T val)
Definition: value_binding.h:107
callValueType
KJS::JSValue * callValueType(KJS::ExecState *exec, KJS::JSObject *self, const KJS::List &args)
Definition: value_binding.cpp:29
KJSEmbed::ValueBinding::~ValueBinding
virtual ~ValueBinding()
Definition: value_binding.cpp:61
KJSEmbed::ValueBinding
Value binding implementation.
Definition: value_binding.h:103
KJSEmbed::Method
Method structure.
Definition: binding_support.h:294
KJSEmbed::ValueBinding::className
KJS::UString className() const
Definition: value_binding.h:118
value_binding.h
KJSEmbed::ValueFactory::methods
static const Method * methods()
Definition: value_binding.cpp:48
KJS::jsString
KJS::JSCell * jsString(const QString &s)
Definition: kjseglobal.h:73
KJSEmbed::ValueBinding::info
static const KJS::ClassInfo info
Definition: value_binding.h:152
List
Definition: variant_binding.cpp:130
static_binding.h
PointerBase::type
virtual const std::type_info & type() const =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