void CRichEditCtrlGS::WriteRTF(const CString strFilename, const bool bAsRTF/*=true*/ ) { SCookieFile CookieRTF; CFileStatus fileStatus; CString strRTF = _T(""); CookieRTF.lStart = 0; CookieRTF.pFilename = &strFilename; // Close all filehandles if( CFile::hFileNull != CookieRTF.fileInText.m_hFile ) { CookieRTF.fileInText.Close(); } if( CFile::hFileNull != CookieRTF.fileOutText.m_hFile ) { CookieRTF.fileOutText.Close(); } if( !CookieRTF.fileOutText.Open( *CookieRTF.pFilename,CFile::modeCreate | CFile::modeReadWrite | CFile::typeBinary ) ) { AfxMessageBox(AFX_IDP_FAILED_TO_SAVE_DOC); return; // File could not be opened for saving } CookieRTF.fileOutText.SeekToBegin(); EDITSTREAM es; es.dwError = 0; es.pfnCallback = StreamOutCFile; // Set the callback es.dwCookie = (DWORD)&CookieRTF; // and the informations if( bAsRTF ) { StreamOut(SF_RTF,es); } else { StreamOut(SF_TEXT,es); } CookieRTF.fileOutText.Close(); }
//保存消息 bool CSkinRichEdit::SaveMessage(LPCTSTR pszFileName) { //变量定义 CString strFileName=pszFileName; //打开文件 if (strFileName.IsEmpty()==true) { CFileDialog FileDlg(FALSE,TEXT("RTF"),0,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,TEXT("信息文件(*.RTF)|*.RTF||"),this); if (FileDlg.DoModal()==IDOK) strFileName=FileDlg.GetPathName(); else return true; } //打开文件 CFile File; if (File.Open(strFileName,CFile::modeWrite|CFile::modeCreate,NULL)==FALSE) return false; //构造数据 EDITSTREAM EditStream; EditStream.pfnCallback=SaveCallBack; EditStream.dwCookie=(DWORD)(LONGLONG)(&File); //写入文件 StreamOut(SF_RTF,EditStream); return true; }
std::ostream& RandomProbabilities::put_out(std::ostream& os) const { os << *name_ << ":"; for_each(pt_.begin(), pt_.end(), StreamOut(os, ",", "")); return os; }
void CRichEditStream::GetRTFText(CStringA& rstrText) { EDITSTREAM es = {0}; es.pfnCallback = StreamOutCallback; es.dwCookie = (DWORD_PTR)&rstrText; StreamOut(SF_RTF, es); }
int SoftSynthMIDIDevice::StreamOutSync(MIDIHDR *header) { CritSec.Enter(); StreamOut(header); CritSec.Leave(); return 0; }
int OPLMIDIDevice::StreamOutSync(MIDIHDR *header) { ChipAccess.Enter(); StreamOut(header); ChipAccess.Leave(); return 0; }
ostream& operator<<(ostream& os, const DirichletDistribution& dd) { for_each(dd.parameters_.begin(), dd.parameters_.end(), StreamOut(os, " ", "")); return os << "\n"; }
void TiXmlComment::FormattedStreamOut(TIXML_OSTREAM * stream, int depth) const { StreamDepth(stream, depth); StreamOut(stream); (*stream) << TIXML_ENDL; }
void CRichEditCtrlGS::GetRTF(CByteArray& arrText, const bool bAsRTF/*=true*/) { SCookieByteArray CookieRTF; arrText.RemoveAll(); CookieRTF.lSize = 0; CookieRTF.lStart = 0; CookieRTF.pInText = NULL; CookieRTF.pOutText = &arrText; // Pull the text out EDITSTREAM es; es.dwError = 0; es.pfnCallback = StreamOutCByteArray; // Set the callback es.dwCookie = (DWORD)&CookieRTF; // and the informations if( bAsRTF ) { StreamOut(SF_RTF,es); } else { StreamOut(SF_TEXT,es); } }
void CRichEditCtrlGS::GetRTF(CString& strText,const bool bAsRTF/*=true*/) { SCookieString CookieRTF; strText.Empty(); CookieRTF.lSize = 0; CookieRTF.lStart = 0; CookieRTF.pInText = NULL; CookieRTF.pOutText = &strText; // Pull the text out EDITSTREAM es; es.dwError = 0; es.pfnCallback = StreamOutCString; // Set the callback es.dwCookie = (DWORD)&CookieRTF; // and the informations if( bAsRTF ) { StreamOut(SF_RTF,es); } else { StreamOut(SF_TEXT,es); } return; }
void CPickup::SetValue(unsigned int uiValue) { m_uiValue = uiValue; // Are we streamed in? if(IsStreamedIn()) { // Stream ourselves out and back in StreamOut(); StreamIn(); } }
void CPickup::SetRotation(const CVector3& vecRotation) { m_vecRotation = vecRotation; // Are we streamed in? if(IsStreamedIn()) { // Stream ourselves out and back in StreamOut(); StreamIn(); } }
CString CAutoRichEditCtrl::GetRTF() { // Return the RTF string of the text in the control. // Stream out here. EDITSTREAM es; es.dwError = 0; es.pfnCallback = CBStreamOut; // Set the callback CString sRTF = _T(""); es.dwCookie = (DWORD) &sRTF; // so sRTF receives the string StreamOut(SF_RTF, es); // Call CRichEditCtrl::StreamOut to get the string. /// return sRTF; }
bool CScriptEditView::SaveFile( LPCTSTR szFilePath ) { ATLASSERT( szFilePath != NULL && szFilePath[0] != 0 ); DWORD dwFlag = FILE_ATTRIBUTE_ARCHIVE | FILE_FLAG_SEQUENTIAL_SCAN; HANDLE hFile = ::CreateFile( szFilePath, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, dwFlag, NULL ); if( hFile == INVALID_HANDLE_VALUE ) return false; EDITSTREAM es; es.dwCookie = reinterpret_cast<DWORD_PTR>(hFile); es.dwError = 0; es.pfnCallback = StreamWriteCallback; StreamOut( SF_TEXT, es ); ::CloseHandle( hFile ); return es.dwError == 0; }
bool CClientVehicle::SetModel(int iModelIndex) { // Is the model index different from our current model index? if(iModelIndex != m_pModelInfo->GetIndex()) { // Get the new model info CIVModelInfo * pNewModelInfo = g_pClient->GetGame()->GetModelInfo(iModelIndex); // Is the new model info valid? if(!pNewModelInfo || !pNewModelInfo->IsValid() || !pNewModelInfo->IsVehicle()) { CLogFile::Printf("CClientVehicle::SetModel Failed (Invalid model)!"); return false; } bool bSpawned = IsSpawned(); // Are we spawned? if(bSpawned) { // Destroy the old vehicle StreamOut(); } // Set the new model info m_pModelInfo = pNewModelInfo; // Are we spawned? if(bSpawned) { // Ensure the new model is loaded m_pModelInfo->Load(); // Create the new vehicle StreamIn(); } return true; } return false; }
CClientMarker::~CClientMarker ( void ) { // Unlink Unlink (); // Make sure nothing is still referencing us m_pManager->UnreferenceEntity ( this ); // Remove the colshape if ( m_pCollision ) delete m_pCollision; // Stream out first so the element counter is correct StreamOut (); if ( m_pMarker ) { // Destroy the marker class delete m_pMarker; m_pMarker = NULL; } }
/* defWndProc - default window proc * * Handles most common operations */ VOID PASCAL INTERNAL defWndProc (HW hWnd, INT command, WDATA data) { INT width = TWINWIDTH (hWnd); INT height = TWINHEIGHT (hWnd); switch (command) { /* Paint a line on the screen. If there's a content area and * the line to be painted is within the screen, output it * from the content area */ case PAINT: if (hWnd->pContent != NULL) if ((INT)data < height) WzTextOut (hWnd, 0, (INT)data, hWnd->pContent + data * width, width, DefNorm); break; case CLOSE: if (hWnd->pContent) PoolFree (hWnd->pContent); break; case DISPLAY: SendMessage (hWnd, DISPLAYSTR, data); SendMessage (hWnd, DISPLAYSTR, strCRLF); break; case DISPLAYSTR: StreamOut ( hWnd, (PSTR) data, strlen ((PSTR) data), DefNorm); break; case REGENCONT: if (hWnd->pContent != NULL) Fill (hWnd->pContent, ' ', height * width); break; default: break; } }
void LogViewRE::SaveAs() { CString sFilename; FileType aType; if (!FileDialog::GetSaveAsFilename(GetParent(), sFilename, aType)) { return; } CAtlFile file; HRESULT hr = file.Create(sFilename, GENERIC_WRITE, FILE_SHARE_WRITE, CREATE_ALWAYS); if (FAILED(hr)) { CString s, sErr; ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, hr, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), sErr.GetBuffer(4096), 4096, NULL); sErr.ReleaseBuffer(); s.Format(_T("Can't open file\n%s\n\nfor saving. Windows says:\n\"%s\""), sFilename, sErr); MessageBox(s, L"Save logfile", MB_OK|MB_ICONERROR); return; } UINT format = (TXT == aType) ? SF_TEXT : SF_RTF; EDITSTREAM eds = {(DWORD_PTR)&file, 0, StreamFileOut}; StreamOut(format, eds); }
int WinMIDIDevice::StreamOutSync(MidiHeader *header) { return StreamOut(header); }
int SoftSynthMIDIDevice::StreamOutSync(MidiHeader *header) { std::lock_guard<std::mutex> lock(CritSec); StreamOut(header); return 0; }
void Analysis::StreamOutShort(detail::OutStream &stream) const { StreamOut(stream, 0); }