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

template<class Dict >
void FB::JSObject::GetObjectValues ( const FB::JSObjectPtr src,
Dict &  dst 

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

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;
192  if (!src) return;
193  try {
194  StringVec fields;
195  src->getMemberNames(fields);
196  std::insert_iterator<Dict> inserter(dst, dst.begin());
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:

  • No labels