]> git.tdb.fi Git - libs/core.git/blobdiff - source/fs/path.h
Style fix: add whitespace
[libs/core.git] / source / fs / path.h
index e560d3f96c4b3e1ae5b718f5d4a724e4fc8a57c2..c3c599a9e03d0a0dae8b9e47187086b49b407d1a 100644 (file)
@@ -1,10 +1,3 @@
-/* $Id$
-
-This file is part of libmspfs
-Copyright © 2006-2008  Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
 #ifndef MSP_FS_PATH_H_
 #define MSP_FS_PATH_H_
 
@@ -37,15 +30,15 @@ public:
 
        private:
                const Path &path;
-               std::string::size_type start,end;
+               std::string::size_type start, end;
 
                Iterator(const Path &);
        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:
@@ -55,13 +48,16 @@ public:
        Path();
        Path(const std::string &);
        Path(const char *);
+private:
+       void init(const std::string &);
 
+public:
        const std::string &str() const { return path; }
 
        /// Returns the number of components in the path.
-       unsigned    size() const;
+       unsigned size() const;
 
-       bool        empty() const { return path.empty(); }
+       bool empty() const { return path.empty(); }
 
        /// Determines whether the path starts from the root directory
        bool is_absolute() const;
@@ -73,18 +69,19 @@ public:
        Path operator/(const Path &p) const;
        Path &operator/=(const Path &);
 
-       /**
-       Extracts a single component from the path.  Negative indices count from the
-       end of the path.
-       */
-       std::string operator[](int) const;
-
-       bool        operator==(const Path &) const;
-       Iterator    begin() const;
-       Iterator    end() const;
 private:
-       void init(const std::string &);
+       /** Adds a component to the path.  It must not contain the directory
+       separator character. */
        void add_component(const std::string &);
+
+public:
+       /** Extracts a single component from the path.  Negative indices count from
+       the end of the path. */
+       std::string operator[](int) const;
+
+       bool operator==(const Path &) const;
+       Iterator begin() const;
+       Iterator end() const;
 };
 
 inline std::ostream &operator<<(std::ostream &o, const Path &p) { o<<p.str(); return o; }