diff options
author | Aki <please@ignore.pl> | 2022-04-01 21:23:39 +0200 |
---|---|---|
committer | Aki <please@ignore.pl> | 2022-04-01 21:23:39 +0200 |
commit | 3c487c5cd69c53d6fea948643c0a76df03516605 (patch) | |
tree | 72730c7b8b26a5ef8fc9a987ec4c16129efd5aac /StarsEx/FormatUtil.h | |
parent | 8f353abd0bfe18baddd8a8250ab7c4f2d1c83a6e (diff) | |
download | starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.zip starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.gz starshatter-3c487c5cd69c53d6fea948643c0a76df03516605.tar.bz2 |
Moved Stars45 to StarsEx
Diffstat (limited to 'StarsEx/FormatUtil.h')
-rw-r--r-- | StarsEx/FormatUtil.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/StarsEx/FormatUtil.h b/StarsEx/FormatUtil.h new file mode 100644 index 0000000..f0d6b42 --- /dev/null +++ b/StarsEx/FormatUtil.h @@ -0,0 +1,46 @@ +/* Starshatter: The Open Source Project + Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors + Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors + Copyright (c) 1997-2006, Destroyer Studios LLC. + + AUTHOR: John DiCamillo + + + OVERVIEW + ======== + Text formatting utilities +*/ + +#ifndef FormatUtil_h +#define FormatUtil_h + +#include "Types.h" +#include "Geometry.h" +#include "Text.h" + +// +--------------------------------------------------------------------+ + +void FormatNumber(char* txt, double n); +void FormatNumberExp(char* txt, double n); +void FormatTime(char* txt, double seconds); +void FormatTimeOfDay(char* txt, double seconds); +void FormatDayTime(char* txt, double seconds, bool short_format=false); +void FormatDay(char* txt, double seconds); +void FormatPoint(char* txt, const Point& p); +Text FormatTimeString(int utc=0); + +const char* SafeString(const char* s); +const char* SafeQuotes(const char* s); + +// scan msg and replace all occurrences of tgt with val +// return new result, leave msg unmodified +Text FormatTextReplace(const char* msg, const char* tgt, const char* val); + +// scan msg and replace all C-style \x escape sequences +// with their single-character values, leave orig unmodified +Text FormatTextEscape(const char* msg); + +// +--------------------------------------------------------------------+ + +#endif // FormatUtil_h + |