Mercurial > hg > forks > gldragon
diff dmutil.h @ 19:a329f0216491
Implement PLY file format parsing and extremely simplistic scene setup file format.
Not finished yet.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 07 Nov 2019 20:15:33 +0200 |
parents | |
children | 1404dfcee7b8 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dmutil.h Thu Nov 07 20:15:33 2019 +0200 @@ -0,0 +1,27 @@ +// +// +// +#ifndef DMUTIL_H +#define DMUTIL_H 1 + +#include <string> +#include <vector> +#include <cstdio> +#include <iostream> + + +#define SET_WHITESPACE "\t\n\v\f\r " + + +std::string dmStrLTrim(const std::string& str, const std::string& delim = SET_WHITESPACE); +std::string dmStrRTrim(const std::string& str, const std::string& delim = SET_WHITESPACE); +std::string dmStrTrim(const std::string& str, const std::string& delim = SET_WHITESPACE); + +std::vector<std::string> dmStrSplit(const std::string& str, const std::string& delim = SET_WHITESPACE); +std::string dmStrJoin(const std::vector<std::string> &list, const std::string &delim); + +bool dmReadText(const std::string &filename, std::string &buf, const int maxSize); +bool dmFileExists(const std::string &filename, std::ios_base::openmode mode = std::ios_base::in); + + +#endif