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

kjsembed

  • kjsembed
  • kjsembed
util.h
Go to the documentation of this file.
1#ifndef UTIL_H
2#define UTIL_H
3
4namespace KJSEmbed
5{
6 bool isBasic(KJS::JSValue *value)
7 {
8 switch (value->type())
9 {
10 case KJS::NumberType:
11 case KJS::BooleanType:
12 case KJS::StringType:
13 return true;
14 break;
15 default:
16 return false;
17
18 }
19 }
20
21
22 bool isVariant(KJS::JSObject *object)
23 {
24 return object->inherits(&VariantBinding::info);
25 }
26
27 /*bool isValue(KJS::JSObject *object)
28 {
29 return object->inherits(&ValueBinding::info);
30}*/
31
32 bool isObject(KJS::JSObject *object)
33 {
34 return object->inherits(&ObjectBinding::info);
35 }
36
37/*
38So this might be how the val checking would go:
39 JSValue *arg = args[0];
40 if (isBasic(arg))
41 {
42 switch (arg->type())
43 {
44 case KJS::Number:
45 extractInt...;
46 break;
47 case KJS::String:
48 extractString...;
49 break;
50 case KJS::Boolean:
51 extractBool...;
52 break;
53 default: hmmm
54 }
55 }
56 else
57 {
58 JSObject *object = arg->toObject(exec);
59 if (isValue(object))
60 {
61 extractValue...
62 }
63 else if (isObject(object))
64 {
65 extractObject...
66 }
67 else
68 {
69 hmmm
70 }
71 }
72
73
74
75
76*/
77
78}
79
80
81#endif
82
83//kate: indent-spaces on; indent-width 4; replace-tabs on; indent-mode cstyle;
84
KJSEmbed::ObjectBinding::info
static const KJS::ClassInfo info
Definition: object_binding.h:92
KJSEmbed::VariantBinding::info
static const KJS::ClassInfo info
Definition: variant_binding.h:123
KJSEmbed
Definition: application.h:33
KJSEmbed::isBasic
bool isBasic(KJS::JSValue *value)
Definition: util.h:6
KJSEmbed::isVariant
bool isVariant(KJS::JSObject *object)
Definition: util.h:22
KJSEmbed::isObject
bool isObject(KJS::JSObject *object)
Definition: util.h:32
value
QVariant value
Definition: settings.cpp:35
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