本文整理汇总了C++中Tstring::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ Tstring::c_str方法的具体用法?C++ Tstring::c_str怎么用?C++ Tstring::c_str使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tstring
的用法示例。
在下文中一共展示了Tstring::c_str方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testLeftJoinIN
void TestLeftJoin::testLeftJoinIN()
{
Value lVal[2]; lVal[0].set(mLHSStr.c_str()); lVal[1].set(mLHSStr.c_str());
Value lLHSVal[1]; lLHSVal[0].setRange(lVal);
SourceSpec lLHSCS[1];
lLHSCS[0].objectID = getDataEventID(2);
lLHSCS[0].nParams = 1;
lLHSCS[0].params = lLHSVal;
char lStart[2]; lStart[0] = (char)0; lStart[1] = '\0';
char lEnd[2]; lEnd[0] = (char)255; lEnd[1] = '\0';
Value lVal2[2]; lVal2[0].set(lStart); lVal2[1].set(lEnd);
Value lRHSVal[1]; lRHSVal[0].setRange(lVal2);
SourceSpec lRHSCS[1];
lRHSCS[0].objectID = getDataEventID(3);
lRHSCS[0].nParams = 1;
lRHSCS[0].params = lRHSVal;
IStmt * lQ = mSession->createStmt();
unsigned char lVar1 = lQ->addVariable(lLHSCS, 1);
unsigned char lVar2 = lQ->addVariable(lRHSCS, 1);
Value lV[2];
lV[1].setVarRef(lVar1,mRefPropID);
lV[0].setVarRef(lVar2,mPINPropID);
CmvautoPtr<IExprNode> lJoinET(mSession->expr(OP_EQ,2,lV));
lQ->join(lVar1, lVar2, lJoinET, QRY_LEFT_OUTER_JOIN);
uint64_t lCount = 0;
TVERIFYRC(lQ->count(lCount, 0, 0, ~0));
TVERIFY((int)lCount == mNumRHSPINs);
lQ->destroy();
}
示例2: createMeta
void TestACLsInfer::createMeta()
{
mCLSID = STORE_INVALID_CLASSID;
{
IStmt *lQ = mSession->createStmt();
unsigned char lVar = lQ->addVariable();
IExprNode *lET;
{
Value lV[2];
lV[0].setVarRef(0,mPropIDs[1]);
lV[1].setParam(0);
lET = mSession->expr(OP_IN, 2, lV);
}
TVERIFYRC(lQ->addCondition(lVar,lET)); lET->destroy();
char lB[124]; sprintf(lB, "TestACLsInfer.%s.Family.%d", mClassStr.c_str(), 0);
TVERIFYRC(defineClass(mSession,lB, lQ, &mCLSID));
}
mCLSID2 = STORE_INVALID_CLASSID;
{
IStmt *lQ = mSession->createStmt();
unsigned char lVar = lQ->addVariable();
IExprNode *lET;
{
Value lV[2];
lV[0].setVarRef(0,mPropIDs[2]);
lV[1].setParam(0);
lET = mSession->expr(OP_IN, 2, lV);
}
TVERIFYRC(lQ->addCondition(lVar,lET)); lET->destroy();
char lB[124]; sprintf(lB, "TestACLsInfer.%s.Family.%d", mClassStr.c_str(), 1);
TVERIFYRC(defineClass(mSession,lB, lQ, &mCLSID2));
}
}
示例3: createPINs
void TestAbortQuery::createPINs(int pNumPINs)
{
mLogger.out() << " Creating " << pNumPINs << " PINs ...";
int i = 0;
for(i = 0; i < pNumPINs; i++)
{
if(i % 100 == 0) mLogger.out() << ".";
PID lPID;
Value lV[20];
SETVALUE(lV[0], mPropIDs[0], i, OP_SET);
Tstring lStr; MVTRand::getString(lStr, 100, 100, true, false);
SETVALUE(lV[1], mPropIDs[1], lStr.c_str(), OP_SET);
SETVALUE(lV[2], mPropIDs[2], lStr.c_str(), OP_SET);
Tstring lWStr; MVTRand::getString(lWStr, 100, 100, true, false);
SETVALUE(lV[3], mPropIDs[3], lWStr.c_str(), OP_SET);
double lDouble = (double)MVTRand::getRange(10, 1000);
SETVALUE(lV[4], mPropIDs[4], lDouble, OP_SET);
SETVALUE(lV[5], mPropIDs[5], MVTRand::getBool(), OP_SET);
lV[6].setNow(); SETVATTR(lV[6], mPropIDs[6], OP_SET);
lV[7].setNow(); SETVATTR(lV[7], mPropIDs[7], OP_SET);
IStream *lStream = new TestStringStream(MVTRand::getRange(10, 30) * 1024);
SETVALUE(lV[8], mPropIDs[8], MVTApp::wrapClientStream(mSession, lStream), OP_SET);
IStream *lStream1 = new TestStringStream(MVTRand::getRange(10, 30) * 1024);
SETVALUE(lV[9], mPropIDs[9], MVTApp::wrapClientStream(mSession, lStream1), OP_SET);
SETVALUE(lV[10], PROP_SPEC_CREATED, 1, OP_SET);
SETVALUE(lV[11], PROP_SPEC_UPDATED, i, OP_SET);
CREATEPIN(mSession, &lPID, lV, 12);
}
mLogger.out() << " DONE " << std::endl;
}
示例4: Create
HWND CDasherWindow::Create() {
hAccelTable = LoadAccelerators(WinHelper::hInstApp, (LPCTSTR)IDC_DASHER);
// Get window title from resource script
Tstring WindowTitle;
WinLocalisation::GetResourceString(IDS_APP_TITLE, &WindowTitle);
string configFileName = "settings.xml";
if (!m_configName.empty())
configFileName = "settings." + WinUTF8::wstring_to_UTF8string(m_configName.c_str()) + ".xml";
static XmlErrorDisplay display;
static CWinFileUtils fileUtils;
auto settings = new Dasher::XmlSettingsStore(configFileName, &fileUtils, &display);
settings->Load();
// Save the defaults if needed.
settings->Save();
m_pAppSettings = new CAppSettings(0, 0, settings); // Takes ownership of the settings store.
int iStyle(m_pAppSettings->GetLongParameter(APP_LP_STYLE));
HWND hWnd;
if (iStyle == APP_STYLE_DIRECT) {
hWnd = CWindowImpl<CDasherWindow >::Create(NULL, NULL, WindowTitle.c_str(), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN, WS_EX_NOACTIVATE | WS_EX_APPWINDOW | WS_EX_TOPMOST);
::SetMenu(hWnd, NULL);
}
else {
hWnd = CWindowImpl<CDasherWindow >::Create(NULL, NULL, WindowTitle.c_str(), WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN);
::SetMenu(hWnd, m_hMenu);
}
// Create Widgets
m_pEdit = new CEdit(m_pAppSettings);
m_pEdit->Create(hWnd, m_pAppSettings->GetBoolParameter(APP_BP_TIME_STAMP));
m_pEdit->SetFont(m_pAppSettings->GetStringParameter(APP_SP_EDIT_FONT), m_pAppSettings->GetLongParameter(APP_LP_EDIT_FONT_SIZE));
m_pDasher = new CDasher(hWnd, this, m_pEdit, settings, &fileUtils);
// Create a CAppSettings
m_pAppSettings->SetHwnd(hWnd);
m_pAppSettings->SetDasher(m_pDasher);
m_pToolbar = new CToolbar(hWnd, m_pAppSettings->GetBoolParameter(APP_BP_SHOW_TOOLBAR));
// FIXME - the edit box really shouldn't need access to the interface,
// but at the moment it does, for training, blanking the display etc
m_pEdit->SetInterface(m_pDasher);
m_pSpeedAlphabetBar = new CStatusControl(m_pDasher->GetSettingsUser(), m_pAppSettings);
m_pSpeedAlphabetBar->Create(hWnd);
m_pSplitter = new CSplitter(this, 100);
m_pSplitter->Create(hWnd);
m_bFullyCreated = true;
return hWnd;
}
示例5: createData
void TestLeftJoin::createData()
{
MVTRand::getString(mLHSStr, 10, 10, false, true);
mNumRHSPINs = 0;
mNumFamily2PINs = 0;
int i = 0;
std::vector<PID> lPINs;
// Create PINs for Family2
for(i = 0; i < (int)sNumPINs/2; i++)
{
Value lV[5];
Tstring lRHSStr;
SETVALUE(lV[0], mPropIDs[2], MVTRand::getRange(10, 100), OP_SET);
SETVALUE(lV[1], mPropIDs[3], MVTRand::getBool(), OP_SET);
Tstring lStr; MVTRand::getString(lStr, 10, 10, false, true);
SETVALUE(lV[2], mPropIDs[4], lStr.c_str(), OP_SET);
bool lJoinFamily = MVTRand::getRange(0, 100) > 50?true:false;
if(lJoinFamily)
{
int lRand = MVTRand::getRange(0, 2);
lRHSStr = sRHSStr[lRand];
SETVALUE(lV[3], mRHSPropID, lRHSStr.c_str(), OP_SET);
}
PID lPID = {STORE_INVALID_PID, STORE_OWNER};
CREATEPIN(mSession, &lPID, lV, lJoinFamily?4:3);
IPIN *lPIN = mSession->getPIN(lPID); TVERIFY(lPIN != NULL);
if(lPIN)
{
if(lJoinFamily)
{
mRHSPINs.insert(std::map<Tstring, PID>::value_type(lRHSStr, lPID));
mNumFamily2PINs++;
}
lPINs.push_back(lPID);
lPIN->destroy();
mNumRHSPINs++;
}
}
// Create PINs for Family1
for(i = 0; i < (int)sNumPINs/2; i++)
{
Value lV[5];
SETVALUE(lV[0], mLHSPropID, mLHSStr.c_str(), OP_SET);
SETVALUE(lV[1], mPropIDs[2], MVTRand::getRange(10, 100), OP_SET);
SETVALUE(lV[2], mPropIDs[3], MVTRand::getBool(), OP_SET);
Tstring lStr; MVTRand::getString(lStr, 10, 10, false, true);
SETVALUE(lV[3], mPropIDs[4], lStr.c_str(), OP_SET);
SETVALUE(lV[4], mPropIDs[5], lPINs[i], OP_SET); // add VT_REFID property to pins created before
PID lPID = {STORE_INVALID_PID, STORE_OWNER};
CREATEPIN(mSession, &lPID, lV, 5);
IPIN *lPIN = mSession->getPIN(lPID); TVERIFY(lPIN != NULL);
mLHSPINs.push_back(lPID);
if(lPIN) lPIN->destroy();
}
lPINs.clear();
}
示例6: QuerySaveFirst
int CFilenameGUI::QuerySaveFirst() {
if(Dirty) {
Tstring ResourceString;
Tstring Title;
WinLocalisation::GetResourceString(IDS_QUERY_SAVE_CHANGES, &ResourceString);
WinLocalisation::GetResourceString(IDS_UNSAVED_CHANGES, &Title);
return MessageBox(WindowWithTitlebar, ResourceString.c_str(), Title.c_str(), MB_YESNOCANCEL | MB_ICONWARNING | MB_DEFBUTTON1 | MB_APPLMODAL);
}
return IDNO;
}
示例7: testStmt
void testStmt(ISession * pSession, Tstring const & pStmt)
{
if (isKnownFailure(pStmt))
return;
mLogger.out() << "tried: " << pStmt.c_str() << std::endl;
CompilationError lCE;
CmvautoPtr<IStmt> lStmt(pSession->createStmt(pStmt.c_str(), NULL, 0, &lCE));
mLogger.out() << "obtained: " << lCE.rc << " " << (lCE.msg ? lCE.msg : "") << std::endl << std::endl;
#if TEST_EXECUTE_GOOD_STMT
if (RC_OK == lCE.rc && lStmt.IsValid())
lStmt->execute();
#endif
}
示例8: SaveSettingT
void CAppSettings::SaveSettingT(const std::string &Key, const Tstring &TValue) {
Tstring TKey;
UTF8string_to_wstring(Key, TKey);
DWORD MemAllow = (TValue.size() + 1) * sizeof(TCHAR);
//const unsigned char* StrInput = (const unsigned char*) Value.c_str();
//LONG ErrVal = RegSetValueEx(ProductKey, TKey.c_str(), 0,
// REG_SZ, StrInput, MemAllow);
LONG ErrVal = RegSetValueEx(ProductKey, TKey.c_str(), 0,
REG_SZ, (CONST BYTE *) TValue.c_str(), MemAllow);
}
示例9: testLeftJoinEQ
void TestLeftJoin::testLeftJoinEQ()
{
Value lLHSValue[1];
lLHSValue[0].set(mLHSStr.c_str());
SourceSpec lLHSCS[1];
lLHSCS[0].objectID = getDataEventID(0);
lLHSCS[0].nParams = 1;
lLHSCS[0].params = lLHSValue;
Value lRHSValue[1];
lRHSValue[0].set(sRHSStr[0]);
SourceSpec lRHSCS[1];
lRHSCS[0].objectID = getDataEventID(1);
lRHSCS[0].nParams = 1;
lRHSCS[0].params = lRHSValue;
IStmt * lQ = mSession->createStmt();
unsigned char lVar1 = lQ->addVariable(lLHSCS, 1);
unsigned char lVar2 = lQ->addVariable(lRHSCS, 1);
Value lV[2];
lV[1].setVarRef(lVar1,mRefPropID);
lV[0].setVarRef(lVar2,mPINPropID);
CmvautoPtr<IExprNode> lJoinET(mSession->expr(OP_EQ,2,lV));
lQ->join(lVar1, lVar2, lJoinET, QRY_LEFT_OUTER_JOIN);
uint64_t lCount = 0;
TVERIFYRC(lQ->count(lCount, 0, 0, ~0));
TVERIFY(lCount == (uint64_t)mLHSPINs.size());
lQ->destroy();
}
示例10: PatchUserDefineAddr
BOOL CDOMPlugin::PatchUserDefineAddr()
{
//DebugBreak();
//return TRUE;
//Tstring strShellCode = Utility::IniAccess::GetPrivateKeyValString(strConfigPath, _T("CODE"), _T("stub"));
LPVOID lpBaseAddress = VirtualAlloc(NULL, 1024, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
StubShell = (PSTUP_SHELL)lpBaseAddress;//
StubShell->CallBackFun = (ULONG)&PacketCollect;
DWORD dwCodeSize = Utility::StringLib::Tstring2Hex(strStub.c_str(), StubShell->ShellCode);
StubShell->PatchAt = m_sPatchAt;
for (int i = 0; i < dwCodeSize; i++)
{
if (StubShell->ShellCode[i] == 0xff)
{
if (StubShell->ShellCode[i + 1] == 0x15) {
*(ULONG*)&StubShell->ShellCode[i + 2] = (ULONG)&StubShell->CallBackFun;
}
if (StubShell->ShellCode[i + 1] == 0x25) {
*(ULONG*)&StubShell->ShellCode[i + 2] = (ULONG)&StubShell->PatchAt;
}
}
}
DetourTransactionBegin();
DetourUpdateThread(GetCurrentThread());
DetourAttach(&(PVOID&)StubShell->PatchAt, (PVOID)StubShell->ShellCode);
DetourTransactionCommit();
return TRUE;
}
示例11: PopulateList
void CColourBox::PopulateList() {
HWND ListBox = GetDlgItem(m_hwnd, IDC_COLOURS);
SendMessage(ListBox, LB_RESETCONTENT, 0, 0);
m_pDasherInterface->GetPermittedValues(SP_COLOUR_ID, ColourList);
// Add each string to list box and index each one
bool SelectionSet = false;
for(unsigned int i = 0; i < ColourList.size(); i++) {
Tstring Item;
WinUTF8::UTF8string_to_wstring(ColourList[i], Item);
LRESULT Index = SendMessage(ListBox, LB_ADDSTRING, 0, (LPARAM) Item.c_str());
SendMessage(ListBox, LB_SETITEMDATA, Index, (LPARAM) i);
if(ColourList[i] == m_CurrentColours) {
SendMessage(ListBox, LB_SETCURSEL, Index, 0);
SelectionSet = true;
}
}
if(SelectionSet == false) {
SendMessage(ListBox, LB_SETCURSEL, 0, 0);
LRESULT CurrentIndex = SendMessage(ListBox, LB_GETITEMDATA, 0, 0);
m_CurrentColours = ColourList[CurrentIndex];
}
// Tell list box that we have set an item for it (so that delete and edit can be grayed if required)
SendMessage(m_hwnd, WM_COMMAND, MAKEWPARAM(IDC_COLOURS, LBN_SELCHANGE), 0);
}
示例12: getDataEventID
DataEventID TestLeftJoin::getDataEventID(int pClassIndex)
{
char lB[64];
sprintf(lB, "TestLeftJoin.%s.Family%d", mClassStr.c_str(), pClassIndex);
DataEventID lCLSID = STORE_INVALID_CLASSID;
TVERIFYRC(mSession->getDataEventID(lB, lCLSID));
return lCLSID;
}
示例13: Create
HWND CEdit::Create(HWND hParent, bool bNewWithDate) {
m_hWnd = CWindowImpl<CEdit>::Create(hParent, NULL, NULL, ES_NOHIDESEL | WS_CHILD | ES_MULTILINE | WS_VSCROLL | WS_VISIBLE, WS_EX_CLIENTEDGE);
Tstring WindowTitle;
WinLocalisation::GetResourceString(IDS_APP_TITLE, &WindowTitle);
m_FilenameGUI = new CFilenameGUI(hParent, WindowTitle.c_str(), bNewWithDate);
return m_hWnd;
}
示例14: testFullScan
void TestUndelete::testFullScan()
{
Value lV[1]; lV[0].set(mQueryStr.c_str());
IStmt *lQ = getQuery(1, mPropIDs[2], lV);
long const lStartTime = getTimeInMs();
test(lQ);
long const lEndTime = getTimeInMs();
mLogger.out() << "Time taken for testFullScan() :: " << (lEndTime - lStartTime) << " ms" << std::endl;
lQ->destroy();
}
示例15: GetlpByte
bool CAppSettings::GetlpByte(const Tstring &Key, BYTE **Data) const {
*Data = new BYTE[1];
unsigned long datasize = sizeof(BYTE[1]);
DWORD Type;
LONG ErrVal = RegQueryValueEx(ProductKey, Key.c_str(), 0, &Type, *Data, &datasize);
while(ErrVal == ERROR_MORE_DATA) {
delete[] * Data;
*Data = new BYTE[datasize];
ErrVal = RegQueryValueEx(ProductKey, Key.c_str(), 0, &Type, *Data, &datasize);
}
// Perhaps I should spend lots of time working out why the registry doesn't work.
// when this fails. Would probably just confuse users though. Users with a broken
// registry can live with defaults :)
if((ErrVal == ERROR_SUCCESS) && (*Data != 0))
return true;
else
return false;
}