Class MatchingLinesOptions
The -a flag searches all revisions within the specific range, rather
than just the highest revision in the range.
The -i flag causes the pattern matching to be case insensitive, by
default matching is case sensitive.
The -n flag displays the matching line number after the file revision
number, by default output of matched files consist of the revision
and the matched line separated by a colon ':'.
The -v flag displays files with non-matching lines.
The -F flag is used to interpret the pattern as a fixed string.
The -G flag is used to interpret the pattern as a regular expression,
the default behavior.
The -t flag instructs grep to treat binary files as text. By default
only files of type text are selected for pattern matching.
The -A <num> flag displays num lines of trailing context after
matching lines.
The -B <num> flag displays num lines of leading context before
matching lines.
The -C <num> flag displays num lines of output context.
The -s flag suppresses error messages that result from abandoning
files that have a maximum number of characters in a single line that
are greater than 4096. By default grep will abandon these files and
report an error.
The -L flag changes the output to display the name of each selected
file from which no output would normally have been displayed. The
scanning will stop on the first match.
The -l flag changes the output to display the name of each selected
file from which output would normally have been displayed. The
scanning will stop on the first match.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanCorresponds to the p4 grep "-a" optionprotected booleanCorresponds to the p4 grep -i optionprotected booleanCorresponds to the p4 grep -F and -G options: if true, corresponds to -F; if false, to -Gprotected booleanCorresponds to the p4 grep -n optionprotected intCorresponds to the p4 grep -B option; if zero, option is offprotected booleanCorresponds to the p4 grep -v optionstatic final StringOptions: -a, -i, -n, -v, -A[n], -B[n], -C[n], -t, -F|-Gprotected intCorresponds to the p4 grep -C option; if zero, option is offprotected booleanCorresponds to the p4 grep -t optionprotected intCorresponds to the p4 grep -A option; if zero, option is offFields inherited from class com.perforce.p4java.option.Options
immutable, optionList -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor.MatchingLinesOptions(boolean allRevisions, boolean caseInsensitive, boolean includeLineNumbers, boolean nonMatchingLines, boolean searchBinaries, int outputContext, int trailingContext, int leadingContext, boolean fixedPattern) Explicit value constructor.MatchingLinesOptions(String... options) Strings-based constructor; see 'p4 help [command]' for possible options. -
Method Summary
Modifier and TypeMethodDescriptionintintintbooleanbooleanbooleanbooleanbooleanbooleanprocessOptions(IServer server) Turn this (specific) options object into a list of strings to be sent to the Perforce server as options for a specific command.setAllRevisions(boolean allRevisions) setCaseInsensitive(boolean caseInsensitive) setFixedPattern(boolean fixedPattern) setIncludeLineNumbers(boolean includeLineNumbers) setLeadingContext(int leadingContext) setNonMatchingLines(boolean nonMatchingLines) setOutputContext(int outputContext) setSearchBinaries(boolean searchBinaries) setTrailingContext(int trailingContext) Methods inherited from class com.perforce.p4java.option.Options
getOptions, isImmutable, processFields, setImmutable, setOptions
-
Field Details
-
OPTIONS_SPECS
Options: -a, -i, -n, -v, -A[n], -B[n], -C[n], -t, -F|-G- See Also:
-
allRevisions
protected boolean allRevisionsCorresponds to the p4 grep "-a" option -
caseInsensitive
protected boolean caseInsensitiveCorresponds to the p4 grep -i option -
includeLineNumbers
protected boolean includeLineNumbersCorresponds to the p4 grep -n option -
nonMatchingLines
protected boolean nonMatchingLinesCorresponds to the p4 grep -v option -
searchBinaries
protected boolean searchBinariesCorresponds to the p4 grep -t option -
outputContext
protected int outputContextCorresponds to the p4 grep -C option; if zero, option is off -
trailingContext
protected int trailingContextCorresponds to the p4 grep -A option; if zero, option is off -
leadingContext
protected int leadingContextCorresponds to the p4 grep -B option; if zero, option is off -
fixedPattern
protected boolean fixedPatternCorresponds to the p4 grep -F and -G options: if true, corresponds to -F; if false, to -G
-
-
Constructor Details
-
MatchingLinesOptions
public MatchingLinesOptions()Default constructor. -
MatchingLinesOptions
public MatchingLinesOptions(boolean allRevisions, boolean caseInsensitive, boolean includeLineNumbers, boolean nonMatchingLines, boolean searchBinaries, int outputContext, int trailingContext, int leadingContext, boolean fixedPattern) Explicit value constructor.- Parameters:
allRevisions- allRevisionscaseInsensitive- caseInsensitiveincludeLineNumbers- includeLineNumbersnonMatchingLines- nonMatchingLinessearchBinaries- searchBinariesoutputContext- outputContexttrailingContext- trailingContextleadingContext- leadingContextfixedPattern- fixedPattern
-
MatchingLinesOptions
Strings-based constructor; see 'p4 help [command]' for possible options.WARNING: you should not pass more than one option or argument in each string parameter. Each option or argument should be passed-in as its own separate string parameter, without any spaces between the option and the option value (if any).
NOTE: setting options this way always bypasses the internal options values, and getter methods against the individual values corresponding to the strings passed in to this constructor will not normally reflect the string's setting. Do not use this constructor unless you know what you're doing and / or you do not also use the field getters and setters.
- Parameters:
options- options- See Also:
-
-
Method Details
-
processOptions
Description copied from class:OptionsTurn this (specific) options object into a list of strings to be sent to the Perforce server as options for a specific command. As a side effect, set the option list associated with this Option to the result.The method is used by the server object to generate the string-based arguments expected by the Perforce server corresponding to the state of this method-specific options object. Will return an empty list if there are no "interesting" options set or available. May simply return the superclass options string list if is non-null, but that behaviour is neither guaranteed nor required.
Note that this method is not intended to be called directly by users but by the underlying P4Java plumbing; odd results may occur if this method is called in other contexts.
- Specified by:
processOptionsin classOptions- Parameters:
server- possibly-null IServer representing the Perforce server the options are to be used against. If this parameter is null, it is acceptable to throw an OptionsException, but it is also possible to ignore it and do the best you can with what you've got...- Returns:
- non-null (but possibly empty) string list representing the normalized Perforce server arguments corresponding to the state of this specific options object.
- Throws:
OptionsException- if an error occurs in options processing that is not some species of ConnectionException, RequestException, AccessException, etc.- See Also:
-
isAllRevisions
public boolean isAllRevisions() -
setAllRevisions
-
isCaseInsensitive
public boolean isCaseInsensitive() -
setCaseInsensitive
-
isIncludeLineNumbers
public boolean isIncludeLineNumbers() -
setIncludeLineNumbers
-
isNonMatchingLines
public boolean isNonMatchingLines() -
setNonMatchingLines
-
isSearchBinaries
public boolean isSearchBinaries() -
setSearchBinaries
-
getOutputContext
public int getOutputContext() -
setOutputContext
-
getTrailingContext
public int getTrailingContext() -
setTrailingContext
-
getLeadingContext
public int getLeadingContext() -
setLeadingContext
-
isFixedPattern
public boolean isFixedPattern() -
setFixedPattern
-