BDateFormat: improve API

* Use a reference rather than a pointer for the output string, removing
the need for NULL checks (which were missing, anyway)
* Adjust callers to that change
* Add new Format variant taking a BDate argument
This commit is contained in:
Adrien Destugues
2014-09-30 09:47:02 +02:00
parent dd21b4666e
commit f188c1defa
7 changed files with 80 additions and 29 deletions
+12 -6
View File
@@ -6,6 +6,7 @@
#define _B_DATE_FORMAT_H_
#include <DateTime.h>
#include <DateTimeFormat.h>
#include <FormattingConventions.h>
#include <Language.h>
@@ -38,14 +39,19 @@ public:
// formatting
ssize_t Format(char* string, size_t maxSize,
time_t time, BDateFormatStyle style) const;
status_t Format(BString* string, time_t time,
BDateFormatStyle style,
ssize_t Format(char* string, const size_t maxSize,
const time_t time,
const BDateFormatStyle style) const;
status_t Format(BString& string, const time_t time,
const BDateFormatStyle style,
const BTimeZone* timeZone = NULL) const;
status_t Format(BString* string,
status_t Format(BString& string, const BDate& time,
const BDateFormatStyle style,
const BTimeZone* timeZone = NULL) const;
status_t Format(BString& string,
int*& fieldPositions, int& fieldCount,
time_t time, BDateFormatStyle style) const;
const time_t time,
const BDateFormatStyle style) const;
status_t GetFields(BDateElement*& fields,
int& fieldCount, BDateFormatStyle style