/usr/include/Wt/WJavaScriptExposableObject is in libwt-dev 3.3.6+dfsg-1.1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | // This may look like C code, but it's really -*- C++ -*-
/*
* Copyright (C) 2015 Emweb bvba, Herent, Belgium.
*
* See the LICENSE file for terms of use.
*/
#ifndef WJAVASCRIPT_EXPOSABLE_OBJECT_H_
#define WJAVASCRIPT_EXPOSABLE_OBJECT_H_
#include <Wt/WDllDefs.h>
#include <string>
#include <vector>
namespace Wt {
class WJavaScriptObjectStorage;
class WPaintedWidget;
namespace Json {
class Value;
}
/*! \class WJavaScriptExposableObject Wt/WJavaScriptExposableObject
* \brief A JavaScript exposable object
*
* A JavaScript bound object (as opposed to being mostly
* a simple value class) has an equivalent representation
* in JavaScript. Its value can usually only be modified
* through a WJavaScriptHandle. There are certain exceptions
* to this rule. Some methods, notably many WTransform methods,
* will correctly apply these modifications also on the JavaScript
* representation.
*
* \sa WJavaScriptHandle
*/
class WT_API WJavaScriptExposableObject {
public:
WJavaScriptExposableObject();
WJavaScriptExposableObject(const WJavaScriptExposableObject &other);
#ifndef WT_TARGET_JAVA
WJavaScriptExposableObject &operator=(const WJavaScriptExposableObject &rhs);
#endif
#ifdef WT_TARGET_JAVA
virtual WJavaScriptExposableObject clone() const = 0;
#endif
/*! \brief Returns whether this object is JavaScript bound.
*
* An object is JavaScript bound if it is associated with a
* WJavaScriptHandle. It should not be modified directly
* on the server side. WJavaScriptHandle::setValue() should
* be used instead.
*/
bool isJavaScriptBound() const;
virtual ~WJavaScriptExposableObject();
/*! \brief Returns a JavaScript representation of the value of this object.
*
* \note The value returned will reflect the current server side value
* of the object. If this object is JavaScript bound, this value
* may not reflect the actual client side value. If you need access
* to the client side value, use jsRef() intead.
*/
virtual std::string jsValue() const = 0;
/*! \brief Returns a JavaScript reference to this object.
*
* If this object is not JavaScript bound, it will return
* a JavaScript representation of the value of the object,
* according to jsValue().
*
* \warning This reference is intended as read-only. Attempts
* to modify it may have unintended consequences.
* If you want a JavaScript reference that is modifiable,
* use the \link WJavaScriptHandle::jsRef() jsRef of the
* handle\endlink instead.
*/
std::string jsRef() const;
protected:
bool sameBindingAs(const WJavaScriptExposableObject &rhs) const;
void assignBinding(const WJavaScriptExposableObject &rhs);
void assignBinding(const WJavaScriptExposableObject &rhs, const std::string &jsRef);
// Checks if this object is JavaScript bound,
// if it is, it will throw an exception.
void checkModifiable();
virtual void assignFromJSON(const Json::Value &value) = 0;
private:
template<typename T> friend class WJavaScriptHandle;
friend class WJavaScriptObjectStorage;
struct JSInfo {
JSInfo(WJavaScriptObjectStorage *context, const std::string &jsRef);
JSInfo(const JSInfo &other);
JSInfo &operator=(const JSInfo &rhs);
bool operator==(const JSInfo &rhs) const;
WJavaScriptObjectStorage *context_;
std::string jsRef_;
};
JSInfo *clientBinding_;
};
}
#endif // WJAVASCRIPT_EXPOSABLE_OBJECT_H_
|