本文整理汇总了C++中ws2s函数的典型用法代码示例。如果您正苦于以下问题:C++ ws2s函数的具体用法?C++ ws2s怎么用?C++ ws2s使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ws2s函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tok1
void TransfersDialog::OnbtnAddTransferClick(wxCommandEvent& event)
{
wxString wxstrId = TextCtrl1->GetValue(); // c
wxString wxstrDescr = TextCtrl2->GetValue(); // consumption
//string strId = string(TextCtrl2->GetValue().mb_str(wxConvISO8859_1));
//string strDescr = string(TextCtrl1->GetValue().mb_str(wxConvISO8859_1));
wxString wxstrFrom = ddFrom->GetString(ddFrom->GetCurrentSelection());
wxStringTokenizer tok1(wxstrFrom, _("\t"));
wxString wxstrFromShort = tok1.GetNextToken();
wxString wxstrFromLong = tok1.GetNextToken();
wxString wxstrTo = ddTo->GetString(ddTo->GetCurrentSelection());
wxStringTokenizer tok2(wxstrTo, _("\t"));
wxString wxstrToShort = tok2.GetNextToken();
wxString wxstrToLong= tok2.GetNextToken();
//wxString wxstrTo = ddTo->GetData(ddTo->GetCurrentSelection());
string strVar = ws2s(wxstrId);
string strDescr = ws2s(wxstrDescr);
string strFrom = ws2s(wxstrFromShort);
string strTo = ws2s(wxstrToShort);
// USE CREATETRANSFER FUNCTION AND REMOVE CALL ON GETTRANSFERS
createTransfer(wxstrToShort, wxstrFromShort, wxstrId, wxstrDescr);
// Expression::makeToken(strVar); // moved to Transfer::create(...)
populateList();
TextCtrl1->Clear();
TextCtrl2->Clear();
TextCtrl1->SetFocus();
}
示例2: s2ws
std::vector<std::string>* DataInDirectoryInvestigator::SearchFiles(std::string fileType){
this->fileType = fileType;
std::string searchQuery = dirPath;
searchQuery.append(fileType);
std::wstring stemp = s2ws(searchQuery);
LPCWSTR DIRPATH = stemp.c_str();
std::cout << "Searching Files in " << dirPath << std::endl;
std::vector<std::string> * acquiredFilePaths = new std::vector<std::string>();
HANDLE hFind;
WIN32_FIND_DATA w32fd;
hFind = FindFirstFile(DIRPATH, &w32fd);
if( hFind != INVALID_HANDLE_VALUE){
do {
//std::cout << "cAlternateFileName : " << ws2s(w32fd.cAlternateFileName) << std::endl;
//printf("ファイル名:%S\n", w32fd.cFileName);
std::cout << "ファイル名: " << ws2s(w32fd.cFileName) << std::endl;
acquiredFilePaths->push_back(ws2s(w32fd.cFileName));
} while (FindNextFile (hFind, &w32fd));
FindClose(hFind);
}
return acquiredFilePaths;
}
示例3: ws2s
Transfer *TransfersDialog::createTransfer(wxString &to, wxString &from, wxString &name, wxString &descr)
{
string strVar = ws2s(name);
string strDescr = ws2s(descr);
string strFrom = ws2s(from);
string strTo = ws2s(to);
return Transfer::create(strTo, strFrom, strVar, strDescr);
}
示例4: wWinMain
int WINAPI wWinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LPWSTR lpCmdLine, int /* nCmdShow */)
{
LPWSTR* arg_list;
int arg_num = 0;
// Ignore the return value because we want to continue running even in the
// unlikely event that HeapSetInformation fails.
HeapSetInformation(NULL, HeapEnableTerminationOnCorruption, NULL, 0);
if (SUCCEEDED(CoInitialize(NULL)))
{
App *app = new App();
arg_list = CommandLineToArgvW(lpCmdLine, &arg_num);
if (arg_num == 2)
{
CardData data;
strcpy_s(data.username, ws2s(arg_list[0]).c_str());
strcpy_s(data.password, ws2s(arg_list[1]).c_str());
try
{
NFC_READER->Initialize();
NFC_READER->Write(data);
NFC_READER->Uninitialize();
}
catch (...)
{
MessageBox(NULL, L"שגיאה התרחשה בכתיבה לכרטיס או שלא נמצא כרטיס...", L"שים/י לב!", STDMSGBOX | MB_ICONWARNING);
return 1;
}
return 0;
}
if (SUCCEEDED(app->Initialize()))
{
app->ChangeScreenTo(App::Screens::WaitingToCardScreen);
MSG msg;
memset(&msg, 0, sizeof(msg));
while (app->AppMode != -1)
{
if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
app->Update();
app->Render();
}
}
delete app;
CoUninitialize();
}
return 0;
}
示例5: OpenPath
void CDlgController::OpenFile(const std::wstring& wstrFilename)
{
if (IOReadBase::Exists(ws2s(wstrFilename)))
{
OpenPath(GetParentPath(wstrFilename),s2ws(CRenderNodeMgr::getInstance().getDataPlugsMgr().getAllExtensions()));
//m_ListBoxFolder.SetSelec()
//GetFilename(wstrFilename)
CMainRoot::getInstance().getMainDialog().getModelDisplay().LoadModel(ws2s(wstrFilename));
CMainRoot::getInstance().getMainDialog().getDlgModelController().OnUpdate();
}
}
示例6: FindFirstFile
bool ZipResourceDepot::RegisterPackages(std::wstring basePackagePath)
{
HANDLE fileHandle;
WIN32_FIND_DATA findData;
//Get first file
std::wstring pathSpec = basePackagePath + L"*";
fileHandle = FindFirstFile(pathSpec.c_str(), &findData);
if (fileHandle != INVALID_HANDLE_VALUE)
{
//Loop on all remaining entries
while (FindNextFile(fileHandle, &findData))
{
//Skip if file is hidden
if (findData.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN)
{
continue;
}
//Do not currently support packages within directories, so throw Warning
if (findData.dwFileAttributes &FILE_ATTRIBUTE_DIRECTORY)
{
//Do not warn for directory symbol
if (findData.cFileName != s2ws(".."))
{
BE_WARNING("Packages within Directories are ignored");
}
}
else
{
std::wstring filename = findData.cFileName;
std::wstring lowerPackageName = filename;
std::transform(lowerPackageName.begin(), lowerPackageName.end(), lowerPackageName.begin(), (int(*)(int))std::tolower);
lowerPackageName = lowerPackageName.substr(0, lowerPackageName.find_last_of('.'));
pathSpec = pathSpec.substr(0, pathSpec.find_last_of('/'));
pathSpec = pathSpec + s2ws("/") + filename;
//Add Package to mapping
m_packageMap[ws2s(lowerPackageName)] = PackageMappingDetails(m_numPackages, ws2s(pathSpec));
m_numPackages++;
}
}
}
FindClose(fileHandle);
return true;
}
示例7: OnCbnSelchangeComboSoure
void CProSetCameraTab::OnCbnSelchangeComboSoure()
{
CString name;
m_ComboSource.GetLBText(m_ComboSource.GetCurSel(),name);
wstring wname = name;
m_pConfigCenter->SetCameraName(ws2s(wname));
}
示例8: pStm
void OIBReader::ReadStream(POLE::Storage &pStg, wstring &stream_name)
{
POLE::Stream pStm(&pStg,ws2s(stream_name));
unsigned char *pbyData = 0;
//open
if (!pStm.eof() && !pStm.fail())
{
//get stream size
size_t sz = pStm.size();
//allocate
pbyData = new unsigned char[sz];
if (!pbyData) return;
//read
if (pStm.read(pbyData,sz)) {
//read oib info
if (stream_name == wstring(L"OibInfo.txt")) {
ReadOibInfo(pbyData, sz);
} else {
if (m_type==0 || (m_type==1 && m_oib_t==0))
ReadOif(pbyData, sz);
}
}
}
//release
if (pbyData)
delete[] pbyData;
}
示例9: _T
void CUpdateMgr::RestoreFile(wstring strRestorePath,wstring wsCurDirectory)
{
CFileFind fileFinder;
CString filePath ;//= strRestorePath.c_str() + _T("//*.*");
filePath.Format(_T("%s\\*.*"),strRestorePath.c_str());
BOOL bFinished = fileFinder.FindFile(filePath);
wstring wsDestfile;
wstring wsRestoreFile;
while(bFinished) //每次循环对应一个类别目录
{
bFinished = fileFinder.FindNextFile();
if(fileFinder.IsDirectory() && !fileFinder.IsDots()) //若是目录则递归调用此方法
{
// BayesCategoryTest(bt, fileFinder.GetFilePath());
}
else //再判断是否为txt文件
{
//获取文件类型
CString fileName = fileFinder.GetFileName();
if(fileName.Right(4).CompareNoCase(_T("_BAK")) == 0)
{
wsRestoreFile = strRestorePath + L"\\" + fileName.GetBuffer(0);
wsDestfile = wsCurDirectory + L"\\" + fileName.Left(fileName.GetLength()-4).GetBuffer(0);
BOOL bret = CsysFile::Copy(wsRestoreFile,wsDestfile);
if (FALSE == bret)
{
g_Logger.Error(__FILE__,__LINE__,"还原文件失败 restore %s to %s",ws2s(wsRestoreFile).c_str(),ws2s(wsDestfile).c_str());
}
}
}
}
}
示例10: ws2s
//----------------------------------------------------------------
void CPUTConfigEntry::ValueAsFloatArray(float *pFloats, int count)
{
// char *szOrigValue = new char [szValue.length()+1];
//FIXME memory leak here
char *pString = ws2s(szValue.c_str());
//strcpy(szOrigValue, pString);
char *szNewValue = NULL;
char *szCurrValue = strtok_r(pString, " ", &szNewValue);
for(int clear = 0; clear < count; clear++)
{
pFloats[clear] = 0.0f;
}
for(int ii=0;ii<count;++ii)
{
if(szCurrValue == NULL)
{
delete pString;
return;
}
pFloats[ii] = (float) atof(szCurrValue);
szCurrValue = strtok_r(NULL, " ", &szNewValue);
}
//delete szOrigValue;
delete[] pString;
}
示例11: ws2s
string ProcessList::getNameByProcessId(DWORD pid) {
for (map<DWORD, wstring>::iterator it = cachedProcessList.begin(); it != cachedProcessList.end(); it++) {
if (it->first == pid) {
return ws2s(it->second).c_str();
}
}
return "";
}
示例12: IniGetStr
void CDlgUIList::OnDlgListBoxDblClk()
{
if (m_ListBox.GetSelectedItem())
{
std::string strEditUIFilename = IniGetStr("UIEditorUI.cfg","UIConfig","edit");
createDialogCodeFromXML(strEditUIFilename,ws2s(m_ListBox.GetSelectedItem()->wstrText));
}
}
示例13: ws2s
// buffer pointed to by pOut must be large enough for data
bool CommandParser::GetParameter(cString arg, char *pOut)
{
std::map<cString, cString>::iterator it;
std::stringstream ss;
it = m_ArgumentMap.find(arg);
if (it == m_ArgumentMap.end())
return false;
#ifdef CPUT_OS_ANDROID
ss << ws2s(it->second.c_str());
#else
ss << ws2s(it->second);
#endif
ss >> pOut;
return true;
}
示例14: ReadMacrosFromConfigBlock
//-----------------------------------------------------------------------------
void ReadMacrosFromConfigBlock(
CPUTConfigBlock *pMacrosBlock,
CPUT_SHADER_MACRO *pShaderMacros,
CPUT_SHADER_MACRO **pUserSpecifiedMacros,
int *pNumUserSpecifiedMacros,
CPUT_SHADER_MACRO **pFinalShaderMacros
){
*pNumUserSpecifiedMacros = pMacrosBlock->ValueCount();
// Count the number of macros passed in
CPUT_SHADER_MACRO *pMacro = (CPUT_SHADER_MACRO*)pShaderMacros;
int numPassedInMacros = 0;
if( pMacro )
{
while( pMacro->Name )
{
++numPassedInMacros;
++pMacro;
}
}
// Allocate an array of macro pointer large enough to contain the passed-in macros plus those specified in the .mtl file.
*pFinalShaderMacros = new CPUT_SHADER_MACRO[*pNumUserSpecifiedMacros + numPassedInMacros + 1];
// Copy the passed-in macro pointers to the final array
int jj;
for( jj=0; jj<numPassedInMacros; jj++ )
{
(*pFinalShaderMacros)[jj] = *(CPUT_SHADER_MACRO*)&pShaderMacros[jj];
}
// Create a CPUT_SHADER_MACRO for each of the macros specified in the .mtl file.
// And, add their pointers to the final array
*pUserSpecifiedMacros = new CPUT_SHADER_MACRO[*pNumUserSpecifiedMacros];
for( int kk=0; kk<*pNumUserSpecifiedMacros; kk++, jj++ )
{
CPUTConfigEntry *pValue = pMacrosBlock->GetValue(kk);
(*pUserSpecifiedMacros)[kk].Name = ws2s(pValue->NameAsString());
(*pUserSpecifiedMacros)[kk].Definition = ws2s(pValue->ValueAsString());
(*pFinalShaderMacros)[jj] = (*pUserSpecifiedMacros)[kk];
}
(*pFinalShaderMacros)[jj].Name = NULL;
(*pFinalShaderMacros)[jj].Definition = NULL;
}
示例15:
vector<string> &RunDialog::getCheckedItems()
{
int nItems = CheckListBox1->GetCount();
for (int i = 0; i < nItems; i++) {
if (CheckListBox1->IsChecked(i)) {
checkedItems.push_back(ws2s(CheckListBox1->GetString(i)));
}
}
return checkedItems;
}