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
73b7cc00
Commit
73b7cc00
authored
Jun 19, 2017
by
Thomas Van Lenten
Committed by
GitHub
Jun 19, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3244 from thomasvl/complete_docs
ObjC: Document the exceptions on some of the writing apis.
parents
72e293a2
5fd71ce6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
GPBCodedOutputStream.h
objectivec/GPBCodedOutputStream.h
+9
-0
GPBCodedOutputStream.m
objectivec/GPBCodedOutputStream.m
+7
-2
GPBMessage.h
objectivec/GPBMessage.h
+9
-0
No files found.
objectivec/GPBCodedOutputStream.h
View file @
73b7cc00
...
...
@@ -46,12 +46,21 @@
NS_ASSUME_NONNULL_BEGIN
/**
* @c GPBCodedOutputStream exception names.
**/
extern
NSString
*
const
GPBCodedOutputStreamException_OutOfSpace
;
extern
NSString
*
const
GPBCodedOutputStreamException_WriteFailed
;
/**
* Writes out protocol message fields.
*
* The common uses of protocol buffers shouldn't need to use this class.
* GPBMessage's provide a -data method that will serialize the message for you.
*
* @note Any -write* api can raise the GPBCodedOutputStreamException_*
* exceptions.
*
* @note Subclassing of GPBCodedOutputStream is NOT supported.
**/
@interface
GPBCodedOutputStream
:
NSObject
...
...
objectivec/GPBCodedOutputStream.m
View file @
73b7cc00
...
...
@@ -36,6 +36,11 @@
#import "GPBUnknownFieldSet_PackagePrivate.h"
#import "GPBUtilities_PackagePrivate.h"
// These values are the existing values so as not to break any code that might
// have already been inspecting them when they weren't documented/exposed.
NSString
*
const
GPBCodedOutputStreamException_OutOfSpace
=
@"OutOfSpace"
;
NSString
*
const
GPBCodedOutputStreamException_WriteFailed
=
@"WriteFailed"
;
// Structure for containing state of a GPBCodedInputStream. Brought out into
// a struct so that we can inline several common functions instead of dealing
// with overhead of ObjC dispatch.
...
...
@@ -59,13 +64,13 @@ static const int32_t LITTLE_ENDIAN_64_SIZE = sizeof(uint64_t);
static
void
GPBRefreshBuffer
(
GPBOutputBufferState
*
state
)
{
if
(
state
->
output
==
nil
)
{
// We're writing to a single buffer.
[
NSException
raise
:
@"OutOfSpace"
format
:
@""
];
[
NSException
raise
:
GPBCodedOutputStreamException_OutOfSpace
format
:
@""
];
}
if
(
state
->
position
!=
0
)
{
NSInteger
written
=
[
state
->
output
write
:
state
->
bytes
maxLength
:
state
->
position
];
if
(
written
!=
(
NSInteger
)
state
->
position
)
{
[
NSException
raise
:
@"WriteFailed"
format
:
@""
];
[
NSException
raise
:
GPBCodedOutputStreamException_WriteFailed
format
:
@""
];
}
state
->
position
=
0
;
}
...
...
objectivec/GPBMessage.h
View file @
73b7cc00
...
...
@@ -292,6 +292,9 @@ CF_EXTERN_C_END
* Writes out the message to the given coded output stream.
*
* @param output The coded output stream into which to write the message.
*
* @note This can raise the GPBCodedOutputStreamException_* exceptions.
*
**/
-
(
void
)
writeToCodedOutputStream
:(
GPBCodedOutputStream
*
)
output
;
...
...
@@ -299,6 +302,8 @@ CF_EXTERN_C_END
* Writes out the message to the given output stream.
*
* @param output The output stream into which to write the message.
*
* @note This can raise the GPBCodedOutputStreamException_* exceptions.
**/
-
(
void
)
writeToOutputStream
:(
NSOutputStream
*
)
output
;
...
...
@@ -307,6 +312,8 @@ CF_EXTERN_C_END
* the given output stream.
*
* @param output The coded output stream into which to write the message.
*
* @note This can raise the GPBCodedOutputStreamException_* exceptions.
**/
-
(
void
)
writeDelimitedToCodedOutputStream
:(
GPBCodedOutputStream
*
)
output
;
...
...
@@ -315,6 +322,8 @@ CF_EXTERN_C_END
* the given output stream.
*
* @param output The output stream into which to write the message.
*
* @note This can raise the GPBCodedOutputStreamException_* exceptions.
**/
-
(
void
)
writeDelimitedToOutputStream
:(
NSOutputStream
*
)
output
;
...
...
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