Page tree
Skip to end of metadata
Go to start of metadata

void FB::JSAPIAuto::SetProperty ( int  idx,
const variant value 
)
virtual

Sets the value of an indexed property.

This can be used for providing array-style access on your object. For example, the following will result in a call to SetProperty with idx = 12:

document.getElementById("plugin")[12] = "property value";
Parameters
idxZero-based index of the property to set the value of.
valueThe new property value.

Implements FB::JSAPI.

Definition at line 299 of file JSAPIAuto.cpp.

300 {
301  if (!m_valid)
302  throw object_invalidated();
303 
304  boost::recursive_mutex::scoped_lock lock(m_zoneMutex);
305 
306  std::string id(boost::lexical_cast<std::string>(idx));
307  if (m_allowDynamicAttributes || (m_attributes.find(id) != m_attributes.end() && !m_attributes[id].readonly)) {
308  registerAttribute(id, value);
309  } else {
310  throw invalid_member(FB::variant(idx).convert_cast<std::string>());
311  }
312 }
virtual void registerAttribute(const std::string &name, const FB::variant &value, bool readonly=false)
Registers an attribute name and sets the value to _value. Optionally read-only.
Definition: JSAPIAuto.cpp:383
Accepts any datatype, used in all interactions with javascript. Provides tools for getting back out t...
Definition: variant.h:198
  • No labels