Request for Changes-6: Helper functions for string operations using boost

From OTBWiki
Jump to: navigation, search

[Request for Changes - 6] Helper functions for string operations using boost

Status

Summary

specialize boost lexical_cast for primitive types and two split functions to string.

Rationale

boost::lexical_cast is used in many places directly in OTB. For example see this class. This RFC propose to avoid usage of boost string operations directly in OTB headers. All string based operations such as lexical_cast(convert string), split string to vector, split to key-value pairs must be used via otbStringUtils.h

Implementation details

otbStringUtils.h is implemented in Adapters/BoostAdapters. This will help to remove direct dependency to OTBBoost in OTBGDALIO, OTBMetadata modules

Classes and files

  • Modules/Adapters/BoostAdapters/otbStringUtils.h


The below function are included in this header :

  • specialized lexical_cast for int, float, double.
  • ConvertStringToVector - convert a string to vector. used in parsing date time from UTC string. see this class. The same is repeated in other ImageMetadataInterface classes
  • SplitStringToSingleKeyValue - split a string to key, val with a delimiter. This is again useful to parsing metadata

Applications

None

Tests

None

Documentation

The functions are adequately commented in the header.

Additional notes

None