@@ -434,32 +434,36 @@ class serializer::stream
434434 return *this ;
435435 }
436436
437- /* * Returns ` true` if the stream is open
437+ /* * Return true if the stream is open
438438 */
439439 BOOST_HTTP_PROTO_DECL
440440 bool
441441 is_open () const noexcept ;
442442
443- /* * Returns the available capacity
443+ /* * Return the available capacity
444+
445+ @throw std::logic_error if `!is_open()`.
444446 */
445447 BOOST_HTTP_PROTO_DECL
446448 std::size_t
447- capacity () const noexcept ;
449+ capacity () const ;
448450
449- /* * Prepares a buffer for writing
451+ /* * Prepare a buffer for writing
450452
451453 Use @ref commit to make the written data available
452454 to the serializer.
453455
454456 @return An object of type @ref mutable_buffers_type
455457 that satisfies MutableBufferSequence requirements,
456458 the underlying memory is owned by the serializer.
459+
460+ @throw std::logic_error if `!is_open()`.
457461 */
458462 BOOST_HTTP_PROTO_DECL
459463 mutable_buffers_type
460- prepare () noexcept ;
464+ prepare ();
461465
462- /* * Commits data to the serializer
466+ /* * Commit data to the serializer
463467
464468 @param n Number of bytes to commit.
465469
@@ -470,12 +474,19 @@ class serializer::stream
470474 void
471475 commit (std::size_t n);
472476
473- /* * Closes the stream
477+ /* * Close the stream if open
474478 */
475479 BOOST_HTTP_PROTO_DECL
476480 void
477481 close ();
478482
483+ /* * Destructor
484+
485+ Closes the stream if open.
486+ */
487+ BOOST_HTTP_PROTO_DECL
488+ ~stream ();
489+
479490private:
480491 friend class serializer ;
481492
@@ -494,7 +505,7 @@ class serializer::stream
494505class serializer ::const_buf_gen_base
495506{
496507public:
497- // Returns the next non-empty buffer,
508+ // Return the next non-empty buffer,
498509 // or an empty buffer if none remain.
499510 virtual
500511 buffers::const_buffer
@@ -510,7 +521,7 @@ class serializer::const_buf_gen_base
510521 std::size_t
511522 count () const = 0 ;
512523
513- // Returns true when there is no buffer or
524+ // Return true when there is no buffer or
514525 // the remaining buffers are empty
515526 virtual
516527 bool
@@ -526,6 +537,7 @@ class serializer::const_buf_gen
526537
527538 ConstBufferSequence cbs_;
528539 it_t current_;
540+
529541public:
530542 using const_buffer =
531543 buffers::const_buffer;
@@ -556,8 +568,10 @@ class serializer::const_buf_gen
556568 current_,
557569 buffers::end (cbs_),
558570 std::size_t {},
559- [](std::size_t sum, const_buffer cb) {
560- return sum + cb.size (); });
571+ [](std::size_t sum, const_buffer cb)
572+ {
573+ return sum + cb.size ();
574+ });
561575 }
562576
563577 std::size_t
@@ -566,8 +580,10 @@ class serializer::const_buf_gen
566580 return std::count_if (
567581 current_,
568582 buffers::end (cbs_),
569- [](const_buffer cb) {
570- return cb.size () != 0 ; });
583+ [](const_buffer cb)
584+ {
585+ return cb.size () != 0 ;
586+ });
571587 }
572588
573589 bool
@@ -576,8 +592,10 @@ class serializer::const_buf_gen
576592 return std::all_of (
577593 current_,
578594 buffers::end (cbs_),
579- [](const_buffer cb) {
580- return cb.size () == 0 ; });
595+ [](const_buffer cb)
596+ {
597+ return cb.size () == 0 ;
598+ });
581599 }
582600};
583601
0 commit comments