BString: Add ScanWithFormat convenience method.
This commit is contained in:
parent
969af8044a
commit
3fe7b3f72c
|
@ -61,6 +61,12 @@ public:
|
|||
va_list args)
|
||||
__attribute__((__format__(__printf__, 2, 0)));
|
||||
|
||||
int ScanWithFormat(const char* format, ...)
|
||||
__attribute__((__format__(__scanf__, 2, 3)));
|
||||
int ScanWithFormatVarArgs(const char* format,
|
||||
va_list args)
|
||||
__attribute__((__format__(__scanf__, 2, 0)));
|
||||
|
||||
// Substring copying
|
||||
BString& CopyInto(BString& into, int32 fromOffset,
|
||||
int32 length) const;
|
||||
|
|
|
@ -474,6 +474,25 @@ BString::SetToFormatVarArgs(const char* format, va_list args)
|
|||
}
|
||||
|
||||
|
||||
int
|
||||
BString::ScanWithFormat(const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int result = ScanWithFormatVarArgs(format, args);
|
||||
va_end(args);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
BString::ScanWithFormatVarArgs(const char* format, va_list args)
|
||||
{
|
||||
return vsscanf(fPrivateData, format, args);
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark - Substring copying
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue