Parse a string list--either a single string or an array of strings is permitted.
| 272 | #ifdef USE_SPICE |
| 273 | // Parse a string list--either a single string or an array of strings is permitted. |
| 274 | static bool |
| 275 | ParseStringList(Hash* table, |
| 276 | const string& propertyName, |
| 277 | list<string>& stringList) |
| 278 | { |
| 279 | Value* v = table->getValue(propertyName); |
| 280 | if (v == NULL) |
| 281 | return NULL; |
| 282 | |
| 283 | // Check for a single string first. |
| 284 | if (v->getType() == Value::StringType) |
| 285 | { |
| 286 | stringList.push_back(v->getString()); |
| 287 | return true; |
| 288 | } |
| 289 | else if (v->getType() == Value::ArrayType) |
| 290 | { |
| 291 | Array* array = v->getArray(); |
| 292 | Array::const_iterator iter; |
| 293 | |
| 294 | // Verify that all array entries are strings |
| 295 | for (iter = array->begin(); iter != array->end(); iter++) |
| 296 | { |
| 297 | if ((*iter)->getType() != Value::StringType) |
| 298 | return false; |
| 299 | } |
| 300 | |
| 301 | // Add strings to stringList |
| 302 | for (iter = array->begin(); iter != array->end(); iter++) |
| 303 | stringList.push_back((*iter)->getString()); |
| 304 | |
| 305 | return true; |
| 306 | } |
| 307 | else |
| 308 | { |
| 309 | return false; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | |
| 314 | /*! Create a new SPICE orbit. This is just a Celestia wrapper for a trajectory specified |