本文整理汇总了C++中SPString::c_str方法的典型用法代码示例。如果您正苦于以下问题:C++ SPString::c_str方法的具体用法?C++ SPString::c_str怎么用?C++ SPString::c_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SPString
的用法示例。
在下文中一共展示了SPString::c_str方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetCursor
bool SPInputManager::SetCursor( SPString path )
{
SPFilePtr file = SPFileManager::GetSingleton().OpenFile(path);
if (!file)
{
return false;
}
LONGLONG length = file->GetFileLength();
char* pData = new char[length];
file->Read(pData, length);
wchar_t tname[10];
_wtmpnam_s(tname, 10);
SPString name = SPString(tname);// + path.substr(path.find_last_of(L".") + 1);
HANDLE newFile = CreateFile(name.c_str(), GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL,
CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (newFile == INVALID_HANDLE_VALUE)
{
return false;
}
DWORD numOfByte;
if(FALSE == WriteFile(newFile, pData, length, &numOfByte, NULL))
{
delete [] pData;
SPFileManager::GetSingleton().CloseFile(path);
CloseHandle(newFile);
DeleteFile(name.c_str());
return false;
}
CloseHandle(newFile);
HCURSOR cursor = LoadCursorFromFile(name.c_str());
if (!cursor)
{
DWORD err = GetLastError();
delete [] pData;
SPFileManager::GetSingleton().CloseFile(path);
CloseHandle(newFile);
DeleteFile(name.c_str());
return false;
}
SPWindow::GetSingleton().SetCursor(cursor);
DeleteFile(name.c_str());
delete [] pData;
SPFileManager::GetSingleton().CloseFile(path);
//CloseHandle(newFile);
return true;
}
示例2: SetTitle
void SPWindow::SetTitle( SPString title )
{
modificationLock.Lock();
SetWindowText(GetHWnd(), title.c_str());
this->title = title;
modificationLock.Unlock();
}
示例3: MakeSurePathExist
void SPPathHelper::MakeSurePathExist( SPString path )
{
SPPointer<SPStringList> parts = SplitPath(path);
SPString currentDir = (*parts)[0];
for (int i = 0; i < parts->size() - 1; i++)
{
CreateDirectory(currentDir.c_str(), NULL);
currentDir = currentDir + L"\\" + (*parts)[i + 1];
}
}
示例4: CreatePath
bool SPFileHelper::CreatePath( SPString path )
{
if (path.size() == 0 || path == L"/" || path == L"\\")
{
return true;
}
if(IsPathExists(path.c_str()))
{
return true;
}
if(!CreatePath(GetUpperPath(path)))
{
return false;
}
if( FALSE == CreateDirectory(path.c_str(), NULL))
{
return false;
}
return true;
}
示例5: Load
bool SPFont::Load(
INT Height,
UINT Width,
UINT Weight,
UINT MipLevels,
BOOL Italic,
DWORD CharSet,
DWORD OutputPrecision,
DWORD Quality,
DWORD PitchAndFamily,
SPString FontName )
{
float rate = SPFontManager::GetSingleton().GetSizeRate();
if (FAILED(D3DXCreateFont(
SPDevice::GetSingleton().GetD3DDevice(),
Height * rate , Width * rate, Weight, MipLevels, Italic,
CharSet, OutputPrecision, Quality,
PitchAndFamily, FontName.c_str(), &font)))
{
return false;
}
//D3DXFONT_DESCA des;
//Font->GetDescA(&des);
width = Width;
height = Height;
weight = Weight;
italic = Italic == TRUE;
miplevel = MipLevels;
name = FontName;
return true;
}
示例6: Load
bool SPXAudio::Load()
{
TCHAR Buffer[MAX_PATH];
GetSystemDirectory(Buffer, MAX_PATH);
SPString path = SPString(Buffer) + L"\\XAudio2_7.dll";
if(PathFileExists( path.c_str()) == FALSE)
{
// Register xaudio
SPLogHelper::WriteLog(L"[XAudio] Copying XAudio " + path );
CopyFile(L"XAudio2_7.dll", path.c_str(), TRUE);
SPLogHelper::WriteLog("[XAudio] Registering XAudio ..." );
UINT result = WinExec("regsvr32.exe XAudio2_7.dll ", SW_HIDE);
}
//void* fnc = GetProcAddress(module, "XAudio2Create");
SPLogHelper::WriteLog("[XAudio] Initializing XAudio ...");
HRESULT hr = S_OK;//CoInitializeEx(NULL, COINIT_MULTITHREADED);
if (FAILED(hr) && hr != -2147417850)
{
SPLogHelper::WriteLog("[XAudio] ERROR: Failed to initialize XAudio2!");
SPMessageHelper::Msg("Failed to initialize XAudio2!");
return false;
}
IXAudio2* pXAudio2;
hr = CoCreateInstance((0 & XAUDIO2_DEBUG_ENGINE) ? __uuidof(XAudio2_Debug) : __uuidof(XAudio2),
NULL, CLSCTX_INPROC_SERVER, __uuidof(IXAudio2), (void**)&pXAudio2);
if (SUCCEEDED(hr))
{
hr = pXAudio2->Initialize(0, XAUDIO2_DEFAULT_PROCESSOR);
if (SUCCEEDED(hr))
{
xAudio = pXAudio2;
}
else
{
pXAudio2->Release();
}
}
else
{
SPLogHelper::WriteLog("[XAudio] ERROR: Failed to create XAudio2! %d %d", __uuidof(IXAudio2), __uuidof(XAudio2_Debug));
}
//hr = XAudio2Create( &xAudio, 0, XAUDIO2_DEFAULT_PROCESSOR );
if (FAILED(hr))
{
SPLogHelper::WriteLog("[XAudio] ERROR: Failed to create XAudio2! %d %d", hr, GetLastError());
SPMessageHelper::Msg("Failed to create XAudio2!");
return false;
}
// Enumerate and select devices
UINT32 deviceCount;
xAudio->GetDeviceCount(&deviceCount);
XAUDIO2_DEVICE_DETAILS deviceDetails;
int preferredDevice = 0;
for (unsigned int i = 0; i < deviceCount; i++)
{
xAudio->GetDeviceDetails(i,&deviceDetails);
if (deviceDetails.OutputFormat.Format.nChannels > 2)
{
preferredDevice = i;
break;
}
}
// Create mastering voice device
if ( FAILED(xAudio->CreateMasteringVoice( &masterVoice, XAUDIO2_DEFAULT_CHANNELS,
XAUDIO2_DEFAULT_SAMPLERATE, 0, preferredDevice, NULL ) ) )
{
SPLogHelper::WriteLog("[XAudio] WARNING: Failed to create Mastering Voice!");
//MessageBoxA(NULL, "Failed to create mastering voice!", NULL, NULL);
Unload();
return false;
}
return true;
}
示例7: IsPathExists
bool SPFileHelper::IsPathExists( SPString path )
{
return TRUE == PathFileExists(path.c_str());
}