本文整理汇总了C++中wstring::compare方法的典型用法代码示例。如果您正苦于以下问题:C++ wstring::compare方法的具体用法?C++ wstring::compare怎么用?C++ wstring::compare使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wstring
的用法示例。
在下文中一共展示了wstring::compare方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ReadOneline
/*!
sakura.iniの1行を処理する.
1行の読み込みが完了するごとに呼ばれる.
@param line [in] 読み込んだ行
*/
void CProfile::ReadOneline(
const wstring& line
)
{
// 空行を読み飛ばす
if( line.empty() )
return;
//コメント行を読みとばす
if( 0 == line.compare( 0, 2, LTEXT("//") ))
return;
// セクション取得
// Jan. 29, 2004 genta compare使用
if( line.compare( 0, 1, LTEXT("[") ) == 0
&& line.find( LTEXT("=") ) == line.npos
&& line.find( LTEXT("]") ) == ( line.size() - 1 ) ) {
Section Buffer;
Buffer.strSectionName = line.substr( 1, line.size() - 1 - 1 );
m_ProfileData.push_back( Buffer );
}
// エントリ取得
else if( !m_ProfileData.empty() ) { //最初のセクション以前の行のエントリは無視
wstring::size_type idx = line.find( LTEXT("=") );
if( line.npos != idx ) {
m_ProfileData.back().mapEntries.insert( PAIR_STR_STR( line.substr(0,idx), line.substr(idx+1) ) );
}
}
}
示例2: saveImage
void CameraWrapper::saveImage ( wstring image_name, wstring type)
{
IMAGE_FILE_PARAMS file_par;
file_par.pwchFileName = (wchar_t*)image_name.c_str ();
file_par.pnImageID = NULL;
file_par.ppcImageMem = NULL;
file_par.nQuality = 0;
if (type.compare(L"bmp") == 0) {
file_par.nFileType = IS_IMG_BMP;
}
else if (type.compare(L"png") == 0) {
file_par.nFileType = IS_IMG_PNG;
}
else if (type.compare(L"jpg") == 0) {
file_par.nFileType = IS_IMG_JPG;
}
else if (type.compare(L"tif") == 0) {
file_par.nFileType = IS_IMG_TIF;
}
else if (type.compare(L"raw") == 0) {
file_par.nFileType = IS_IMG_RAW;
}
else {
throw std::runtime_error ("Unsupported file format used for saving image");
}
int n_ret = is_ImageFile (h_cam, IS_IMAGE_FILE_CMD_SAVE, (void*)&file_par, sizeof (file_par));
if (n_ret == -1) {
logger << "Save image failed ..\n";
throw std::runtime_error ("Save image failed ..\n");
}
}
示例3: handleButtonEvents
void BugsButtonEventHandler::handleButtonEvents( Game *game,
wstring command)
{
// THE USER PRESSED THE Exit BUTTON ON THE MAIN MENU,
// SO LET'S SHUTDOWN THE ENTIRE APPLICATION
if (command.compare(W_EXIT_COMMAND) == 0)
{
game->shutdown();
}
// THE USER PRESSED THE MOUSE BUTTON ON THE SPLASH
// SCREEN, SO LET'S GO TO THE MAIN MENU
else if (command.compare(W_GO_TO_MM_COMMAND) == 0)
{
GameStateManager *gsm = game->getGSM();
gsm->goToMainMenu();
}
// THE USER PRESSED THE Start BUTTON ON THE MAIN MENU,
// SO LET'S START THE GAME FROM THE FIRST LEVEL
else if (command.compare(W_START_COMMAND) == 0)
{
game->setCurrentLevelFileName(W_LEVEL_1_NAME);
game->startGame();
}
// THE USER PRESSED THE Quit BUTTON ON THE IN-GAME MENU,
// SO LET'S UNLOAD THE LEVEL AND RETURN TO THE MAIN MENU
else if (command.compare(W_QUIT_COMMAND) == 0)
{
game->quitGame();
}
}
示例4: ParsePageID
/// <summary>Parses the page identifier</summary>
/// <param name="pageid">The pageid</param>
/// <param name="v">The associated game version</param>
/// <returns>Normalised page ID</returns>
/// <exception cref="Logic::InvalidValueException">Invalid pageID</exception>
UINT LanguageFileReader::ParsePageID(const wstring& pageid, GameVersion& v)
{
// X2: nnnn
if (pageid.length() <= 4)
{
v = GameVersion::Threat;
return _wtoi(pageid.c_str());
}
// X3: NNnnnn
else if (pageid.length() != 6)
throw InvalidValueException(HERE, VString(L"Invalid page ID '%s'", pageid.c_str()) );
// X3R: 30nnnn
else if (pageid.compare(0, 2, L"30") == 0)
v = GameVersion::Reunion;
// X3TC: 35nnnn
else if (pageid.compare(0, 2, L"35") == 0)
v = GameVersion::TerranConflict;
// X3AP: 38nnnn
else if (pageid.compare(0, 2, L"38") == 0)
v = GameVersion::AlbionPrelude;
else
throw InvalidValueException(HERE, VString(L"Invalid page ID '%s'", pageid.c_str()) );
// Convert last four digits of page ID
return _wtoi(pageid.substr(2).c_str());
}
示例5: getAttributesFromHTMLDOMNode
inline void getAttributesFromHTMLDOMNode(IHTMLDOMNode* pHTMLDOMNode,wstring& nodeName, map<wstring,wstring>& attribsMap) {
int res=0;
IDispatch* pDispatch=NULL;
LOG_DEBUG(L"Getting IHTMLDOMNode::attributes");
if(pHTMLDOMNode->get_attributes(&pDispatch)!=S_OK||!pDispatch) {
LOG_DEBUG(L"pHTMLDOMNode->get_attributes failed");
return;
}
IHTMLAttributeCollection2* pHTMLAttributeCollection2=NULL;
res=pDispatch->QueryInterface(IID_IHTMLAttributeCollection2,(void**)&pHTMLAttributeCollection2);
pDispatch->Release();
if(res!=S_OK) {
LOG_DEBUG(L"Could not get IHTMLAttributesCollection2");
return;
}
IHTMLDOMAttribute* tempAttribNode=NULL;
VARIANT tempVar;
macro_addHTMLAttributeToMap(L"id",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
if(nodeName.compare(L"TABLE")==0) {
macro_addHTMLAttributeToMap(L"summary",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
} else if(nodeName.compare(L"A")==0) {
macro_addHTMLAttributeToMap(L"href",true,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
} else if(nodeName.compare(L"INPUT")==0) {
macro_addHTMLAttributeToMap(L"type",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"value",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
} else if(nodeName.compare(L"TD")==0||nodeName.compare(L"TH")==0) {
macro_addHTMLAttributeToMap(L"headers",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"colspan",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"rowspan",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"scope",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
}
macro_addHTMLAttributeToMap(L"longdesc",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"alt",true,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"title",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"src",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"onclick",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"onmousedown",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"onmouseup",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
//ARIA properties:
macro_addHTMLAttributeToMap(L"role",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-valuenow",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-sort",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-labelledBy",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-describedBy",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-expanded",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-selected",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-level",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-required",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-dropeffect",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-grabbed",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-invalid",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-multiline",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-label",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
macro_addHTMLAttributeToMap(L"aria-hidden",false,pHTMLAttributeCollection2,attribsMap,tempVar,tempAttribNode);
pHTMLAttributeCollection2->Release();
}
示例6: bkpStr2Int
bkplong bkpStr2Int(const wstring &src)
{
if(!src.compare(L"true"))return 1;
if(!src.compare(L"false"))return 0;
if(!src.compare(L"void"))return 0;
if (src[0] == '-')
return -(bkplong)bkpwcstoxl(&src[1], NULL, 0);
if (src[0] == L'#')
return bkpColor2Int(src);
return bkpwcstoxl(src.c_str(), NULL, 0);
}
示例7: _isCurrentLanguageOk
bool IEAcceptLanguagesAction::_isCurrentLanguageOk(wstring& firstlang)
{
wstring langcode;
_readLanguageCode(langcode);
_parseLanguage(langcode);
_getFirstLanguage(firstlang);
// IE 6.0 uses two digit language codes, after IE 6 can also include country
return firstlang.compare(L"ca-es") == 0 || firstlang.compare(L"ca") == 0;
}
示例8: str2num
double str2num(const wstring &src)
{
if(!src.compare(L"true"))return 1;
if(!src.compare(L"false"))return 0;
if(!src.compare(L"void"))return 0;
if (src[0] == '-')
return -bkpwcstonum(&src[1], NULL);
if (src[0] == L'#')
return bkpColor2Int(src);
return bkpwcstonum(src.c_str(), NULL);
}
示例9: InjectToProcess
INT cInjector::InjectToProcess(wstring wProcName, wstring wDllName)
{
HANDLE hSnapshot;
PROCESSENTRY32 ProcessEntry;
INT nCount = 0;
hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
if(hSnapshot != INVALID_HANDLE_VALUE)
{
ProcessEntry.dwSize = sizeof(PROCESSENTRY32);
if(Process32First(hSnapshot, &ProcessEntry))
do {
if(!wProcName.compare(ProcessEntry.szExeFile))
{
HMODULE hDll = cInjector::GetRemoteDll(ProcessEntry.th32ProcessID, wDllName);
if(!hDll)
cInjector::InjectDLL(ProcessEntry.th32ProcessID, wDllName);
else cInjector::UnloadDLL(ProcessEntry.th32ProcessID, hDll);
nCount++;
}
ProcessEntry.dwSize = sizeof(PROCESSENTRY32);
} while(Process32Next(hSnapshot, &ProcessEntry));
}
CloseHandle(hSnapshot);
return nCount;
}
示例10: HasEnding
// Function to check the endig of a string
bool HasEnding(wstring const &fullString, wstring const &ending)
{
if (fullString.length() >= ending.length())
return (0 == fullString.compare(fullString.length() - ending.length(), ending.length(), ending));
else
return false;
}
示例11: if
VRegisteredDatabase::VRegisteredDatabase(const wstring& in_fullstring)
{
if (in_fullstring.compare(L"")!=0)
{
std::vector<wstring> split_vec;
boost::algorithm::split(split_vec, in_fullstring, boost::is_any_of(L";"));
if (split_vec.size()==4)
{
name = split_vec.at(0);
server = split_vec.at(1);
database = split_vec.at(2);
folder = split_vec.at(3);
count_days_backup = 7;
}
else if(split_vec.size()>=5)
{
//есть информаци¤ о кол-ве дней, допустимых без резервного копировани¤
name = split_vec.at(0);
server = split_vec.at(1);
database = split_vec.at(2);
folder = split_vec.at(3);
count_days_backup = atoi(wstring_to_string(split_vec.at(4).c_str()).c_str());
}
else
{
throw VSimpleException(L"ќшибка разбора строки", in_fullstring, boost::str(boost::wformat(L"%s") % __FILE__), __LINE__);
}
}
};
示例12: GetStrItemIndexOfSafeArray
int WindDataParser::GetStrItemIndexOfSafeArray(const VARIANT& safeArray, const wstring& itemNameStr)
{
if(!IsArray(safeArray))
{
return -1;
}
int length = GetCountOfSafeArray(safeArray);
HRESULT hr ;
BSTR *pbItems;
hr = SafeArrayAccessData(safeArray.parray, (void HUGEP**)&pbItems);
if (FAILED(hr))
{
return -1;
}
int nRetIndex = -1;
for(int index = 0; index < length; index++)
{
if (0 == itemNameStr.compare(pbItems[index]))
{
nRetIndex = index;
break;
}
}
SafeArrayUnaccessData(safeArray.parray);
return nRetIndex;
}
示例13: Read
void PSBoolReader::Read(const wstring& inReadFrom,bool& outValue)
{
if(inReadFrom.compare(L"true") == 0)
outValue = true;
else
outValue = false;
}
示例14: GetwstringValueFromConfig
bool ConfigWrapper::GetwstringValueFromConfig( const wstring& strKey, wstring& strValue )
{
if ( NUMBER_ZERO == strKey.compare( NULL_STRING ))
{
return false;
}
if ( NULL == m_pConfigManager )
{
return false;
}
ConfigValue* pSingleNode = NULL;
// pSingleNode = m_pConfigManager->SelectSingleNode( strKey );
TCHAR szNodeValue[MAX_VALUE_LENGTH];
DWORD dwReturnSize = pSingleNode->GetValue( szNodeValue );
strValue = szNodeValue;
if ( NULL != pSingleNode )
{
delete pSingleNode;
pSingleNode = NULL;
}
return true;
}
示例15: isImageFile
bool isImageFile(wstring &filename)
{
for (int i=0; imgtypelist[i] != NULL; i++)
{
if (filename.compare(imgtypelist[i]) == 0)
return true;
}
return false;
}