MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / toString

Method toString

src/openms/source/DATASTRUCTURES/DataValue.cpp:721–755  ·  view source on GitHub ↗

Convert DataValues to String

Source from the content-addressed store, hash-verified

719
720 // Convert DataValues to String
721 String DataValue::toString(bool full_precision) const
722 {
723 std::stringstream ss;
724 switch (value_type_)
725 {
726 case DataValue::EMPTY_VALUE:
727 break;
728 case DataValue::STRING_VALUE:
729 return *(data_.str_);
730 case DataValue::STRING_LIST: ss << *(data_.str_list_);
731 break;
732 case DataValue::INT_LIST: ss << *(data_.int_list_);
733 break;
734 case DataValue::DOUBLE_LIST:
735 if (full_precision)
736 {
737 ss << *(data_.dou_list_);
738 }
739 else
740 {
741 ss << VecLowPrecision<double>(*(data_.dou_list_));
742 }
743 break;
744
745 case DataValue::INT_VALUE:
746 return String(data_.ssize_);
747 case DataValue::DOUBLE_VALUE:
748 return String(data_.dou_, full_precision);
749
750 default:
751 throw Exception::ConversionError(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION,
752 "Could not convert DataValue of type '" + NamesOfDataType[value_type_] + "' to String");
753 }
754 return ss.str();
755 }
756
757 QString DataValue::toQString() const
758 {

Callers 7

toCharMethod · 0.95
toStringListMethod · 0.95
toIntListMethod · 0.95
toDoubleListMethod · 0.95
toBoolMethod · 0.95
testDataValueFunction · 0.95
DataValue.cppFile · 0.45

Calls 1

StringClass · 0.50

Tested by 1

testDataValueFunction · 0.76