[#BloombergLP-bdlbb-BlobUtil-insertBufferIfValid-0f]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlbb.adoc[bdlbb]::xref:BloombergLP/bdlbb/BlobUtil.adoc[BlobUtil]::insertBufferIfValid
:relfileprefix: ../../../
:mrdocs:

`insertBufferIfValid` overloads

== Synopses

Declared in `&lt;bdlbb&lowbar;blobutil&period;h&gt;`

Insert the specified move&hyphen;insertable `buffer` at the specified `index` in the specified `dest` if `0 &lt;&equals; index &lt;&equals; dest&hyphen;&gt;numBuffers()` and neither the resulting total size of `dest` nor its resulting total number of buffers exceeds `INT&lowbar;MAX`&period; Return 0 on success, and a non&hyphen;zero value (with no effect) otherwise&period; Increment the length of the &apos;dest by the size of the `buffer` if `buffer` is inserted _before_ the logical end of the `dest`&period; The length of the `dest` is if inserting at a position following all data buffers (e&period;g&period;, inserting into an empty blob or inserting a buffer to increase capacity)&semi; in that case, the blob length must be changed by an explicit call to `setLength`&period; Buffers at `index` and higher positions (if any) are shifted up by one index position&period; In case of success the `buffer` is left in a valid but unspecified state&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlbb/BlobUtil/insertBufferIfValid-08.adoc[insertBufferIfValid](
    xref:BloombergLP/bdlbb/Blob.adoc[Blob]* dest,
    int index,
    xref:BloombergLP/bslmf/MovableRef.adoc[bslmf::MovableRef&lt;BlobBuffer&gt;] buffer);
----

[.small]#xref:BloombergLP/bdlbb/BlobUtil/insertBufferIfValid-08.adoc[_» more&period;&period;&period;_]#

Insert the specified `buffer` at the specified `index` in the specified `dest` if `0 &lt;&equals; index &lt;&equals; dest&hyphen;&gt;numBuffers()` and neither the resulting total size of `dest` nor its resulting total number of buffers exceeds `INT&lowbar;MAX`&period; Return 0 on success, and a non&hyphen;zero value (with no effect) otherwise&period; Increment the length of the &apos;dest by the size of the `buffer` if `buffer` is inserted _before_ the logical end of the `dest`&period; The length of the `dest` is if inserting at a position following all data buffers (e&period;g&period;, inserting into an empty blob or inserting a buffer to increase capacity)&semi; in that case, the blob length must be changed by an explicit call to `setLength`&period; Buffers at `index` and higher positions (if any) are shifted up by one index position&period;


[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
static
int
xref:BloombergLP/bdlbb/BlobUtil/insertBufferIfValid-0b.adoc[insertBufferIfValid](
    xref:BloombergLP/bdlbb/Blob.adoc[Blob]* dest,
    int index,
    xref:BloombergLP/bdlbb/BlobBuffer.adoc[BlobBuffer] const& buffer);
----

[.small]#xref:BloombergLP/bdlbb/BlobUtil/insertBufferIfValid-0b.adoc[_» more&period;&period;&period;_]#


[.small]#Created with https://www.mrdocs.com[MrDocs]#
