LIB3MFMETHODIMP CCOMModelWriter::WriteToFileUTF8(_In_z_ LPCSTR pwszFilename) { try { if (pwszFilename == nullptr) throw CNMRException(NMR_ERROR_INVALIDPOINTER); if (m_pModelWriter.get() == nullptr) throw CNMRException(NMR_ERROR_RESOURCENOTFOUND); // Convert to UTF16 std::string sUTF8FileName(pwszFilename); std::wstring sUTF16FileName = fnUTF8toUTF16(sUTF8FileName); PExportStream pStream = fnCreateExportStreamInstance(sUTF16FileName.c_str()); m_pModelWriter->exportToStream(pStream); return handleSuccess(); } catch (CNMRException_Windows & WinException) { return handleNMRException(&WinException); } catch (CNMRException & Exception) { return handleNMRException(&Exception); } catch (...) { return handleGenericException(); } }
LIB3MFMETHODIMP CCOMModelWriter::WriteToFile(_In_z_ LPCWSTR pwszFilename) { if (pwszFilename == nullptr) return LIB3MF_POINTER; if (m_pModelWriter.get() == nullptr) return LIB3MF_FAIL; try { PExportStream pStream = fnCreateExportStreamInstance(pwszFilename); m_pModelWriter->exportToStream(pStream); return LIB3MF_OK; } catch (CNMRException_Windows & WinException) { return WinException.getHResult(); } catch (...) { return LIB3MF_FAIL; } }
LIB3MFMETHODIMP CCOMModelWriter::WriteToFile(_In_z_ LPCWSTR pwszFilename) { try { if (pwszFilename == nullptr) throw CNMRException(NMR_ERROR_INVALIDPOINTER); if (m_pModelWriter.get() == nullptr) throw CNMRException(NMR_ERROR_RESOURCENOTFOUND); PExportStream pStream = fnCreateExportStreamInstance(pwszFilename); m_pModelWriter->exportToStream(pStream); return handleSuccess(); } catch (CNMRException_Windows & WinException) { return handleNMRException(&WinException); } catch (CNMRException & Exception) { return handleNMRException(&Exception); } catch (...) { return handleGenericException(); } }