ProteoWizard
Functions
pwiz::msdata::id Namespace Reference

Functions

PWIZ_API_DECL std::map< std::string, std::string > parse (const std::string &id)
 parses an id string into a map<string,string> More...
 
PWIZ_API_DECL std::string value (const std::string &id, const std::string &name)
 convenience function to extract a named value from an id string More...
 
template<typename value_type >
value_type valueAs (const std::string &id, const std::string &name)
 templated convenience function to extract a named value from an id string More...
 
PWIZ_API_DECL CVID getDefaultNativeIDFormat (const MSData &msd)
 returns the nativeID format from the defaultSourceFilePtr if set, or from sourceFilePtrs[0] if the list isn't empty, or CVID_Unknown More...
 
PWIZ_API_DECL std::string translateScanNumberToNativeID (CVID nativeIDFormat, const std::string &scanNumber)
 translates a "scan number" to a string that is correct for the given nativeID format; semantic validity requires that scanNumber be parseable as an integer; some nativeID formats cannot be translated to and will always return an empty string currently supported formats: Thermo, Bruker/Agilent YEP, Bruker BAF, mzXML, MGF, and mzData More...
 
PWIZ_API_DECL std::string translateNativeIDToScanNumber (CVID nativeIDFormat, const std::string &id)
 translates a nativeID in the given nativeID format to a simple integer "scan number"; some nativeID formats cannot be translated from and will always return an empty string currently supported formats: Thermo, Bruker/Agilent YEP, Bruker BAF, mzXML, MGF, and mzData More...
 
PWIZ_API_DECL std::string abbreviate (const std::string &id, char delimiter='.')
 abbreviates a nativeID ("name1=value1 name2=value2" translates to "value1.value2") More...
 

Function Documentation

§ parse()

PWIZ_API_DECL std::map<std::string,std::string> pwiz::msdata::id::parse ( const std::string &  id)

parses an id string into a map<string,string>

Referenced by demo(), test(), testBadXML(), testDone(), testIDParsing(), testNested(), and testNoAutoUnescape().

§ value()

PWIZ_API_DECL std::string pwiz::msdata::id::value ( const std::string &  id,
const std::string &  name 
)

§ valueAs()

template<typename value_type >
value_type pwiz::msdata::id::valueAs ( const std::string &  id,
const std::string &  name 
)

templated convenience function to extract a named value from an id string

Definition at line 922 of file MSData.hpp.

References abbreviate(), getDefaultNativeIDFormat(), boost::lexical_cast(), PWIZ_API_DECL, translateNativeIDToScanNumber(), translateScanNumberToNativeID(), and value().

923 {
924  std::string result = value(id, name);
925  return !result.empty() ? boost::lexical_cast<value_type>(result)
926  : boost::lexical_cast<value_type>(0);
927 }
float lexical_cast(const std::string &str)
PWIZ_API_DECL std::string value(const std::string &id, const std::string &name)
convenience function to extract a named value from an id string

§ getDefaultNativeIDFormat()

PWIZ_API_DECL CVID pwiz::msdata::id::getDefaultNativeIDFormat ( const MSData msd)

returns the nativeID format from the defaultSourceFilePtr if set, or from sourceFilePtrs[0] if the list isn't empty, or CVID_Unknown

Referenced by valueAs().

§ translateScanNumberToNativeID()

PWIZ_API_DECL std::string pwiz::msdata::id::translateScanNumberToNativeID ( CVID  nativeIDFormat,
const std::string &  scanNumber 
)

translates a "scan number" to a string that is correct for the given nativeID format; semantic validity requires that scanNumber be parseable as an integer; some nativeID formats cannot be translated to and will always return an empty string currently supported formats: Thermo, Bruker/Agilent YEP, Bruker BAF, mzXML, MGF, and mzData

Referenced by testIDParsing(), and valueAs().

§ translateNativeIDToScanNumber()

PWIZ_API_DECL std::string pwiz::msdata::id::translateNativeIDToScanNumber ( CVID  nativeIDFormat,
const std::string &  id 
)

translates a nativeID in the given nativeID format to a simple integer "scan number"; some nativeID formats cannot be translated from and will always return an empty string currently supported formats: Thermo, Bruker/Agilent YEP, Bruker BAF, mzXML, MGF, and mzData

Referenced by testIDParsing(), and valueAs().

§ abbreviate()

PWIZ_API_DECL std::string pwiz::msdata::id::abbreviate ( const std::string &  id,
char  delimiter = '.' 
)

abbreviates a nativeID ("name1=value1 name2=value2" translates to "value1.value2")

Referenced by testIDParsing(), and valueAs().