Skip to content

Commit

Permalink
Add push placeholder method.
Browse files Browse the repository at this point in the history
  • Loading branch information
skuzniar committed Apr 8, 2024
1 parent fad7ed6 commit d4f27af
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions include/hffix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,31 @@ class message_writer {

//@}

/*! \name Special Fields */
//@{

/*!
\brief Append a placeholder field to the message.
\param tag FIX tag.
\param size size of the fill buffer.
\param fill Fill character.
\throw std::out_of_range When the remaining buffer size is too small.
*/
size_t push_back_placeholder(int tag, size_t size, char fill=' ') {
next_ = details::itoa(tag, next_, buffer_end_);
if (buffer_end_ - next_ < size + 2) {
details::throw_range_error();
}
*next_++ = '=';
size_t s = message_size();
memset(next_, fill, size);
next_ += size;
*next_++ = '\x01';
return s;
}

/*! \name String Fields */
//@{

Expand Down

0 comments on commit d4f27af

Please sign in to comment.