From 510543e14b92ec3dd963135e679ed104420a8512 Mon Sep 17 00:00:00 2001 From: Frederic Bouvier Date: Sun, 22 Aug 2010 09:33:56 +0200 Subject: [PATCH] Add a convenience constructeur to SGPath --- simgear/misc/sg_path.cxx | 9 +++++++++ simgear/misc/sg_path.hxx | 8 ++++++++ 2 files changed, 17 insertions(+) diff --git a/simgear/misc/sg_path.cxx b/simgear/misc/sg_path.cxx index 58772cde..0de0d925 100644 --- a/simgear/misc/sg_path.cxx +++ b/simgear/misc/sg_path.cxx @@ -86,6 +86,15 @@ SGPath::SGPath( const std::string& p ) fix(); } +// create a path based on "path" and a "subpath" +SGPath::SGPath( const SGPath& p, const std::string& r ) + : path(p.path), + _cached(false) +{ + append(r); + fix(); +} + SGPath::SGPath(const SGPath& p) : path(p.path), _cached(p._cached), diff --git a/simgear/misc/sg_path.hxx b/simgear/misc/sg_path.hxx index 77b69ca3..6f8968b7 100644 --- a/simgear/misc/sg_path.hxx +++ b/simgear/misc/sg_path.hxx @@ -58,6 +58,7 @@ public: /** Default constructor */ SGPath(); + /** Copy contructor */ SGPath(const SGPath& p); SGPath& operator=(const SGPath& p); @@ -68,6 +69,13 @@ public: */ SGPath( const std::string& p ); + /** + * Construct a path based on the starting path provided and a relative subpath + * @param p initial path + * @param r relative subpath + */ + SGPath( const SGPath& p, const std::string& r ); + /** Destructor */ ~SGPath(); -- 2.39.5