//-------------------------------------------------------------------// // DisplayControlValue() // //-------------------------------------------------------------------// // Here, we set the control to contain the data in our current // record set var. // Note that we specifically bypass saving of changes. We call this // function when changing the master record, when changing the // master, etc., so we are not necessarily in need of saving. //-------------------------------------------------------------------// void ListDataLongEdit::DisplayControlValue() { m_bBypassChangesSave = true; SetWindowText( strOutput( *pDatabaseVar ) ); m_bBypassChangesSave = false; }
// Translate a true ANSI string to the UTF-16 equivalent (reencode+convert) std::wstring SharedUtil::ANSIToUTF16 ( const std::string& input ) { size_t len = mbstowcs ( NULL, input.c_str(), input.length() ); if ( len == (size_t)-1 ) return L"?"; wchar_t* wcsOutput = new wchar_t[len+1]; mbstowcs ( wcsOutput, input.c_str(), input.length() ); wcsOutput[len] = NULL; //Null terminate the string std::wstring strOutput(wcsOutput); delete [] wcsOutput; return strOutput; }
std::string GuiText::toUTF8(void) const { if(!text) return std::string(); char *pUtf8 = FreeTypeGX::wideCharToUTF8(text); if(!pUtf8) return std::string(); std::string strOutput(pUtf8); delete [] pUtf8; return strOutput; }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------ std::string CreateSTDStringFromJByteArray(jbyteArray in_array, u32 in_length) { if (in_array == nullptr || in_length == 0) { return ""; } auto environment = JavaVirtualMachine::Get()->GetJNIEnvironment(); jbyte* bytes = environment->GetByteArrayElements(in_array, JNI_FALSE); CS_ASSERT(bytes != nullptr, "Bytes returned by GetByteArrayElements() cannot be null."); std::string strOutput((const char*)bytes, in_length); environment->ReleaseByteArrayElements(in_array, bytes, 0); return strOutput; }
CString ListDataLongEdit::GetAltVarAsString() { return strOutput( *pAltDatabaseVar ); }
//-------------------------------------------------------------------// // GetValueAsString() // //-------------------------------------------------------------------// //-------------------------------------------------------------------// CString ListDataLongEdit::GetValueAsString() { return strOutput( CurrentMultiValue ); }
CAString CAString::substr(size_t offset, size_t count) const { CTString<char> str = substrT(offset, count); CAString strOutput(str.ptr()); return strOutput; }