|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.perforce.p4java.option.Options
com.perforce.p4java.option.server.MatchingLinesOptions
public class MatchingLinesOptions
Options objects for the IOptionsServer getMatchingLines command. Note that not all "p4 grep" options are currently implemented or recognized; see the comments below for a list of recognized and non-recognized options and their semantics.
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 -Aflag displays num lines of trailing context after matching lines. The -B flag displays num lines of leading context before matching lines. The -C 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.
IOptionsServer.getMatchingLines(java.util.List, java.lang.String, com.perforce.p4java.option.server.MatchingLinesOptions)
Field Summary | |
---|---|
protected boolean |
allRevisions
Corresponds to the p4 grep "-a" option |
protected boolean |
caseInsensitive
Corresponds to the p4 grep -i option |
protected boolean |
fixedPattern
Corresponds to the p4 grep -F and -G options: if true, corresponds to -F; if false, to -G |
protected boolean |
includeLineNumbers
Corresponds to the p4 grep -n option |
protected int |
leadingContext
Corresponds to the p4 grep -B option; if zero, option is off |
protected boolean |
nonMatchingLines
Corresponds to the p4 grep -v option |
static String |
OPTIONS_SPECS
Options: -a, -i, -n, -v, -A[n], -B[n], -C[n], -t, -F|-G |
protected int |
outputContext
Corresponds to the p4 grep -C option; if zero, option is off |
protected boolean |
searchBinaries
Corresponds to the p4 grep -t option |
protected int |
trailingContext
Corresponds to the p4 grep -A option; if zero, option is off |
Fields inherited from class com.perforce.p4java.option.Options |
---|
immutable, optionList, OPTPFX |
Constructor Summary | |
---|---|
MatchingLinesOptions()
Default 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 | |
---|---|
int |
getLeadingContext()
|
int |
getOutputContext()
|
int |
getTrailingContext()
|
boolean |
isAllRevisions()
|
boolean |
isCaseInsensitive()
|
boolean |
isFixedPattern()
|
boolean |
isIncludeLineNumbers()
|
boolean |
isNonMatchingLines()
|
boolean |
isSearchBinaries()
|
List<String> |
processOptions(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. |
MatchingLinesOptions |
setAllRevisions(boolean allRevisions)
|
MatchingLinesOptions |
setCaseInsensitive(boolean caseInsensitive)
|
MatchingLinesOptions |
setFixedPattern(boolean fixedPattern)
|
MatchingLinesOptions |
setIncludeLineNumbers(boolean includeLineNumbers)
|
MatchingLinesOptions |
setLeadingContext(int leadingContext)
|
MatchingLinesOptions |
setNonMatchingLines(boolean nonMatchingLines)
|
MatchingLinesOptions |
setOutputContext(int outputContext)
|
MatchingLinesOptions |
setSearchBinaries(boolean searchBinaries)
|
MatchingLinesOptions |
setTrailingContext(int trailingContext)
|
Methods inherited from class com.perforce.p4java.option.Options |
---|
applyRule, applyRule, applyRule, applyRule, getOptions, isImmutable, processFields, setImmutable, setOptions |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String OPTIONS_SPECS
protected boolean allRevisions
protected boolean caseInsensitive
protected boolean includeLineNumbers
protected boolean nonMatchingLines
protected boolean searchBinaries
protected int outputContext
protected int trailingContext
protected int leadingContext
protected boolean fixedPattern
Constructor Detail |
---|
public MatchingLinesOptions()
public MatchingLinesOptions(boolean allRevisions, boolean caseInsensitive, boolean includeLineNumbers, boolean nonMatchingLines, boolean searchBinaries, int outputContext, int trailingContext, int leadingContext, boolean fixedPattern)
public MatchingLinesOptions(String... 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.
Options.Options(java.lang.String...)
Method Detail |
---|
public List<String> processOptions(IServer server) throws OptionsException
Options
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.
processOptions
in class Options
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...
OptionsException
- if an error occurs in options processing that is
not some species of ConnectionException, RequestException,
AccessException, etc.Options.processOptions(com.perforce.p4java.server.IServer)
public boolean isAllRevisions()
public MatchingLinesOptions setAllRevisions(boolean allRevisions)
public boolean isCaseInsensitive()
public MatchingLinesOptions setCaseInsensitive(boolean caseInsensitive)
public boolean isIncludeLineNumbers()
public MatchingLinesOptions setIncludeLineNumbers(boolean includeLineNumbers)
public boolean isNonMatchingLines()
public MatchingLinesOptions setNonMatchingLines(boolean nonMatchingLines)
public boolean isSearchBinaries()
public MatchingLinesOptions setSearchBinaries(boolean searchBinaries)
public int getOutputContext()
public MatchingLinesOptions setOutputContext(int outputContext)
public int getTrailingContext()
public MatchingLinesOptions setTrailingContext(int trailingContext)
public int getLeadingContext()
public MatchingLinesOptions setLeadingContext(int leadingContext)
public boolean isFixedPattern()
public MatchingLinesOptions setFixedPattern(boolean fixedPattern)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |