summaryrefslogtreecommitdiff
path: root/Build/source/libs/xpdf/goo/GString.h
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/libs/xpdf/goo/GString.h')
-rw-r--r--Build/source/libs/xpdf/goo/GString.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/Build/source/libs/xpdf/goo/GString.h b/Build/source/libs/xpdf/goo/GString.h
index f4ff7c6a9ee..dd22e2d8f6b 100644
--- a/Build/source/libs/xpdf/goo/GString.h
+++ b/Build/source/libs/xpdf/goo/GString.h
@@ -17,6 +17,9 @@
#pragma interface
#endif
+#include <stdarg.h>
+#include "gtypes.h"
+
class GString {
public:
@@ -43,6 +46,30 @@ public:
// Convert an integer to a string.
static GString *fromInt(int x);
+ // Create a formatted string. Similar to printf, but without the
+ // string overflow issues. Formatting elements consist of:
+ // {<arg>:[<width>][.<precision>]<type>}
+ // where:
+ // - <arg> is the argument number (arg 0 is the first argument
+ // following the format string) -- NB: args must be first used in
+ // order; they can be reused in any order
+ // - <width> is the field width -- negative to reverse the alignment;
+ // starting with a leading zero to zero-fill (for integers)
+ // - <precision> is the number of digits to the right of the decimal
+ // point (for floating point numbers)
+ // - <type> is one of:
+ // d, x, o, b -- int in decimal, hex, octal, binary
+ // ud, ux, uo, ub -- unsigned int
+ // ld, lx, lo, lb, uld, ulx, ulo, ulb -- long, unsigned long
+ // f, g -- double
+ // c -- char
+ // s -- string (char *)
+ // t -- GString *
+ // w -- blank space; arg determines width
+ // To get literal curly braces, use {{ or }}.
+ static GString *format(char *fmt, ...);
+ static GString *formatv(char *fmt, va_list argList);
+
// Destructor.
~GString();
@@ -67,6 +94,10 @@ public:
GString *append(const char *str);
GString *append(const char *str, int lengthA);
+ // Append a formatted string.
+ GString *appendf(char *fmt, ...);
+ GString *appendfv(char *fmt, va_list argList);
+
// Insert a character or string.
GString *insert(int i, char c);
GString *insert(int i, GString *str);
@@ -92,6 +123,14 @@ private:
char *s;
void resize(int length1);
+ static void formatInt(long x, char *buf, int bufSize,
+ GBool zeroFill, int width, int base,
+ char **p, int *len);
+ static void formatUInt(Gulong x, char *buf, int bufSize,
+ GBool zeroFill, int width, int base,
+ char **p, int *len);
+ static void formatDouble(double x, char *buf, int bufSize, int prec,
+ GBool trim, char **p, int *len);
};
#endif