Revision 7373770e src/common/Attribute.cc

View differences:

src/common/Attribute.cc
301 301

  
302 302
/* -------------------------------------------------------------------------- */
303 303
/* -------------------------------------------------------------------------- */
304

  
305
string VectorAttribute::vector_value_str(const char *name, float& value) const
306
{
307
    map<string,string>::const_iterator it;
308

  
309
    it = attribute_value.find(name);
310

  
311
    if ( it == attribute_value.end() )
312
    {
313
        value = -1;
314
        return  "";
315
    }
316

  
317
    if ( it->second.empty() )
318
    {
319
        value = -1;
320
        return "";
321
    }
322

  
323
    istringstream iss(it->second);
324
    iss >> value;
325

  
326
    if (iss.fail() || !iss.eof())
327
    {
328
        value = -1;
329
        return "";
330
    }
331

  
332
    return it->second;
333
}
334

  
335
/* -------------------------------------------------------------------------- */
336
/* -------------------------------------------------------------------------- */

Also available in: Unified diff