aboutsummaryrefslogtreecommitdiff
path: root/butl/path.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-12-17 15:57:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-12-17 15:57:42 +0200
commit900a4504d6045071b9bd48bcea206f633f08c681 (patch)
tree119bf28e3f4b761f7ba45e41470d1314f56b4b77 /butl/path.ixx
parentdb1ee9aff6e9429e3eb82e67f9d4ece22b7c95ef (diff)
Change path::extension() to return std::string, not C string
The old behaviour (sometimes useful) is provided by extension_cstring().
Diffstat (limited to 'butl/path.ixx')
-rw-r--r--butl/path.ixx13
1 files changed, 12 insertions, 1 deletions
diff --git a/butl/path.ixx b/butl/path.ixx
index b1212f4..9705b66 100644
--- a/butl/path.ixx
+++ b/butl/path.ixx
@@ -304,11 +304,22 @@ namespace butl
}
template <typename C, typename K>
- inline const C* basic_path<C, K>::
+ inline typename basic_path<C, K>::string_type basic_path<C, K>::
extension () const
{
const string_type& s (this->path_);
size_type p (traits::find_extension (s));
+ return p != string_type::npos
+ ? string_type (s.c_str () + p + 1)
+ : string_type ();
+ }
+
+ template <typename C, typename K>
+ inline const C* basic_path<C, K>::
+ extension_cstring () const
+ {
+ const string_type& s (this->path_);
+ size_type p (traits::find_extension (s));
return p != string_type::npos ? s.c_str () + p + 1 : nullptr;
}