C# Class Kimono.KReplace

Inheritance: KFind, IDisposable
ファイルを表示 Open project: 0xd34df00d/Qross

Public Methods

Method Description
CloseReplaceNextDialog ( ) : void Close the "replace next?" dialog. The application should do this when the last match was hit. If the application deletes the KReplace, then "find previous" won't be possible anymore.
Dispose ( ) : void
KReplace ( string pattern, string replacement, long options ) : System
KReplace ( string pattern, string replacement, long options, QWidget parent ) : System Only use this constructor if you don't use KFindDialog, or if you use it as a modal dialog.
KReplace ( string pattern, string replacement, long options, QWidget parent, QWidget replaceDialog ) : System This is the recommended constructor if you also use KReplaceDialog (non-modal). You should pass the pointer to it here, so that when a message box appears it has the right parent. Don't worry about deletion, KReplace will notice if the find dialog is closed.
NumReplacements ( ) : int Return the number of replacements made (i.e. the number of times the replace signal was emitted). Can be used in a dialog box to tell the user how many replacements were made. The final dialog does so already, unless you used setDisplayFinalDialog(false).
Replace ( ) : KFind.Result Walk the text fragment (e.g. kwrite line, kspread cell) looking for matches. For each match, if prompt-on-replace is specified, emits the highlight() signal and displays the prompt-for-replace dialog before doing the replace.
Replace ( StringBuilder text, Qyoto.QRegExp pattern, string replacement, int index, long options, int &replacedLength ) : int
Replace ( StringBuilder text, string pattern, string replacement, int index, long options, int &replacedLength ) : int Search the given string, replaces with the given replacement string, and returns whether a match was found. If one is, the replacement string length is also returned. A performance optimised version of the function is provided for use with regular expressions. name="text" The string to search. name="pattern" The pattern to look for. name="replacement" The replacement string to insert into the text. name="index" The starting index into the string. name="options" The options to use. name="replacedLength" Output parameter, contains the length of the replaced string. Not always the same as replacement.length(), when backreferences are used.
ReplaceNextDialog ( ) : Kimono.KDialog
ReplaceNextDialog ( bool create ) : Kimono.KDialog Return (or create) the dialog that shows the "find next?" prompt. Usually you don't need to call this. One case where it can be useful, is when the user selects the "Find" menu item while a find operation is under way. In that case, the program may want to call setActiveWindow() on that dialog.

Protected Methods

Method Description
CreateProxy ( ) : void
KReplace ( Type dummy ) : System

Private Methods

Method Description
DisplayFinalDialog ( ) : void
KReplace ( ) : System
ResetCounts ( ) : void
ShouldRestart ( ) : bool
ShouldRestart ( bool forceAsking ) : bool
ShouldRestart ( bool forceAsking, bool showNumMatches ) : bool

Method Details

CloseReplaceNextDialog() public method

Close the "replace next?" dialog. The application should do this when the last match was hit. If the application deletes the KReplace, then "find previous" won't be possible anymore.
public CloseReplaceNextDialog ( ) : void
return void

CreateProxy() protected method

protected CreateProxy ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

KReplace() protected method

protected KReplace ( Type dummy ) : System
dummy System.Type
return System

KReplace() public method

public KReplace ( string pattern, string replacement, long options ) : System
pattern string
replacement string
options long
return System

KReplace() public method

Only use this constructor if you don't use KFindDialog, or if you use it as a modal dialog.
public KReplace ( string pattern, string replacement, long options, QWidget parent ) : System
pattern string
replacement string
options long
parent Qyoto.QWidget
return System

KReplace() public method

This is the recommended constructor if you also use KReplaceDialog (non-modal). You should pass the pointer to it here, so that when a message box appears it has the right parent. Don't worry about deletion, KReplace will notice if the find dialog is closed.
public KReplace ( string pattern, string replacement, long options, QWidget parent, QWidget replaceDialog ) : System
pattern string
replacement string
options long
parent Qyoto.QWidget
replaceDialog Qyoto.QWidget
return System

NumReplacements() public method

Return the number of replacements made (i.e. the number of times the replace signal was emitted). Can be used in a dialog box to tell the user how many replacements were made. The final dialog does so already, unless you used setDisplayFinalDialog(false).
public NumReplacements ( ) : int
return int

Replace() public method

Walk the text fragment (e.g. kwrite line, kspread cell) looking for matches. For each match, if prompt-on-replace is specified, emits the highlight() signal and displays the prompt-for-replace dialog before doing the replace.
public Replace ( ) : KFind.Result
return KFind.Result

Replace() public static method

public static Replace ( StringBuilder text, Qyoto.QRegExp pattern, string replacement, int index, long options, int &replacedLength ) : int
text StringBuilder
pattern Qyoto.QRegExp
replacement string
index int
options long
replacedLength int
return int

Replace() public static method

Search the given string, replaces with the given replacement string, and returns whether a match was found. If one is, the replacement string length is also returned. A performance optimised version of the function is provided for use with regular expressions. name="text" The string to search. name="pattern" The pattern to look for. name="replacement" The replacement string to insert into the text. name="index" The starting index into the string. name="options" The options to use. name="replacedLength" Output parameter, contains the length of the replaced string. Not always the same as replacement.length(), when backreferences are used.
public static Replace ( StringBuilder text, string pattern, string replacement, int index, long options, int &replacedLength ) : int
text StringBuilder
pattern string
replacement string
index int
options long
replacedLength int
return int

ReplaceNextDialog() public method

public ReplaceNextDialog ( ) : Kimono.KDialog
return Kimono.KDialog

ReplaceNextDialog() public method

Return (or create) the dialog that shows the "find next?" prompt. Usually you don't need to call this. One case where it can be useful, is when the user selects the "Find" menu item while a find operation is under way. In that case, the program may want to call setActiveWindow() on that dialog.
public ReplaceNextDialog ( bool create ) : Kimono.KDialog
create bool
return Kimono.KDialog