csharptest | c2d2c1a | 2011-09-08 20:02:11 -0500 | [diff] [blame^] | 1 | using System;
|
| 2 |
|
| 3 | namespace Google.ProtocolBuffers.Serialization
|
| 4 | {
|
| 5 | /// <summary>
|
| 6 | /// Defines control information for the various formatting used with HTTP services
|
| 7 | /// </summary>
|
| 8 | public struct MessageFormatOptions
|
| 9 | {
|
| 10 | /// <summary>The mime type for xml content</summary>
|
| 11 | /// <remarks>Other valid xml mime types include: application/binary, application/x-protobuf</remarks>
|
| 12 | public const string ContentTypeProtoBuffer = "application/vnd.google.protobuf";
|
| 13 |
|
| 14 | /// <summary>The mime type for xml content</summary>
|
| 15 | /// <remarks>Other valid xml mime types include: text/xml</remarks>
|
| 16 | public const string ContentTypeXml = "application/xml";
|
| 17 |
|
| 18 | /// <summary>The mime type for json content</summary>
|
| 19 | /// <remarks>
|
| 20 | /// Other valid json mime types include: application/json, application/x-json,
|
| 21 | /// application/x-javascript, text/javascript, text/x-javascript, text/x-json, text/json
|
| 22 | /// </remarks>
|
| 23 | public const string ContentTypeJson = "application/json";
|
| 24 |
|
| 25 | private string _defaultContentType;
|
| 26 | private string _xmlReaderRootElementName;
|
| 27 | private string _xmlWriterRootElementName;
|
| 28 | private ExtensionRegistry _extensionRegistry;
|
| 29 |
|
| 30 | /// <summary>
|
| 31 | /// The default content type to use if the input type is null or empty. If this
|
| 32 | /// value is not supplied an ArgumentOutOfRangeException exception will be raised.
|
| 33 | /// </summary>
|
| 34 | public string DefaultContentType
|
| 35 | {
|
| 36 | get { return _defaultContentType ?? String.Empty; }
|
| 37 | set { _defaultContentType = value; }
|
| 38 | }
|
| 39 |
|
| 40 | /// <summary>
|
| 41 | /// The extension registry to use when reading messages
|
| 42 | /// </summary>
|
| 43 | public ExtensionRegistry ExtensionRegistry
|
| 44 | {
|
| 45 | get { return _extensionRegistry ?? ExtensionRegistry.Empty; }
|
| 46 | set { _extensionRegistry = value; }
|
| 47 | }
|
| 48 |
|
| 49 | /// <summary>
|
| 50 | /// The name of the xml root element when reading messages
|
| 51 | /// </summary>
|
| 52 | public string XmlReaderRootElementName
|
| 53 | {
|
| 54 | get { return _xmlReaderRootElementName ?? XmlFormatReader.DefaultRootElementName; }
|
| 55 | set { _xmlReaderRootElementName = value; }
|
| 56 | }
|
| 57 |
|
| 58 | /// <summary>
|
| 59 | /// Xml reader options
|
| 60 | /// </summary>
|
| 61 | public XmlReaderOptions XmlReaderOptions { get; set; }
|
| 62 |
|
| 63 | /// <summary>
|
| 64 | /// True to use formatted output including new-lines and default indentation
|
| 65 | /// </summary>
|
| 66 | public bool FormattedOutput { get; set; }
|
| 67 |
|
| 68 | /// <summary>
|
| 69 | /// The name of the xml root element when writing messages
|
| 70 | /// </summary>
|
| 71 | public string XmlWriterRootElementName
|
| 72 | {
|
| 73 | get { return _xmlWriterRootElementName ?? XmlFormatWriter.DefaultRootElementName; }
|
| 74 | set { _xmlWriterRootElementName = value; }
|
| 75 | }
|
| 76 |
|
| 77 | /// <summary>
|
| 78 | /// Xml writer options
|
| 79 | /// </summary>
|
| 80 | public XmlWriterOptions XmlWriterOptions { get; set; }
|
| 81 | }
|
| 82 | } |