return ""; // not initialized
return TCollection_AsciiString(myString->Get()).ToCString();
}
-std::wstring Model_AttributeString::valueW()
+char16_t* Model_AttributeString::valueU()
{
- if (myString.IsNull())
- return std::wstring(L""); // not initialized
- return std::wstring((wchar_t*)(myString->Get().ToExtString()));
+ if (myString.IsNull()) { // not initialized
+ static TCollection_ExtendedString anEmpty;
+ return (char16_t*)(anEmpty.ToExtString());
+ }
+ return (char16_t*)(myString->Get().ToExtString());
}
Model_AttributeString::Model_AttributeString(TDF_Label& theLabel)
/// Returns the std::string value
MODEL_EXPORT virtual std::string value();
- /// Returns the std::wstring value
- MODEL_EXPORT virtual std::wstring valueW();
+ /// Returns a pointer to Unicode string
+ MODEL_EXPORT virtual char16_t* valueU();
protected:
/// Initializes attributes
/// Returns the string value
MODELAPI_EXPORT virtual std::string value() = 0;
- /// Returns the wstring value
- MODELAPI_EXPORT virtual std::wstring valueW() = 0;
+ /// Returns a pointer to Unicode string
+ MODELAPI_EXPORT virtual char16_t* valueU() = 0;
/// Returns the type of this class of attributes
MODELAPI_EXPORT static std::string typeId()
DataPtr aData = myFeature->data();
AttributeStringPtr aStringAttr = aData->string(attributeID());
- std::wstring aUtfStr = aStringAttr->valueW();
- QString aNewText = QString::fromStdWString(aUtfStr);
+ char16_t* aStr = aStringAttr->valueU();
+ QString aNewText = QString::fromUtf16(aStr);
if (myPathField->text() != aNewText) {
bool isBlocked = myPathField->blockSignals(true);
myPathField->setText(aNewText);