本文整理汇总了C++中StrAnsi类的典型用法代码示例。如果您正苦于以下问题:C++ StrAnsi类的具体用法?C++ StrAnsi怎么用?C++ StrAnsi使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了StrAnsi类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: EndOuterUndoTask
/*----------------------------------------------------------------------------------------------
${IActionHandler#EndUndoTask}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::EndUndoTask()
{
BEGIN_COM_METHOD;
if (m_fUndoOrRedoInProgress)
return S_OK;
if (m_nDepth <= 0)
{
return E_UNEXPECTED;
}
else
{
--m_nDepth;
if (m_nDepth == 0)
{
// cleans no-op undo tasks
EndOuterUndoTask();
}
}
#ifdef DEBUG_ACTION_HANDLER
StrAnsi sta;
sta.Format("EndUndoTask:");
sta.FormatAppend(" m_iCurrSeq=%d, m_viSeqStart=%d, m_iuactCurr=%d, m_vquact=%d, m_viMarks=%d, m_nDepth=%d\n",
m_iCurrSeq, m_viSeqStart.Size(), m_iuactCurr, m_vquact.Size(), m_viMarks.Size(), m_nDepth);
::OutputDebugStringA(sta.Chars());
#endif//DEBUG_ACTION_HANDLER
END_COM_METHOD(g_factActh, IID_IActionHandler);
}
示例2: ChkComArgPtr
/*----------------------------------------------------------------------------------------------
${IActionHandler#AddAction}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::AddAction(IUndoAction * puact)
{
BEGIN_COM_METHOD;
ChkComArgPtr(puact);
if (m_fUndoOrRedoInProgress)
return S_OK;
if(m_fCreateMarkIfNeeded && m_viMarks.Size() == 0)
{
// m_fCreateMarkIfNeeded probably didn't get reset (TE-4856)
Assert(m_nDepth <= 0 || m_fStartedNext);
int hmark;
CheckHr(Mark(&hmark));
Assert(hmark == 1); // Should only have 1 mark!
}
ContinueUndoTask();
AddActionAux(puact);
EndUndoTask();
#ifdef DEBUG_ACTION_HANDLER
StrAnsi sta;
sta.Format("AddAction:");
sta.FormatAppend(" m_iCurrSeq=%d, m_viSeqStart=%d, m_iuactCurr=%d, m_vquact=%d, m_viMarks=%d, m_nDepth=%d\n",
m_iCurrSeq, m_viSeqStart.Size(), m_iuactCurr, m_vquact.Size(), m_viMarks.Size(), m_nDepth);
::OutputDebugStringA(sta.Chars());
#endif//DEBUG_ACTION_HANDLER
END_COM_METHOD(g_factActh, IID_IActionHandler);
}
示例3: ChkComBstrArg
/*----------------------------------------------------------------------------------------------
${IActionHandler#BreakUndoTask}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::BreakUndoTask(BSTR bstrUndo, BSTR bstrRedo)
{
BEGIN_COM_METHOD;
ChkComBstrArg(bstrUndo);
ChkComBstrArg(bstrRedo);
if (m_fUndoOrRedoInProgress)
return S_OK;
int nSaveDepth = m_nDepth;
EndOuterUndoTask();
BeginUndoTask(bstrUndo, bstrRedo);
m_nDepth = nSaveDepth;
#ifdef DEBUG_ACTION_HANDLER
StrAnsi sta;
sta.Format("BreakUndoTask:");
sta.FormatAppend(" m_iCurrSeq=%d, m_viSeqStart=%d, m_iuactCurr=%d, m_vquact=%d, m_viMarks=%d, m_nDepth=%d\n",
m_iCurrSeq, m_viSeqStart.Size(), m_iuactCurr, m_vquact.Size(), m_viMarks.Size(), m_nDepth);
::OutputDebugStringA(sta.Chars());
#endif//DEBUG_ACTION_HANDLER
END_COM_METHOD(g_factActh, IID_IActionHandler);
}
示例4: WriteUni
void MacroBase::WriteUni(StrUni param)
{
if (!m_outfile.is_open()) return;
// All unicode strings are first transformed into ansi strings and then written to file as
// an ansi
StrAnsi staAnsi = param.Chars();
m_outfile << staAnsi.Chars() << "_" << " ";
}
示例5: ReportHandler
/*----------------------------------------------------------------------------------------------
Callback for DebugProcs
----------------------------------------------------------------------------------------------*/
void __stdcall DebugReport::ReportHandler(int reportType, char * szMsg)
{
if (KernelGlobals::s_qReportSink)
{
StrAnsi sta = szMsg;
SmartBstr bstr;
sta.GetBstr(&bstr);
KernelGlobals::s_qReportSink->Report((CrtReportType)reportType, bstr);
}
}
示例6: ReadAnsi
StrUni MacroBase::ReadUni()
{
if (!m_infile.is_open()) return NULL;
// Both Unicode and Ansi are written as Ansi to file. Convert to Unicode after retrieiving
// ansi interpretation
StrAnsi ans = ReadAnsi();
StrUni stuUni = ans.Chars();
return stuUni;
}
示例7: WriteToStream
void WriteToStream(std::ostream & strmOut, bool fNoPath)
{
int ich = m_staFile.Length();
// Strip off the file path.
while (fNoPath && ich > 0 && m_staFile[ich - 1] != '\\')
ich--;
StrAnsi staStripped = m_staFile.Right(m_staFile.Length() - ich);
strmOut << staStripped.Chars() << "(" << m_nLineOrig << ")";
}
示例8: AssertProcWrapper
void __stdcall DebugReport::AssertProcWrapper(const char * pszExp, const char * pszFile, int nLine,
HMODULE)
{
if (KernelGlobals::s_qReportSink)
{
StrAnsi sta = pszExp;
SmartBstr exp;
sta.GetBstr(&exp);
SmartBstr file;
sta = pszFile;
sta.GetBstr(&file);
KernelGlobals::s_qReportSink->AssertProc(exp, file, nLine);
}
}
示例9: AddTstFunc
void MacroBase::AddTstFunc(StrAnsi name, int ID)
{
// If no valid file object
if (!m_outfile.is_open()) return;
// name is just for visual reference, ID actually identifies the function
m_outfile << name.Chars() << " " << ID << " ";
}
示例10: _set_se_translator
/*----------------------------------------------------------------------------------------------
This function can be installed to translate windows exceptions into C++ internal error
exceptions. Only the main program should do this. To install, just call
_set_se_translator(TransFuncDump);.
This is of dubious value because if the error occurs inside a COM component, the Throwable
exception will not be recognized, and exception handling will just catch "..." and generate
a new stack dump. However, installing it at least achieves better stack dumps for errors
in code linked into the main program.
We could install at the start of every COM interface method, and restore upon return.
However this would be computationally expensive. Consider doing this in a particular method
if you are trying to track down a problem in that method.
We could have each module install this function on being loaded, and check whether the
error occurs in its own code, and if not call the previous error handler. But this
only works reliably if modules are never unloaded, or only in reverse order of loading,
which I don't see how to ensure.
We could also get really fancy, with some sort of central manager which knows which error
translator to use for each module. This has not seemed worthwhile to me so far.
----------------------------------------------------------------------------------------------*/
void TransFuncDump( unsigned int u, EXCEPTION_POINTERS * pExp)
{
#ifdef WIN32
HANDLE hThread;
DWORD dwCode = pExp->ExceptionRecord->ExceptionCode;
StrUni stuException = ConvertException(dwCode);
DuplicateHandle( GetCurrentProcess(), GetCurrentThread(),
GetCurrentProcess(), &hThread, 0, false, DUPLICATE_SAME_ACCESS );
StrAnsi staMsg;
staMsg.Format("Stack Dump for exception: %S (%d)", stuException.Chars(), dwCode);
StackDumper::ShowStack( hThread, *(pExp->ContextRecord), const_cast<char *>(staMsg.Chars()) );
CloseHandle( hThread );
StrUni stuMsg(staMsg.Chars());
throw ThrowableSd(E_UNEXPECTED, stuMsg.Chars(), 0, StackDumper::GetDump());
#endif
}
示例11: MainWindow
/*----------------------------------------------------------------------------------------------
This method checks for duplicates in list names. If the given name exists then return true.
@param pszName name to check to see if it exists.
@return True if name already exists.
----------------------------------------------------------------------------------------------*/
bool ListsPropDlg::CheckName(const achar * pszName)
{
AfMainWnd * pafw = MainWindow();
AssertPtr(pafw);
AfLpInfo * plpi = pafw->GetLpInfo();
AssertPtr(plpi);
Vector<HVO> & vhvo = plpi->GetPsslIds();
AfDbInfoPtr qdbi = plpi->GetDbInfo();
AssertPtr(qdbi);
IOleDbEncapPtr qode;
qdbi->GetDbAccess(&qode);
StrAnsi sta;
int i;
StrUni stuIds;
int cv = vhvo.Size();
Assert(cv);
ComBool fIsNull;
ComBool fMoreRows;
ULONG cbSpaceTaken;
IOleDbCommandPtr qodc;
const int kcchBuffer = MAX_PATH;
OLECHAR rgchName[kcchBuffer];
HVO hvo;
StrUni stu;
for (i = 0; i < cv; ++i)
{
hvo = vhvo[i];
stu.Format(L"exec GetOrderedMultiTxt '%d', %d",
hvo, kflidCmMajorObject_Name);
CheckHr(qode->CreateCommand(&qodc));
CheckHr(qodc->ExecCommand(stu.Bstr(), knSqlStmtStoredProcedure));
CheckHr(qodc->GetRowset(0));
CheckHr(qodc->NextRow(&fMoreRows));
Assert(fMoreRows); // This proc should always return something.
CheckHr(qodc->GetColValue(1, reinterpret_cast <BYTE *>(rgchName),
kcchBuffer * isizeof(OLECHAR), &cbSpaceTaken, &fIsNull, 2));
sta = rgchName;
if (hvo != m_hvoObj && sta.Equals(pszName))
return false;
}
return true;
}
示例12: WriteAnsi
void MacroBase::WriteAnsi(StrAnsi param)
{
if (!m_outfile.is_open()) return;
// All strings are terminated by the ALT-255 character. It is doubtful the user will type this
// character and so terminate the actual log prematurely. Using this obscure character
// safeguards against that
m_outfile << param.Chars() << "_" << " ";
}
示例13: IgnoreHr
/*----------------------------------------------------------------------------------------------
${IActionHandler#Commit}
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ActionHandler::Commit()
{
BEGIN_COM_METHOD;
HRESULT hr = E_FAIL;
HRESULT hrFinal = S_OK;
if (m_vquact.Size())
{
// JohnT 10/22/01: this can happen, typically if the only thing in the sequence is a
// position mark. We could try to check for that but it doesn't seem worth it. Nothing
// actually depends on having at least one sequence start here.
//Assert(m_viSeqStart.Size() > 0);
// Commit all actions.
for (int i = 0; i <= m_iuactCurr; i++)
{
// If for some reason, we cannot commit an action that is part of a sequence, it's
// just too bad. We can't undo a commited action so we might as well just amble on
// and hope for the best.
IgnoreHr(hr = m_vquact[i]->Commit());
if (FAILED(hr))
{
hrFinal = hr;
}
}
EmptyStack();
}
#ifdef DEBUG_ACTION_HANDLER
StrAnsi sta;
sta.Format("Commit:");
sta.FormatAppend(" m_iCurrSeq=%d, m_viSeqStart=%d, m_iuactCurr=%d, m_vquact=%d, m_viMarks=%d, m_nDepth=%d\n",
m_iCurrSeq, m_viSeqStart.Size(), m_iuactCurr, m_vquact.Size(), m_viMarks.Size(), m_nDepth);
::OutputDebugStringA(sta.Chars());
#endif//DEBUG_ACTION_HANDLER
return hrFinal;
END_COM_METHOD(g_factActh, IID_IActionHandler);
}
示例14: SetMacroOut
bool MacroBase::SetMacroOut(StrAnsi staMcr)
{
// Same functionality as SetMacroIn, except used for writing to files
if (!strcmp(staMcr.Chars(),""))
return false;
m_stafileout = staMcr;
if (m_outfile.is_open())
m_outfile.close();
m_outfile.open(m_stafileout.Chars(), ios_base::out);
return m_outfile.is_open();
}
示例15: SaveToFile
/*----------------------------------------------------------------------------------------------
Save the text to a file.
----------------------------------------------------------------------------------------------*/
bool WpDa::SaveToFile(StrAnsi staFileName)
{
IStreamPtr qstrm;
FileStream::Create(staFileName.Chars(), kfstgmWrite | kfstgmCreate, &qstrm);
// FileStream::Create("c:\\output.txt", kfstgmWrite | kfstgmCreate, &qstrm);
ULONG cbWritten;
// Write byte-order mark.
byte b = 0xFF;
CheckHr(qstrm->Write(&b, 1, &cbWritten));
b = 0xFE;
CheckHr(qstrm->Write(&b, 1, &cbWritten));
int ctss;
CheckHr(get_VecSize(1, kflidStText_Paragraphs, &ctss));
for (int itss = 0; itss < ctss; itss++)
{
ITsStringPtr qtss;
CheckHr(get_StringProp(itss + 2, kflidStTxtPara_Contents, &qtss));
BSTR bstr = NULL;
int cchw;
CheckHr(qtss->get_Length(&cchw));
qtss->GetChars(0, cchw, &bstr);
// Write the string to the file.
if (cchw > 0)
{
Assert(bstr);
CheckHr(qstrm->Write(bstr, cchw * isizeof(wchar), &cbWritten));
}
if (itss < ctss - 1)
{
// CRLF--little-endian
b = 13;
CheckHr(qstrm->Write(&b, 1, &cbWritten));
b = 0;
CheckHr(qstrm->Write(&b, 1, &cbWritten));
b = 10;
CheckHr(qstrm->Write(&b, 1, &cbWritten));
b = 0;
CheckHr(qstrm->Write(&b, 1, &cbWritten));
}
ReleaseBstr(bstr);
}
return true;
}