From b829170121d3657369904ec62d8065606777a9ce Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 1 Oct 2021 18:54:04 +0200 Subject: Removed doxygen generated docs They can be rebuild anytime and are considered a build artifact/binary. --- Doc/doxygen/html/_format_util_8cpp_source.html | 454 ------------------------- 1 file changed, 454 deletions(-) delete mode 100644 Doc/doxygen/html/_format_util_8cpp_source.html (limited to 'Doc/doxygen/html/_format_util_8cpp_source.html') diff --git a/Doc/doxygen/html/_format_util_8cpp_source.html b/Doc/doxygen/html/_format_util_8cpp_source.html deleted file mode 100644 index 73995e4..0000000 --- a/Doc/doxygen/html/_format_util_8cpp_source.html +++ /dev/null @@ -1,454 +0,0 @@ - - - - - -Starshatter_Open: D:/SRC/StarshatterSVN/nGenEx/FormatUtil.cpp Source File - - - - - - - - - - - - - -
-
- - - - - - -
-
Starshatter_Open -
-
Open source Starshatter engine
-
-
- - - - - -
-
- -
-
-
- -
- - - - -
- -
- -
-
-
FormatUtil.cpp
-
-
-Go to the documentation of this file.
1 /* Project nGenEx
-
2  Destroyer Studios LLC
-
3  Copyright © 1997-2004. All Rights Reserved.
-
4 
-
5  SUBSYSTEM: nGenEx.lib
-
6  FILE: FormatUtil.cpp
-
7  AUTHOR: John DiCamillo
-
8 
-
9 
-
10  OVERVIEW
-
11  ========
-
12 */
-
13 
-
14 #include "MemDebug.h"
-
15 #include "FormatUtil.h"
-
16 
-
17 // +--------------------------------------------------------------------+
-
18 
-
19 void FormatNumber(char* txt, double n)
-
20 {
-
21  double a = fabs(n);
-
22 
-
23  if (a < 1e3)
-
24  sprintf(txt, "%d", (int) (n));
-
25 
-
26  else if (a < 1e6)
-
27  sprintf(txt, "%.1f K", (n/1e3));
-
28 
-
29  else if (a < 1e9)
-
30  sprintf(txt, "%.1f M", (n/1e6));
-
31 
-
32  else if (a < 1e12)
-
33  sprintf(txt, "%.1f G", (n/1e9));
-
34 
-
35  else if (a < 1e15)
-
36  sprintf(txt, "%.1f T", (n/1e12));
-
37 
-
38  else
-
39  sprintf(txt, "%.1e", n);
-
40 }
-
41 
-
42 // +--------------------------------------------------------------------+
-
43 
-
44 void FormatNumberExp(char* txt, double n)
-
45 {
-
46  double a = fabs(n);
-
47 
-
48  if (a < 100e3)
-
49  sprintf(txt, "%d", (int) (n));
-
50 
-
51  else
-
52  sprintf(txt, "%.1e", n);
-
53 }
-
54 
-
55 // +--------------------------------------------------------------------+
-
56 
-
57 const int MINUTE = 60;
-
58 const int HOUR = 60 * MINUTE;
-
59 const int DAY = 24 * HOUR;
-
60 
-
61 void FormatTime(char* txt, double time)
-
62 {
-
63  int t = (int) time;
-
64 
-
65  int h = (t / HOUR);
-
66  int m = ((t - h*HOUR) / MINUTE);
-
67  int s = ((t - h*HOUR - m*MINUTE));
-
68 
-
69  if (h > 0)
-
70  sprintf(txt, "%02d:%02d:%02d", h,m,s);
-
71  else
-
72  sprintf(txt, "%02d:%02d", m,s);
-
73 }
-
74 
-
75 // +--------------------------------------------------------------------+
-
76 
-
77 void FormatTimeOfDay(char* txt, double time)
-
78 {
-
79  int t = (int) time;
-
80 
-
81  if (t >= DAY) {
-
82  int d = t / DAY;
-
83  t -= d * DAY;
-
84  }
-
85 
-
86  int h = (t / HOUR);
-
87  int m = ((t - h*HOUR) / MINUTE);
-
88  int s = ((t - h*HOUR - m*MINUTE));
-
89 
-
90  sprintf(txt, "%02d:%02d:%02d", h,m,s);
-
91 }
-
92 
-
93 // +--------------------------------------------------------------------+
-
94 
-
95 void FormatDayTime(char* txt, double time, bool short_format)
-
96 {
-
97  int t = (int) time;
-
98  int d = 1, h = 0, m = 0, s = 0;
-
99 
-
100  if (t >= DAY) {
-
101  d = t / DAY;
-
102  t -= d * DAY;
-
103  d++;
-
104  }
-
105 
-
106  if (t >= HOUR) {
-
107  h = t / HOUR;
-
108  t -= h * HOUR;
-
109  }
-
110 
-
111  if (t >= MINUTE) {
-
112  m = t / MINUTE;
-
113  t -= m * MINUTE;
-
114  }
-
115 
-
116  s = t;
-
117 
-
118  if (short_format)
-
119  sprintf(txt, "%02d/%02d:%02d:%02d", d, h, m, s);
-
120  else
-
121  sprintf(txt, "Day %02d %02d:%02d:%02d", d, h, m, s);
-
122 }
-
123 
-
124 // +--------------------------------------------------------------------+
-
125 
-
126 void FormatDay(char* txt, double time)
-
127 {
-
128  int t = (int) time;
-
129  int d = 1, h = 0, m = 0, s = 0;
-
130 
-
131  if (t >= DAY) {
-
132  d = t / DAY;
-
133  t -= d * DAY;
-
134  d++;
-
135  }
-
136 
-
137  sprintf(txt, "Day %02d", d);
-
138 }
-
139 
-
140 // +--------------------------------------------------------------------+
-
141 
-
142 void FormatPoint(char* txt, const Point& p)
-
143 {
-
144  char x[16];
-
145  char y[16];
-
146  char z[16];
-
147 
-
148  FormatNumber(x, p.x);
-
149  FormatNumber(y, p.y);
-
150  FormatNumber(z, p.z);
-
151 
-
152  sprintf(txt, "(%s, %s, %s)", x, y, z);
-
153 }
-
154 
-
155 // +--------------------------------------------------------------------+
-
156 
- -
158 {
-
159  static const char* month[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
-
160  "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-
161  static const char* meridian[2] = { "AM", "PM" };
-
162 
-
163  if (utc < 1)
-
164  utc = (int) time(0);
-
165 
-
166  time_t aclock = utc; // Get time in seconds
-
167  struct tm *t = localtime(&aclock); // Convert time to struct tm form
-
168 
-
169  char buffer[256];
-
170  sprintf(buffer, "%d %s %d, %2d:%02d:%02d %s",
-
171  t->tm_mday, month[t->tm_mon], 1900 + t->tm_year,
-
172  t->tm_hour > 12 ? t->tm_hour-12 : t->tm_hour,
-
173  t->tm_min, t->tm_sec, meridian[t->tm_hour > 12]);
-
174 
-
175  return buffer;
-
176 }
-
177 
-
178 // +--------------------------------------------------------------------+
-
179 
-
180 static char safe_str[2048];
-
181 
-
182 const char* SafeString(const char* s)
-
183 {
-
184  ZeroMemory(safe_str, sizeof(safe_str));
-
185 
-
186  if (s && *s) {
-
187  int len = strlen(s);
-
188  int n = 0;
-
189 
-
190  for (int i = 0; i < len; i++) {
-
191  char c = s[i];
-
192 
-
193  if (c == '\n') {
-
194  safe_str[n++] = '\\';
-
195  safe_str[n++] = 'n';
-
196  }
-
197 
-
198  else if (c == '\t') {
-
199  safe_str[n++] = '\\';
-
200  safe_str[n++] = 't';
-
201  }
-
202 
-
203  else if (c == '"') {
-
204  safe_str[n++] = '\'';
-
205  }
-
206 
-
207  else if (c == '\\' && i < len-1) {
-
208  safe_str[n++] = s[i++];
-
209  safe_str[n++] = s[i++];
-
210  }
-
211 
-
212  else if (c < 32 || c > 126) {
-
213  // non printing characters
-
214  }
-
215 
-
216  else {
-
217  safe_str[n++] = c;
-
218  }
-
219 
-
220  if (n > 2040)
-
221  break;
-
222  }
-
223  }
-
224 
-
225  return safe_str;
-
226 }
-
227 
-
228 // +--------------------------------------------------------------------+
-
229 
-
230 const char* SafeQuotes(const char* msg)
-
231 {
-
232  int dst = 0;
-
233 
-
234  if (msg) {
-
235  while (*msg && dst < 254) {
-
236  if (*msg == '"') {
-
237  safe_str[dst++] = '\'';
-
238  msg++;
-
239  }
-
240  else if (isspace(*msg)) {
-
241  safe_str[dst++] = ' ';
-
242  msg++;
-
243  }
-
244  else {
-
245  safe_str[dst++] = *msg++;
-
246  }
-
247  }
-
248  }
-
249 
-
250  safe_str[dst] = 0;
-
251  return safe_str;
-
252 }
-
253 
-
254 // +--------------------------------------------------------------------+
-
255 
-
256 Text FormatTextReplace(const char* msg, const char* tgt, const char* val)
-
257 {
-
258  if (!msg || !tgt || !val)
-
259  return "";
-
260 
-
261  if (!strchr(msg, *tgt))
-
262  return msg;
-
263 
-
264  Text result;
-
265  char* buffer = new char[strlen(msg) + 1];
-
266  const char* p = msg;
-
267  char* q = buffer;
-
268  int tgtlen = strlen(tgt);
-
269 
-
270  while (*p) {
-
271  if (!strncmp(p, tgt, tgtlen)) {
-
272  p += tgtlen;
-
273  *q = 0;
-
274  q = buffer;
-
275 
-
276  result += buffer;
-
277  result += val;
-
278  }
-
279 
-
280  else {
-
281  *q++ = *p++;
-
282  }
-
283  }
-
284 
-
285  if (q != buffer) {
-
286  *q = 0;
-
287  result += buffer;
-
288  }
-
289 
-
290  delete [] buffer;
-
291  return result;
-
292 }
-
293 
-
294 // +--------------------------------------------------------------------+
-
295 
-
296 Text FormatTextEscape(const char* msg)
-
297 {
-
298  if (!msg)
-
299  return "";
-
300 
-
301  if (!strchr(msg, '\\'))
-
302  return msg;
-
303 
-
304  Text result;
-
305  char* buffer = new char[strlen(msg) + 1];
-
306  const char* p = msg;
-
307  char* q = buffer;
-
308 
-
309  while (*p) {
-
310  if (*p == '\\') {
-
311  p++;
-
312 
-
313  if (*p == 'n') {
-
314  *q++ = '\n';
-
315  p++;
-
316  }
-
317 
-
318  else if (*p == 't') {
-
319  *q++ = '\t';
-
320  p++;
-
321  }
-
322 
-
323  else {
-
324  *q++ = *p++;
-
325  }
-
326  }
-
327 
-
328  else {
-
329  *q++ = *p++;
-
330  }
-
331  }
-
332 
-
333  *q = 0;
-
334  result = buffer;
-
335  delete [] buffer;
-
336  return result;
-
337 }
-
-
- - - - -- cgit v1.1