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

public virtual void FB::JSAPIAuto::setAttribute ( const std::string &  name,
const FB::variant value 
)
virtual

Assigns a value to the specified attribute, if it is not reserved or read-only.

Parameters
namename of the attribute to set
valuevalue for the attribute
Since
1.4a3
See Also
registerAttribute
getAttribute
removeAttribute

Definition at line 414 of file JSAPIAuto.cpp.

415 {
416  AttributeMap::iterator fnd = m_attributes.find(name);
417  if (fnd == m_attributes.end() || !fnd->second.readonly) {
418  Attribute attr = {value, false};
419  m_attributes[name] = attr;
420  m_zoneMap[name] = getZone();
421  } else {
422  throw FB::script_error("Cannot set read-only property " + name);
423  }
424 }
Exception type; when thrown in a JSAPI method, a javascript exception will be thrown.
Definition: JSExceptions.h:28
virtual SecurityZone getZone() const
Gets the currently active zone.
Definition: JSAPIImpl.h:238
  • No labels