src/cx/buffer.h

changeset 1005
67fa386ce600
parent 1004
d8044fd5005c
child 1016
fe177d6dabb8
equal deleted inserted replaced
1004:d8044fd5005c 1005:67fa386ce600
425 /** 425 /**
426 * Writes a character to a buffer. 426 * Writes a character to a buffer.
427 * 427 *
428 * The least significant byte of the argument is written to the buffer. If the 428 * The least significant byte of the argument is written to the buffer. If the
429 * end of the buffer is reached and #CX_BUFFER_AUTO_EXTEND feature is enabled, 429 * end of the buffer is reached and #CX_BUFFER_AUTO_EXTEND feature is enabled,
430 * the buffer capacity is extended by cxBufferMinimumCapacity(). If the feature is 430 * the buffer capacity is extended by cxBufferMinimumCapacity(). If the feature
431 * disabled or buffer extension fails, \c EOF is returned. 431 * is disabled or buffer extension fails, \c EOF is returned.
432 * 432 *
433 * On successful write, the position of the buffer is increased. 433 * On successful write, the position of the buffer is increased.
434 * 434 *
435 * @param buffer the buffer to write to 435 * @param buffer the buffer to write to
436 * @param c the character to write 436 * @param c the character to write
437 * @return the byte that has bean written or \c EOF when the end of the stream is 437 * @return the byte that has been written or \c EOF when the end of the stream is
438 * reached and automatic extension is not enabled or not possible 438 * reached and automatic extension is not enabled or not possible
439 */ 439 */
440 cx_attr_nonnull 440 cx_attr_nonnull
441 int cxBufferPut( 441 int cxBufferPut(
442 CxBuffer *buffer, 442 CxBuffer *buffer,
443 int c 443 int c
444 ); 444 );
445
446 /**
447 * Writes a terminating zero to a buffer.
448 *
449 * On successful write, \em neither the position \em nor the size of the buffer is
450 * increased.
451 *
452 * The purpose of this function is to have the written data ready to be used as
453 * a C string.
454 *
455 * @param buffer the buffer to write to
456 * @return zero, if the terminator could be written, non-zero otherwise
457 */
458 cx_attr_nonnull
459 int cxBufferTerminate(CxBuffer *buffer);
445 460
446 /** 461 /**
447 * Writes a string to a buffer. 462 * Writes a string to a buffer.
448 * 463 *
449 * @param buffer the buffer 464 * @param buffer the buffer

mercurial