diff options
Diffstat (limited to '')
-rw-r--r-- | src/fstring.h | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/fstring.h b/src/fstring.h index de34cb0..2a18362 100644 --- a/src/fstring.h +++ b/src/fstring.h | |||
@@ -681,6 +681,50 @@ namespace Bu | |||
681 | appendChunk( pNew ); | 681 | appendChunk( pNew ); |
682 | } | 682 | } |
683 | 683 | ||
684 | void format( const char *sFrmt, ...) | ||
685 | { | ||
686 | clear(); | ||
687 | |||
688 | va_list ap; | ||
689 | va_start( ap, sFrmt ); | ||
690 | |||
691 | long iLen = vsnprintf( NULL, 0, sFrmt, ap ); | ||
692 | |||
693 | Chunk *pNew = newChunk( iLen ); | ||
694 | vsnprintf( pNew->pData, iLen+1, sFrmt, ap ); | ||
695 | appendChunk( pNew ); | ||
696 | |||
697 | va_end( ap ); | ||
698 | } | ||
699 | |||
700 | void formatAppend( const char *sFrmt, ...) | ||
701 | { | ||
702 | va_list ap; | ||
703 | va_start( ap, sFrmt ); | ||
704 | |||
705 | long iLen = vsnprintf( NULL, 0, sFrmt, ap ); | ||
706 | |||
707 | Chunk *pNew = newChunk( iLen ); | ||
708 | vsnprintf( pNew->pData, iLen+1, sFrmt, ap ); | ||
709 | appendChunk( pNew ); | ||
710 | |||
711 | va_end( ap ); | ||
712 | } | ||
713 | |||
714 | void formatPrepend( const char *sFrmt, ...) | ||
715 | { | ||
716 | va_list ap; | ||
717 | va_start( ap, sFrmt ); | ||
718 | |||
719 | long iLen = vsnprintf( NULL, 0, sFrmt, ap ); | ||
720 | |||
721 | Chunk *pNew = newChunk( iLen ); | ||
722 | vsnprintf( pNew->pData, iLen+1, sFrmt, ap ); | ||
723 | prependChunk( pNew ); | ||
724 | |||
725 | va_end( ap ); | ||
726 | } | ||
727 | |||
684 | /** | 728 | /** |
685 | * Function the archiver calls to archive your FString. | 729 | * Function the archiver calls to archive your FString. |
686 | *@param ar (Archive) The archive which is archiving your FString. | 730 | *@param ar (Archive) The archive which is archiving your FString. |