Skip to end of metadata
Go to start of metadata

FB::variant FB::JSAPIAuto::GetProperty ( int  idx  )  [virtual]

Gets 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 GetProperty with idx = 12:

       var i = document.getElementById("plugin")[12];
Parameters:
idx Zero-based index of the property to get the value of.
Returns:
The property value.

Implements FB::JSAPI.

Definition at line 274 of file JSAPIAuto.cpp.

00275 {
00276     boost::recursive_mutex::scoped_lock lock(m_zoneMutex);
00277     if(!m_valid)
00278         throw object_invalidated();
00279 
00280     std::string id = boost::lexical_cast<std::string>(idx);
00281     AttributeMap::iterator fnd = m_attributes.find(id);
00282     if (fnd != m_attributes.end() && memberAccessible(m_zoneMap.find(id)))
00283         return fnd->second.value;
00284     else if (m_allowDynamicAttributes) {
00285         return FB::FBVoid(); // If we allow dynamic attributes then we need to
00286                              // return void if the property doesn't exist;
00287                              // otherwise checking a property will throw an exception
00288     } else {
00289         throw invalid_member(boost::lexical_cast<std::string>(idx));
00290     }
00291 
00292     // This method should be overridden to access properties in an array style from javascript,
00293     // i.e. var value = pluginObj[45]; would call GetProperty(45)
00294     // Default is to throw "invalid member" unless m_attributes has something matching
00295 }


Generated on 20 Jun 2013 for FireBreath by  doxygen 1.6.1
Labels
  • None