BOOL CConvertMacro2::IsFindKey(wstring src, wstring key) { //���K�\�����[�h if( this->regExp != NULL && src.size() > 0 && key.size() > 0 ){ try{ _bstr_t target( src.c_str() ); _bstr_t pattern( key.c_str() ); this->regExp->PutGlobal( VARIANT_TRUE ); this->regExp->PutPattern( pattern ); IMatchCollectionPtr pMatchCol( this->regExp->Execute( target ) ); if( pMatchCol->Count > 0 ){ return TRUE; } }catch(...){ } } return FALSE; }
BOOL CEpgDBManager::IsFindKeyword(BOOL regExpFlag, BOOL titleOnlyFlag, vector<wstring>* keyList, EPGDB_SHORT_EVENT_INFO* shortInfo, EPGDB_EXTENDED_EVENT_INFO* extInfo, BOOL andMode, wstring* findKey) { if( shortInfo == NULL ){ //基本情報ないので対象外 return FALSE; } //検索対象の文字列作成 wstring word = shortInfo->search_event_name; if( titleOnlyFlag == FALSE ){ word += shortInfo->search_text_char; if( extInfo != NULL ){ word += extInfo->search_text_char; } } if( regExpFlag == TRUE ){ //正規表現モード if( this->regExp != NULL && word.size() > 0 && keyList->size() > 0 ){ try{ _bstr_t target( word.c_str() ); _bstr_t pattern( (*keyList)[0].c_str() ); this->regExp->PutGlobal( VARIANT_TRUE ); this->regExp->PutPattern( pattern ); IMatchCollectionPtr pMatchCol( this->regExp->Execute( target ) ); if( pMatchCol->Count > 0 ){ if( findKey != NULL ){ IMatch2Ptr pMatch( pMatchCol->Item[0] ); _bstr_t value( pMatch->Value ); *findKey = value; } return TRUE; } }catch(...){ } } return FALSE; }else{ //通常 if( andMode == TRUE ){ for( size_t i=0; i<keyList->size(); i++ ){ if( word.find((*keyList)[i]) == string::npos ){ //見つからなかったので終了 return FALSE; }else{ if( findKey != NULL ){ if( findKey->size() > 0 ){ *findKey += L" "; } *findKey += (*keyList)[i]; } } } return TRUE; }else{ for( size_t i=0; i<keyList->size(); i++ ){ if( word.find((*keyList)[i]) != string::npos ){ //見つかったので終了 return TRUE; } } return FALSE; } } }