logical ODE_SearchReplace :: GetData (char *scope, logical do_replace, CTX_GUIBase *ctxptr )
{
  static const RegExp  deregex_search("([][*.^${}()?\\\\])", "\\\\$1");
  static const RegExp  deregex_replace("([\\\\$])","\\\\$1");
  std::string          search;
  std::string          replace;
  logical              term   = NO;
BEGINSEQ
  if ( Initialize(scope,do_replace) )                ERROR
    
  if ( ctxptr->ExecuteWindow(this,"FORM_SearchReplace",
                             do_replace ? "Replace" : "Search",NO) )
                                                     ERROR
  if ( !IsRegExp() )
  {
    search  = GetSearchString();
    replace = GetReplaceString();
    
    deregex_search.Replace(search);
    deregex_replace.Replace(replace);
    
    search_string.SetValue(const_cast<char *>(search.c_str()));
    replace_string.SetValue(const_cast<char *>(replace.c_str()));
  }

RECOVER
  term = YES;
ENDSEQ
  return(term);
}
예제 #2
0
BOOL CRegExp::GetReplaceString(LPCTSTR lpszReplaceExp, CString & szReplaceString)
{
	TCHAR * pReplaceString = GetReplaceString(lpszReplaceExp);
	if( ! pReplaceString ) return FALSE;
	szReplaceString = pReplaceString;
	delete pReplaceString;
	return TRUE;
}