From 28b05da01c3efa7e7e352375a22936e98b226879 Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Wed, 18 Jun 2014 20:03:50 -0400 Subject: [PATCH] add initial Path class --- src/lib/include/jes/Path.h | 21 +++++++++++++++++++++ src/lib/src/Path.cc | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 src/lib/include/jes/Path.h create mode 100644 src/lib/src/Path.cc diff --git a/src/lib/include/jes/Path.h b/src/lib/include/jes/Path.h new file mode 100644 index 0000000..a20aa78 --- /dev/null +++ b/src/lib/include/jes/Path.h @@ -0,0 +1,21 @@ +#ifndef JES_PATH_H +#define JES_PATH_H + +#include + +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 diff --git a/src/lib/src/Path.cc b/src/lib/src/Path.cc new file mode 100644 index 0000000..295d06b --- /dev/null +++ b/src/lib/src/Path.cc @@ -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 = '/'; + } + } +}