FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
template<class Dict >
void FB::JSObject::GetObjectValues ( const FB::JSObjectPtr src,
Dict &  dst 
)
static

Gets object values out of the javscript object src and adds them to the STL Dict container dst.

Parameters
srcSource for the.
[in,out]dstDestination for the.

Definition at line 185 of file JSObject.h.

References FB::variant::convert_cast().

186  {
187  typedef typename Dict::key_type KeyType;
188  typedef typename Dict::mapped_type MappedType;
189  typedef std::pair<KeyType, MappedType> PairType;
190  typedef std::vector<std::string> StringVec;
191 
192  if (!src) return;
193  try {
194  StringVec fields;
195  src->getMemberNames(fields);
196  std::insert_iterator<Dict> inserter(dst, dst.begin());
197 
198  for(StringVec::iterator it = fields.begin(); it != fields.end(); it++) {
199  FB::variant tmp = src->GetProperty(*it);
200  *inserter++ = PairType(*it, tmp.convert_cast<MappedType>());
201  }
202  } catch (const FB::script_error& e) {
203  throw e;
204  }
205  }
const T convert_cast() const
Converts the stored value to the requested type if possible and returns the resulting value...
Definition: variant.h:667
Accepts any datatype, used in all interactions with javascript. Provides tools for getting back out t...
Definition: variant.h:198
Exception type; when thrown in a JSAPI method, a javascript exception will be thrown.
Definition: JSExceptions.h:28

Here is the call graph for this function: