-/*
+/* $Id$
+
This file is part of libmsppath
-Copyright © 2006 Mikko Rasa, Mikkosoft Productions
+Copyright © 2006-2007 Mikko Rasa, Mikkosoft Productions
Distributed under the LGPL
*/
+
#ifndef MSP_PATH_PATH_H_
#define MSP_PATH_PATH_H_
#include <string>
namespace Msp {
-namespace Path {
enum
{
class Path
{
public:
- class iterator
+ class Iterator
{
public:
- iterator &operator++();
- iterator &operator--();
+ Iterator &operator++();
+ Iterator &operator--();
std::string operator*() const;
- bool operator==(const iterator &i) const { return (start==i.start && end==i.end); }
- bool operator!=(const iterator &i) const { return !(*this==i); }
+ bool operator==(const Iterator &i) const { return (start==i.start && end==i.end); }
+ bool operator!=(const Iterator &i) const { return !(*this==i); }
private:
const Path &path;
unsigned start,end;
- iterator(const Path &);
+ Iterator(const Path &);
friend class Path;
};
Path &operator/=(const Path &);
std::string operator[](int) const;
bool operator==(const Path &) const;
- iterator begin() const { return iterator(*this); }
- iterator end() const { iterator i(*this); i.start=i.end=std::string::npos; return i; }
+ Iterator begin() const { return Iterator(*this); }
+ Iterator end() const { Iterator i(*this); i.start=i.end=std::string::npos; return i; }
private:
std::string path;
inline std::ostream &operator<<(std::ostream &o, const Path &p) { o<<p.str(); return o; }
-} // namespace Path
} // namespace Msp
#endif