C# Класс Google.ProtocolBuffers.TextFormat

Provides ASCII text formatting support for messages. TODO(jonskeet): Support for alternative line endings. (Easy to print, via TextGenerator. Not sure about parsing.)
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Merge ( TextReader reader, ExtensionRegistry registry, IBuilder builder ) : void
Merge ( TextReader reader, IBuilder builder ) : void
Merge ( string text, ExtensionRegistry registry, IBuilder builder ) : void
Merge ( string text, IBuilder builder ) : void
Print ( IMessage message, TextWriter output ) : void

Outputs a textual representation of the Protocol Message supplied into the parameter output.

Print ( Google.ProtocolBuffers.UnknownFieldSet fields, TextWriter output ) : void

Outputs a textual representation of fields to output.

PrintToString ( IMessage message ) : string
PrintToString ( Google.ProtocolBuffers.UnknownFieldSet fields ) : string

Приватные методы

Метод Описание
EscapeBytes ( ByteString input ) : String

Escapes bytes in the format used in protocol buffer text format, which is the same as the format used for C string literals. All bytes that are not printable 7-bit ASCII characters are escaped, as well as backslash, single-quote, and double-quote characters. Characters for which no defined short-hand escape sequence is defined will be escaped using 3-digit octal sequences. The returned value is guaranteed to be entirely ASCII.

EscapeText ( string input ) : string

Like EscapeBytes but escapes a text string. The string is first encoded as UTF-8, then each byte escaped individually. The returned value is guaranteed to be entirely ASCII.

IsHex ( char c ) : bool

Tests a character to see if it's a hex digit.

IsOctal ( char c ) : bool

Tests a character to see if it's an octal digit.

MergeField ( Google.ProtocolBuffers.TextTokenizer tokenizer, ExtensionRegistry extensionRegistry, IBuilder builder ) : void

Parses a single field from the specified tokenizer and merges it into the builder.

ParseDigit ( char c ) : int

Interprets a character as a digit (in any base up to 36) and returns the numeric value.

ParseDouble ( string text ) : double
ParseFloat ( string text ) : float
ParseInt32 ( string text ) : int
ParseInt64 ( string text ) : long
ParseInteger ( string text, bool isSigned, bool isLong ) : long

Parses an integer in hex (leading 0x), decimal (no prefix) or octal (leading 0). Only a negative sign is permitted, and it must come before the radix indicator.

ParseUInt32 ( string text ) : uint
ParseUInt64 ( string text ) : ulong
Print ( IMessage message, TextGenerator generator ) : void
PrintField ( FieldDescriptor field, object value, TextGenerator generator ) : void
PrintFieldValue ( FieldDescriptor field, object value, TextGenerator generator ) : void
PrintSingleField ( FieldDescriptor field, Object value, TextGenerator generator ) : void
PrintUnknownFields ( Google.ProtocolBuffers.UnknownFieldSet unknownFields, TextGenerator generator ) : void
UnescapeBytes ( string input ) : ByteString

Performs string unescaping from C style (octal, hex, form feeds, tab etc) into a byte string.

UnescapeText ( string input ) : string

Unescapes a text string as escaped using EscapeText(string). Two-digit hex escapes (starting with "\x" are also recognised.

Описание методов

Merge() публичный статический Метод

public static Merge ( TextReader reader, ExtensionRegistry registry, IBuilder builder ) : void
reader TextReader
registry ExtensionRegistry
builder IBuilder
Результат void

Merge() публичный статический Метод

public static Merge ( TextReader reader, IBuilder builder ) : void
reader TextReader
builder IBuilder
Результат void

Merge() публичный статический Метод

public static Merge ( string text, ExtensionRegistry registry, IBuilder builder ) : void
text string
registry ExtensionRegistry
builder IBuilder
Результат void

Merge() публичный статический Метод

public static Merge ( string text, IBuilder builder ) : void
text string
builder IBuilder
Результат void

Print() публичный статический Метод

Outputs a textual representation of the Protocol Message supplied into the parameter output.
public static Print ( IMessage message, TextWriter output ) : void
message IMessage
output System.IO.TextWriter
Результат void

Print() публичный статический Метод

Outputs a textual representation of fields to output.
public static Print ( Google.ProtocolBuffers.UnknownFieldSet fields, TextWriter output ) : void
fields Google.ProtocolBuffers.UnknownFieldSet
output System.IO.TextWriter
Результат void

PrintToString() публичный статический Метод

public static PrintToString ( IMessage message ) : string
message IMessage
Результат string

PrintToString() публичный статический Метод

public static PrintToString ( Google.ProtocolBuffers.UnknownFieldSet fields ) : string
fields Google.ProtocolBuffers.UnknownFieldSet
Результат string