C# Class NGit.Util.QuotedString

Utility functions related to quoted string handling.
Utility functions related to quoted string handling.
Show file Open project: red-gate/ngit

Public Properties

Property Type Description
BOURNE QuotedString.BourneStyle
BOURNE_USER_PATH QuotedString.BourneUserPathStyle
GIT_PATH QuotedString.GitPathStyle

Public Methods

Method Description
Dequote ( byte @in, int offset, int end ) : string

Decode a previously quoted input, scanning a UTF-8 encoded buffer.

Decode a previously quoted input, scanning a UTF-8 encoded buffer.

This method must match quote such that:

 a.equals(dequote(Constants.encode(quote(a)))); 
is true for any a.

This method removes any opening/closing quotation marks added by Quote(string) .

Dequote ( string @in ) : string

Clean a previously quoted input, decoding the result via UTF-8.

Clean a previously quoted input, decoding the result via UTF-8.

This method must match quote such that:

 a.equals(dequote(quote(a))); 
is true for any a.
Quote ( string @in ) : string

Quote an input string by the quoting rules.

Quote an input string by the quoting rules.

If the input string does not require any quoting, the same String reference is returned to the caller.

Otherwise a quoted string is returned, including the opening and closing quotation marks at the start and end of the string. If the style does not permit raw Unicode characters then the string will first be encoded in UTF-8, with unprintable sequences possibly escaped by the rules.

Method Details

Dequote() public abstract method

Decode a previously quoted input, scanning a UTF-8 encoded buffer.
Decode a previously quoted input, scanning a UTF-8 encoded buffer.

This method must match quote such that:

 a.equals(dequote(Constants.encode(quote(a)))); 
is true for any a.

This method removes any opening/closing quotation marks added by Quote(string) .

public abstract Dequote ( byte @in, int offset, int end ) : string
@in byte
offset int first position within in to scan.
end int one position past in in to scan.
return string

Dequote() public method

Clean a previously quoted input, decoding the result via UTF-8.
Clean a previously quoted input, decoding the result via UTF-8.

This method must match quote such that:

 a.equals(dequote(quote(a))); 
is true for any a.
public Dequote ( string @in ) : string
@in string
return string

Quote() public abstract method

Quote an input string by the quoting rules.
Quote an input string by the quoting rules.

If the input string does not require any quoting, the same String reference is returned to the caller.

Otherwise a quoted string is returned, including the opening and closing quotation marks at the start and end of the string. If the style does not permit raw Unicode characters then the string will first be encoded in UTF-8, with unprintable sequences possibly escaped by the rules.

public abstract Quote ( string @in ) : string
@in string
return string

Property Details

BOURNE public static property

Quoting style used by the Bourne shell.
Quoting style used by the Bourne shell.

Quotes are unconditionally inserted during Quote(string) . This protects shell meta-characters like $ or ~ from being recognized as special.

public static QuotedString.BourneStyle,NGit.Util BOURNE
return QuotedString.BourneStyle

BOURNE_USER_PATH public static property

Bourne style, but permits ~user at the start of the string.
Bourne style, but permits ~user at the start of the string.
public static QuotedString.BourneUserPathStyle,NGit.Util BOURNE_USER_PATH
return QuotedString.BourneUserPathStyle

GIT_PATH public static property

Quoting style that obeys the rules Git applies to file names
public static QuotedString.GitPathStyle,NGit.Util GIT_PATH
return QuotedString.GitPathStyle