Advertisement
voidpointer

Untitled

May 8th, 2014
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.98 KB | None | 0 0
  1.  
  2. ///////////////////////////////////////////////////////////////////////////////
  3. /// \details
  4. /// Will throw if version data is invalid. More than MAX_COMPONENTS are
  5. /// automatically truncated and not treated as errors. Missing components are
  6. /// initialized to 0.
  7. ///
  8. /// \param version
  9. ///      The version to deserialize into individual integral components.
  10. ///////////////////////////////////////////////////////////////////////////////
  11. void CVersionNumber::DeserializeString(std::string const& version)
  12. {
  13.    std::vector<std::string> components;
  14.    boost::split(components, version, boost::is_any_of("."));
  15.  
  16.    // Resize the split components. If we have more components than supported,
  17.    // the excess components are truncated. If we have too few, each is
  18.    // initialized to 0.
  19.    components.resize(m_version.size(), "0");
  20.  
  21.    std::transform(
  22.       components.begin(),
  23.       components.end(),
  24.       m_version.begin(),
  25.       &boost::lexical_cast<unsigned, std::string>);
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement