Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
353b0fad
Commit
353b0fad
authored
Sep 29, 2011
by
csharptest
Committed by
rogerk
Sep 29, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changes from code review
parent
c4d1d9df
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
15 additions
and
78 deletions
+15
-78
AbstractWriter.cs
src/ProtocolBuffers.Serialization/AbstractWriter.cs
+1
-18
MessageFormatOptions.cs
...rotocolBuffers.Serialization/Http/MessageFormatOptions.cs
+1
-1
JsonFormatWriter.cs
src/ProtocolBuffers.Serialization/JsonFormatWriter.cs
+1
-17
XmlFormatReader.cs
src/ProtocolBuffers.Serialization/XmlFormatReader.cs
+8
-8
XmlFormatWriter.cs
src/ProtocolBuffers.Serialization/XmlFormatWriter.cs
+0
-18
TestWriterFormatJson.cs
src/ProtocolBuffers.Test/TestWriterFormatJson.cs
+1
-1
TestWriterFormatXml.cs
src/ProtocolBuffers.Test/TestWriterFormatXml.cs
+1
-1
CodedOutputStream.cs
src/ProtocolBuffers/CodedOutputStream.cs
+1
-13
ICodedOutputStream.cs
src/ProtocolBuffers/ICodedOutputStream.cs
+1
-1
No files found.
src/ProtocolBuffers.Serialization/AbstractWriter.cs
View file @
353b0fad
...
...
@@ -12,18 +12,8 @@ namespace Google.ProtocolBuffers.Serialization
/// <summary>
/// Provides a base class for writers that performs some basic type dispatching
/// </summary>
public
abstract
class
AbstractWriter
:
ICodedOutputStream
,
IDisposable
public
abstract
class
AbstractWriter
:
ICodedOutputStream
{
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
public
void
Dispose
()
{
GC
.
SuppressFinalize
(
this
);
Flush
();
Dispose
(
true
);
}
/// <summary>
/// Completes any pending write operations
/// </summary>
...
...
@@ -31,13 +21,6 @@ namespace Google.ProtocolBuffers.Serialization
{
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
protected
virtual
void
Dispose
(
bool
disposing
)
{
}
/// <summary>
/// Writes the message to the the formatted stream.
/// </summary>
...
...
src/ProtocolBuffers.Serialization/Http/MessageFormatOptions.cs
View file @
353b0fad
...
...
@@ -8,7 +8,7 @@ namespace Google.ProtocolBuffers.Serialization.Http
/// <summary>
/// Defines control information for the various formatting used with HTTP services
/// </summary>
public
struct
MessageFormatOptions
public
class
MessageFormatOptions
{
/// <summary>The mime type for xml content</summary>
/// <remarks>Other valid xml mime types include: application/binary, application/x-protobuf</remarks>
...
...
src/ProtocolBuffers.Serialization/JsonFormatWriter.cs
View file @
353b0fad
...
...
@@ -239,27 +239,11 @@ namespace Google.ProtocolBuffers.Serialization
/// <summary> Gets or sets the whitespace to use to separate the text, default = empty </summary>
public
string
Whitespace
{
get
;
set
;
}
/// <summary>
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
/// </summary>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
)
{
while
(
_counter
.
Count
>
1
)
{
WriteMessageEnd
();
}
}
base
.
Dispose
(
disposing
);
}
private
void
Seperator
()
{
if
(
_counter
.
Count
==
0
)
{
throw
new
InvalidOperationException
(
"Mis
s
matched open/close in Json writer."
);
throw
new
InvalidOperationException
(
"Mismatched open/close in Json writer."
);
}
int
index
=
_counter
.
Count
-
1
;
...
...
src/ProtocolBuffers.Serialization/XmlFormatReader.cs
View file @
353b0fad
...
...
@@ -14,16 +14,16 @@ namespace Google.ProtocolBuffers.Serialization
{
public
const
string
DefaultRootElementName
=
XmlFormatWriter
.
DefaultRootElementName
;
private
readonly
XmlReader
_input
;
private
readonly
Stack
<
ElementStack
>
_elements
;
private
readonly
Stack
<
ElementStack
Entry
>
_elements
;
private
string
_rootElementName
;
private
struct
ElementStack
private
struct
ElementStack
Entry
{
public
readonly
string
LocalName
;
public
readonly
int
Depth
;
public
readonly
bool
IsEmpty
;
public
ElementStack
(
string
localName
,
int
depth
,
bool
isEmpty
)
:
this
()
public
ElementStack
Entry
(
string
localName
,
int
depth
,
bool
isEmpty
)
:
this
()
{
LocalName
=
localName
;
IsEmpty
=
isEmpty
;
...
...
@@ -87,7 +87,7 @@ namespace Google.ProtocolBuffers.Serialization
{
_input
=
input
;
_rootElementName
=
DefaultRootElementName
;
_elements
=
new
Stack
<
ElementStack
>();
_elements
=
new
Stack
<
ElementStack
Entry
>();
Options
=
XmlReaderOptions
.
None
;
}
...
...
@@ -144,7 +144,7 @@ namespace Google.ProtocolBuffers.Serialization
continue
;
}
Assert
(
_input
.
IsStartElement
()
&&
_input
.
LocalName
==
element
);
_elements
.
Push
(
new
ElementStack
(
element
,
_input
.
Depth
,
_input
.
IsEmptyElement
));
_elements
.
Push
(
new
ElementStack
Entry
(
element
,
_input
.
Depth
,
_input
.
IsEmptyElement
));
_input
.
Read
();
}
...
...
@@ -156,7 +156,7 @@ namespace Google.ProtocolBuffers.Serialization
{
Assert
(
_elements
.
Count
>
0
);
ElementStack
stop
=
_elements
.
Peek
();
ElementStack
Entry
stop
=
_elements
.
Peek
();
while
(
_input
.
NodeType
!=
XmlNodeType
.
EndElement
&&
_input
.
NodeType
!=
XmlNodeType
.
Element
&&
_input
.
Depth
>
stop
.
Depth
&&
_input
.
Read
())
{
...
...
@@ -211,10 +211,10 @@ namespace Google.ProtocolBuffers.Serialization
/// </remarks>
protected
override
bool
PeekNext
(
out
string
field
)
{
ElementStack
stopNode
;
ElementStack
Entry
stopNode
;
if
(
_elements
.
Count
==
0
)
{
stopNode
=
new
ElementStack
(
null
,
_input
.
Depth
-
1
,
false
);
stopNode
=
new
ElementStack
Entry
(
null
,
_input
.
Depth
-
1
,
false
);
}
else
{
...
...
src/ProtocolBuffers.Serialization/XmlFormatWriter.cs
View file @
353b0fad
...
...
@@ -71,24 +71,6 @@ namespace Google.ProtocolBuffers.Serialization
_rootElementName
=
DefaultRootElementName
;
}
/// <summary>
/// Closes the underlying XmlTextWriter
/// </summary>
protected
override
void
Dispose
(
bool
disposing
)
{
if
(
disposing
)
{
while
(
_messageOpenCount
>
0
)
{
WriteMessageEnd
();
}
_output
.
Close
();
}
base
.
Dispose
(
disposing
);
}
/// <summary>
/// Gets or sets the default element name to use when using the Merge<TBuilder>()
/// </summary>
...
...
src/ProtocolBuffers.Test/TestWriterFormatJson.cs
View file @
353b0fad
...
...
@@ -43,8 +43,8 @@ namespace Google.ProtocolBuffers
.
Build
();
using
(
TextWriter
output
=
new
StringWriter
())
using
(
AbstractWriter
writer
=
JsonFormatWriter
.
CreateInstance
(
output
))
{
ICodedOutputStream
writer
=
JsonFormatWriter
.
CreateInstance
(
output
);
writer
.
WriteMessageStart
();
//manually begin the message, output is '{'
writer
.
Flush
();
...
...
src/ProtocolBuffers.Test/TestWriterFormatXml.cs
View file @
353b0fad
...
...
@@ -46,8 +46,8 @@ namespace Google.ProtocolBuffers
.
Build
();
using
(
TextWriter
output
=
new
StringWriter
())
using
(
AbstractWriter
writer
=
XmlFormatWriter
.
CreateInstance
(
output
))
{
ICodedOutputStream
writer
=
XmlFormatWriter
.
CreateInstance
(
output
);
writer
.
WriteMessageStart
();
//manually begin the message, output is '{'
ICodedOutputStream
stream
=
writer
;
...
...
src/ProtocolBuffers/CodedOutputStream.cs
View file @
353b0fad
...
...
@@ -57,7 +57,7 @@ namespace Google.ProtocolBuffers
/// methods are taken from the protocol buffer type names, not .NET types.
/// (Hence WriteFloat instead of WriteSingle, and WriteBool instead of WriteBoolean.)
/// </remarks>
public
sealed
partial
class
CodedOutputStream
:
ICodedOutputStream
,
IDisposable
public
sealed
partial
class
CodedOutputStream
:
ICodedOutputStream
{
/// <summary>
/// The buffer size used by CreateInstance(Stream).
...
...
@@ -126,18 +126,6 @@ namespace Google.ProtocolBuffers
#
endregion
public
void
Dispose
()
{
if
(
output
!=
null
)
{
if
(
position
>
0
)
{
Flush
();
}
output
.
Dispose
();
}
}
void
ICodedOutputStream
.
WriteMessageStart
()
{
}
void
ICodedOutputStream
.
WriteMessageEnd
()
{
Flush
();
}
...
...
src/ProtocolBuffers/ICodedOutputStream.cs
View file @
353b0fad
...
...
@@ -49,7 +49,7 @@ namespace Google.ProtocolBuffers
/// in their binary form by creating a instance via the CodedOutputStream.CreateInstance
/// static factory.
/// </summary>
public
interface
ICodedOutputStream
:
IDisposable
public
interface
ICodedOutputStream
{
/// <summary>
/// Writes any message initialization data needed to the output stream
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment