Mercurial > hg > forks > gldragon
annotate dmutil.h @ 60:f645e38e3157
Use delete[] instead of delete for new[]'d memory.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 12 Dec 2019 17:51:53 +0200 |
parents | 9909014498f0 |
children | 03aa729a9e90 |
rev | line source |
---|---|
19
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
1 // |
22
03b86b9c2f29
Add copyright blurbs and licenses.
Matti Hamalainen <ccr@tnsp.org>
parents:
21
diff
changeset
|
2 // GLDragon - OpenGL PLY model viewer / simple benchmark |
03b86b9c2f29
Add copyright blurbs and licenses.
Matti Hamalainen <ccr@tnsp.org>
parents:
21
diff
changeset
|
3 // -- Miscellaneous utility functions |
03b86b9c2f29
Add copyright blurbs and licenses.
Matti Hamalainen <ccr@tnsp.org>
parents:
21
diff
changeset
|
4 // Programmed and designed by Matti 'ccr' Hämäläinen <ccr@tnsp.org> |
03b86b9c2f29
Add copyright blurbs and licenses.
Matti Hamalainen <ccr@tnsp.org>
parents:
21
diff
changeset
|
5 // (C) Copyright 2019 Tecnic Software productions (TNSP) |
19
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
6 // |
22
03b86b9c2f29
Add copyright blurbs and licenses.
Matti Hamalainen <ccr@tnsp.org>
parents:
21
diff
changeset
|
7 // See file "COPYING" for license information. |
19
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
8 // |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
9 #ifndef DMUTIL_H |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
10 #define DMUTIL_H 1 |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
11 |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
12 #include <string> |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
13 #include <vector> |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
14 #include <cstdio> |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
15 #include <iostream> |
47
9909014498f0
Add helper functions dmError() and dmMsg() and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
16 #include <cstdarg> |
19
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
17 |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
18 |
47
9909014498f0
Add helper functions dmError() and dmMsg() and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
19 #define DMUTIL_WHITESPACE "\t\n\v\f\r " |
9909014498f0
Add helper functions dmError() and dmMsg() and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
20 |
9909014498f0
Add helper functions dmError() and dmMsg() and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
21 |
9909014498f0
Add helper functions dmError() and dmMsg() and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
22 void dmMsg_V(const char *fmt, va_list ap); |
9909014498f0
Add helper functions dmError() and dmMsg() and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
23 void dmMsg(const char *fmt, ...); |
9909014498f0
Add helper functions dmError() and dmMsg() and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
24 void dmError_V(const char *fmt, va_list ap); |
9909014498f0
Add helper functions dmError() and dmMsg() and use them.
Matti Hamalainen <ccr@tnsp.org>
parents:
22
diff
changeset
|
25 void dmError(const char *fmt, ...); |
19
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
26 |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
27 |
21
1404dfcee7b8
More work on scenefile and model loading support.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
28 std::string dmStrLTrim(const std::string& str, const std::string& delim = DMUTIL_WHITESPACE); |
1404dfcee7b8
More work on scenefile and model loading support.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
29 std::string dmStrRTrim(const std::string& str, const std::string& delim = DMUTIL_WHITESPACE); |
1404dfcee7b8
More work on scenefile and model loading support.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
30 std::string dmStrTrim(const std::string& str, const std::string& delim = DMUTIL_WHITESPACE); |
19
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
31 |
21
1404dfcee7b8
More work on scenefile and model loading support.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
32 std::vector<std::string> dmStrSplit(const std::string& str, const std::string& delim = DMUTIL_WHITESPACE); |
19
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
33 std::string dmStrJoin(const std::vector<std::string> &list, const std::string &delim); |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
34 |
21
1404dfcee7b8
More work on scenefile and model loading support.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
35 std::string dmGetPath(const std::string &path); |
1404dfcee7b8
More work on scenefile and model loading support.
Matti Hamalainen <ccr@tnsp.org>
parents:
19
diff
changeset
|
36 |
19
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
37 bool dmReadText(const std::string &filename, std::string &buf, const int maxSize); |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
38 bool dmFileExists(const std::string &filename, std::ios_base::openmode mode = std::ios_base::in); |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
39 |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
40 |
a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff
changeset
|
41 #endif |