std::string DtaSAX2Handler::generateFoutName( int charge )
{
std::string foutName;
std::string::size_type len;
std::string::size_type pos;
foutName = m_fileName;
pos = foutName.rfind("/") + 1; // If file name was given with
// path let's get rid of it
len = foutName.size() - pos - 6; // We don't wan't the ending ".xml"
foutName = foutName.substr( pos , len );
if( charge == 0 ) // We use this special cas to get just the fileName
{ // without nrs. So that we can use as our dirName
return foutName;
}
std::stringstream sout;
std::string chargeStr; // Convert charge from int to string
sout << charge;
chargeStr = sout.str();
sout.clear(); // Clear errors
sout.str(""); // Clean stream and we are ready to use it again
std::string startScan;
std::string endScan;
sout.fill('0');
sout.width(4);
sout << m_scanNum;
sout >> startScan;
endScan = startScan; // For the moment we don't integrate multiple spectra
foutName = foutName + "." + startScan + "." + endScan + "." + chargeStr + ".dta";