]> de.git.xonotic.org Git - xonotic/netradiant.git/blobdiff - libs/fs_path.h
radiant: replace StringBuffer with std::string
[xonotic/netradiant.git] / libs / fs_path.h
index 2baf297ed803f9fa1d3dd4085cb7169b24444872..ee9458143685eae37a515f3a577853819ac04447 100644 (file)
 #if !defined( INCLUDED_FS_PATH_H )
 #define INCLUDED_FS_PATH_H
 
-#include "stream/stringstream.h"
-
 /// \brief A unix-style path string which can be modified at runtime.
 ///
 /// - Maintains a path ending in a path-separator.
 /// - Provides a limited STL-style interface to push and pop file or directory names at the end of the path.
 class UnixPath
 {
-StringBuffer m_string;
+std::string m_string;
 
-void check_separator(){
+void ensure_separator(){
        if ( !empty() && m_string.back() != '/' ) {
                m_string.push_back( '/' );
        }
@@ -42,7 +40,7 @@ public:
 /// \brief Constructs with the directory \p root.
 UnixPath( const char* root )
        : m_string( root ){
-       check_separator();
+       ensure_separator();
 }
 
 bool empty() const {
@@ -55,17 +53,12 @@ const char* c_str() const {
 
 /// \brief Appends the directory \p name.
 void push( const char* name ){
-       m_string.push_string( name );
-       check_separator();
-}
-/// \brief Appends the directory [\p first, \p last).
-void push( const char* first, const char* last ){
-       m_string.push_range( first, last );
-       check_separator();
+       m_string += name;
+       ensure_separator();
 }
 /// \brief Appends the filename \p name.
 void push_filename( const char* name ){
-       m_string.push_string( name );
+       m_string += name;
 }
 /// \brief Removes the last directory or filename appended.
 void pop(){