add initial Path class

This commit is contained in:
Josh Holtrop 2014-06-18 20:03:50 -04:00
parent 83553e78f1
commit 28b05da01c
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,21 @@
#ifndef JES_PATH_H
#define JES_PATH_H
#include <string>
namespace jes
{
class Path
{
public:
Path(const char * path);
Path(const std::string & path);
Path dirname();
Path join(const Path & other);
protected:
void clean();
std::string m_path;
};
}
#endif

37
src/lib/src/Path.cc Normal file
View File

@ -0,0 +1,37 @@
#include "jes/Path.h"
namespace jes
{
Path::Path(const char * path)
{
m_path = path;
clean();
}
Path::Path(const std::string & path)
{
m_path = path;
clean();
}
Path Path::dirname()
{
// TODO
return "";
}
Path Path::join(const Path & other)
{
// TODO
return "";
}
void Path::clean()
{
for (char & c : m_path)
{
if (c == '\\')
c = '/';
}
}
}