本文整理汇总了C++中TSTRING::append方法的典型用法代码示例。如果您正苦于以下问题:C++ TSTRING::append方法的具体用法?C++ TSTRING::append怎么用?C++ TSTRING::append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TSTRING
的用法示例。
在下文中一共展示了TSTRING::append方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openLog
/// <summary>
/// <para name='Name'>SLog::openLog</para>
/// <para name='Purpose'>Open a log for output</para>
/// </summary>
/// <param name='szFullPathToLog'>the full path to the log file to open</param>
/// <param name='makeUnique'>Whether to append a date/time stamp to the file name</param>
/// <returns>S_OK if successful, failure if it failed</returns>
/// <remarks>
/// <para name='Notes'></para>
/// <para name='Author'>Kenn Guilstorf</para>
/// <para name='LastModified'>2015-10-26</para>
/// </remarks>
HRESULT SLog::openLog(TSTRING szFullPathToLog, bool makeUnique)
{
HRESULT hrRetVal = S_OK;
TSTRING szFullLogPath = TSTRING();
// If we're trying to open when a log is already open...
// Let's flush and close the main OSTREAM first...
if (NULL != m_pO)
{
m_pO->flush();
delete m_pO;
m_pO = NULL;
}
// Now, close the file stream...
if (NULL != m_log)
{
if (m_log->is_open())
{
m_log->flush();
m_log->close();
delete m_log;
m_log = NULL;
}
}
// Split the path into path, name and ext
hrRetVal = splitFullPath(szFullPathToLog);
if (hrRetVal == ERROR_BAD_ARGUMENTS)
goto EXIT;
// Do we want to add date/time to the file?
if (makeUnique)
m_szLogFileName->append(getDateTimeString(false));
szFullLogPath.append(m_szLogFilePath->c_str());
szFullLogPath.append(m_szLogFileName->c_str());
szFullLogPath.append(m_szLogFileExt->c_str());
// Enter our critical section
EnterCriticalSection(&m_CriticalSection);
// Open our file stream
m_log = new TOFSTREAM(szFullLogPath.c_str(),
TOFSTREAM::app | TOFSTREAM::out);
// Open a new output stream
m_pO = new TOSTREAM(m_log->rdbuf());
// Leave our critical section
LeaveCriticalSection(&m_CriticalSection);
EXIT:
return hrRetVal;
}
示例2: MakeFileError
///////////////////////////////////////////////////////////////////////////////
// MakeFileError
///////////////////////////////////////////////////////////////////////////////
TSTRING cErrorUtil::MakeFileError( const TSTRING& msg, const TSTRING& fileName )
{
TSTRING ret;
ret = TSS_GetString( cCore, core::STR_ERR2_FILENAME );
ret.append( fileName );
ret.append( 1, _T('\n') );
if ( msg.length() > 0 )
{
ret.append(msg);
}
return ret;
}
示例3: AsStringHex
TSTRING cSHASignature::AsStringHex() const
{
TSTRING ret;
TCHAR stringBuffer[128];
TCHAR sigStringOut[128];
sigStringOut[0] = '\0';
for (int i=0; i < SIG_UINT32_SIZE; ++i)
{
_stprintf(stringBuffer, _T("%08x"), mSHAInfo.digest[i]);
_tcscat(sigStringOut, stringBuffer);
}
ret.append(sigStringOut);
return ret;
}
示例4:
TSTRING cMD5Signature::AsStringHex() const
{
TSTRING ret;
TCHAR stringBuffer[128];
TCHAR sigStringOut[128];
sigStringOut[0] = '\0';
uint8 *dbuf = (uint8 *)md5_digest;
for(int i = 0; i < SIG_BYTE_SIZE; ++i)
{
_stprintf(stringBuffer, _T("%02lx"), (unsigned long)dbuf[i]);
_tcscat(sigStringOut, stringBuffer);
}
ret.append(sigStringOut);
return ret;
}
示例5: AsString
TSTRING cChecksumSignature::AsString() const
{
TSTRING ret;
char *ps_signature;
char buf[100];
uint32 local[2];
local[0] = (uint32)(mChecksum >> 32); // note we put the MSB first
local[1] = (uint32)(mChecksum);
ps_signature = pltob64(local, buf, 2);
//ps_signature holds base64 representation of mCRC
#ifdef _UNICODE
ret.resize(strlen(ps_signature));
mbstowcs((TCHAR*)ret.data(), ps_signature, strlen(ps_signature));
#else
ret.append(ps_signature);
#endif
return ret;
}
示例6: Encode
void cEncoder::Encode( TSTRING& strIn ) const
{
// TODO:BAM -- reserve space for strOut as an optimization?
TSTRING strOut; // encoded string we will build up
TSTRING::const_iterator cur = strIn.begin(); // pointer to working position in strIn
const TSTRING::const_iterator end = strIn.end(); // end of strIn
TSTRING::const_iterator first = end; // identifies beginning of current character
TSTRING::const_iterator last = end; // identifies end of current character
// while get next char (updates cur)
while( cCharUtil::PopNextChar( cur, end, first, last ) )
{
bool fCharEncoded = false; // answers: did char need encoding?
sack_type::const_iterator atE;
// for all encoders
for( atE = m_encodings.begin();
atE != m_encodings.end();
atE++ )
{
// does char need encoding?
if( (*atE)->NeedsEncoding( first, last ) )
{
strOut += Encode( first, last, atE );
fCharEncoded = true;
break; // each char should only fail at most one
// encoding test, so it should be cool to quit
}
}
if( ! fCharEncoded )
{
strOut.append( first, last ); // simply add current char to output since it needed no encoding
}
}
// pass back encoded string
strIn = strOut;
}
示例7: Decode
void cEncoder::Decode( TSTRING& strIn ) const
{
// TODO:BAM -- reserve space for strOut as an optimization?
TSTRING strOut; // decoded string we will build up
TSTRING::const_iterator cur = strIn.begin(); // pointer to working position in strIn
const TSTRING::const_iterator end = strIn.end(); // end of strIn
TSTRING::const_iterator first = end; // identifies beginning of current character
TSTRING::const_iterator last = end; // identifies end of current character
// while get next char (updates cur)
while( cCharUtil::PopNextChar( cur, end, first, last ) )
{
// is this char the escape character?
if( IsSingleTCHAR( first, last ) &&
*first == iCharEncoder::EscapeChar() )
{
// get to identifier
if( ! cCharUtil::PopNextChar( cur, end, first, last ) )
ThrowAndAssert( eBadDecoderInput() );
// this algorithm assumes that all identifiers are single char
// so anything following the escape char should be a
// single-char identifier
if( ! IsSingleTCHAR( first, last ) )
THROW_INTERNAL( "displayencoder.cpp" );
// determine to which encoding the identifier belongs
bool fFoundEncoding = false;
sack_type::const_iterator atE;
for( atE = m_encodings.begin();
atE != m_encodings.end();
atE++ )
{
// is this the right encoding?
if( *first == (*atE)->Identifier() )
{
// this is the correct encoding....
fFoundEncoding = true;
// ...so decode char
strOut += (*atE)->Decode( &first, end ); // should modify cur
cur = first; // advance current char pointer
break; // no need to run other tests after
// this because all identifiers should be unique
}
}
if( ! fFoundEncoding )
ThrowAndAssert( eUnknownEscapeEncoding( TSTRING( 1, *first ) ) );
}
else
{
strOut.append( first, last );
}
}
strIn = strOut;
}
示例8: main
int main(int argc, char* argv[])
{
// Get application path
g_ApplicationExePath.append(argv[0]);
// Calculate INI file path
g_ApplicationIniPath = g_ApplicationExePath;
g_ApplicationIniPath.resize(g_ApplicationIniPath.find_last_of(_T('.')));
g_ApplicationIniPath.append(_T(".ini"));
if (! InitInstance())
return 255;
Emulator_Start();
// The main loop
Uint32 ticksLast;
Uint32 ticksLastFps = SDL_GetTicks();
int frames = 0;
while (!g_okQuit)
{
ticksLast = SDL_GetTicks(); // Time at frame start
SDL_Event evt;
while (SDL_PollEvent(&evt))
{
if (evt.type == SDL_QUIT)
{
g_okQuit = TRUE;
break;
}
else
{
if (evt.type == SDL_KEYDOWN || evt.type == SDL_KEYUP ||
evt.type == SDL_JOYBUTTONDOWN || evt.type == SDL_JOYBUTTONUP)
{
Main_OnKeyJoyEvent(evt);
}
}
}
if (g_okEmulatorRunning)
{
Emulator_SystemFrame();
Main_DrawScreen();
frames++;
}
// Delay
Uint32 ticksNew = SDL_GetTicks();
Uint32 ticksElapsed = ticksNew - ticksLast;
g_LastDelay = 0;
if (ticksElapsed < FRAME_TICKS)
{
g_LastDelay = FRAME_TICKS - ticksElapsed;
SDL_Delay(FRAME_TICKS - ticksElapsed);
}
ticksLast = ticksNew;
if (ticksLast - ticksLastFps > 1000) //DEBUG: FPS calculation
{
g_LastFps = frames;
frames = 0;
ticksLastFps += 1000;
}
}
Emulator_Stop();
DoneInstance();
return 0;
}
示例9: TSTRING
/// <summary>
/// <para name='Name'>GetEID</para>
/// <para name='Purpose'>Resolve the EID from the email address</para>
/// </summary>
/// <param name='szEmailAddress'>Email address to resolve</param>
/// <param name='sbEID'>[out]SBinary EID to return</param>
/// <returns>HRESULT</returns>
/// <remarks>
/// <para name='Notes'></para>
/// <para name='Author'>Kenn Guilstorf</para>
/// <para name='LastModified'>28Jan2016</para>
/// </remarks>
STDMETHODIMP ZybraxiSoft::CMailbox::GetEID(const TSTRING sEmailAddress, SBinary &sbEID)
{
FBEG;
HRESULT hr = S_OK;
LPMDB lpDefaultMDB = NULL;
LPEXCHANGEMANAGESTORE lpExStore = NULL;
TSTRING sServerName;
TSTRING sServerPre = TSTRING(SERVER_PRE);
TSTRING sServerPost = TSTRING(SERVER_POST);
TSTRING sServerDN = wstring();
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
string sTempEmailAddress;
string sTempServerDN;
// Clean our sbEID
sbEID.cb = 0;
// Get a pointer to the default message store
if (FAILED(hr = OpenDefaultMessageStore(
&lpDefaultMDB)))
{
ERROR_MSG_W_HR("OpenDefaultMessageStore failed", hr);
goto CLEANUP;
}
// Use the pointer to the default message store to
// Get a pointer to the Manage Store interface
if (FAILED(hr = lpDefaultMDB->QueryInterface(
IID_IExchangeManageStore,
(LPVOID*)&lpExStore)))
{
ERROR_MSG_W_HR("Getting the Exchange store manager failed", hr);
goto CLEANUP;
}
// Get our Server Name
if (FAILED(hr = this->GetServerNameFromProfile(sServerName)))
{
ERROR_MSG_W_HR("Getting the server name failed", hr);
goto CLEANUP;
}
// Go ahead and build our server dn
sServerDN.append(sServerPre.c_str());
sServerDN.append(sServerName.c_str());
sServerDN.append(sServerPost.c_str());
// if we're in UNICODE, we need to convert; we can only pass ASCII
#if defined(UNICODE) || defined(_UNICODE)
sTempServerDN = converter.to_bytes(sServerDN);
sTempEmailAddress = converter.to_bytes(sEmailAddress);
#else
sTempServerDN = sServerDN;
sTempEmailAddress = sEmailAddress;
#endif
// Get the EID
if (FAILED(hr = lpExStore->CreateStoreEntryID(
(LPSTR)sTempServerDN.c_str(),
(LPSTR)sTempEmailAddress.c_str(),
OPENSTORE_TAKE_OWNERSHIP,
&sbEID.cb,
(LPENTRYID*)&sbEID.lpb)))
{
ERROR_MSG_W_HR("CreateStoreEntryID failed", hr);
goto CLEANUP;
}
// Check to make sure we got an actual EID
if (sbEID.cb == 0)
{
hr = MAPI_E_NOT_FOUND;
ERROR_MSG_W_HR("Failed to resolve the mailbox", hr);
goto CLEANUP;
}
CLEANUP:
if (lpExStore)
{
lpExStore->Release();
lpExStore = NULL;
}
if (lpDefaultMDB)
{
lpDefaultMDB->Release();
lpDefaultMDB = NULL;
//.........这里部分代码省略.........