summaryrefslogtreecommitdiffhomepage
path: root/include/ocl
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal@nekernel.org>2026-01-08 09:38:31 +0100
committerAmlal El Mahrouss <amlal@nekernel.org>2026-01-08 09:38:31 +0100
commit2d2a850a61dbe5695ba92dfc4dcb107c10d3bce6 (patch)
treef8486476d7056dc037db5362a46dfeb8a53adcda /include/ocl
parent519f2f91dc3c5f465874c517c8d5c963e0444e45 (diff)
feat: `operator<<` for const crope/wrope. API improvements.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'include/ocl')
-rw-r--r--include/ocl/tproc/detail/rope_fwd.hpp8
-rw-r--r--include/ocl/tproc/detail/rope_fwd.inl10
-rw-r--r--include/ocl/tproc/rope.hpp26
3 files changed, 29 insertions, 15 deletions
diff --git a/include/ocl/tproc/detail/rope_fwd.hpp b/include/ocl/tproc/detail/rope_fwd.hpp
index 9fe6212..0aabf86 100644
--- a/include/ocl/tproc/detail/rope_fwd.hpp
+++ b/include/ocl/tproc/detail/rope_fwd.hpp
@@ -42,8 +42,8 @@ namespace ocl::tproc
rope_ptr operator++();
rope_ptr operator++(int);
- const rope_ptr cbegin();
- const rope_ptr cend();
+ const rope_ptr cbegin() const;
+ const rope_ptr cend() const;
rope_ptr concat(rope_ptr right);
@@ -56,7 +56,7 @@ namespace ocl::tproc
bool starts_with(const boost::core::basic_string_view<CharT>&);
bool ends_with(const boost::core::basic_string_view<CharT>&);
- size_type size();
+ size_type size() const;
bool empty() const;
rope_ptr insert(size_type pos,
@@ -64,7 +64,7 @@ namespace ocl::tproc
rope_ptr) const;
boost::core::basic_string_view<value_type> data();
- const boost::core::basic_string_view<value_type> c_str();
+ const boost::core::basic_string_view<value_type> c_str() const;
public:
basic_rope(const boost::core::basic_string_view<CharT>& in = {});
diff --git a/include/ocl/tproc/detail/rope_fwd.inl b/include/ocl/tproc/detail/rope_fwd.inl
index 5ce38f8..4fd6e9a 100644
--- a/include/ocl/tproc/detail/rope_fwd.inl
+++ b/include/ocl/tproc/detail/rope_fwd.inl
@@ -396,7 +396,7 @@ namespace ocl::tproc
}
template <class CharT, class Traits, class Allocator>
- const basic_rope<CharT, Traits, Allocator>::rope_ptr basic_rope<CharT, Traits, Allocator>::cbegin()
+ const basic_rope<CharT, Traits, Allocator>::rope_ptr basic_rope<CharT, Traits, Allocator>::cbegin() const
{
if (impl_->is_leaf())
return this;
@@ -405,14 +405,14 @@ namespace ocl::tproc
}
template <class CharT, class Traits, class Allocator>
- const basic_rope<CharT, Traits, Allocator>::rope_ptr basic_rope<CharT, Traits, Allocator>::cend()
+ const basic_rope<CharT, Traits, Allocator>::rope_ptr basic_rope<CharT, Traits, Allocator>::cend() const
{
return nullptr;
}
template <class CharT, class Traits, class Allocator>
basic_rope<CharT, Traits, Allocator>::size_type
- basic_rope<CharT, Traits, Allocator>::size()
+ basic_rope<CharT, Traits, Allocator>::size() const
{
return impl_->size();
}
@@ -567,7 +567,7 @@ namespace ocl::tproc
template <class CharT, class Traits, class Allocator>
const boost::core::basic_string_view<typename basic_rope<CharT, Traits, Allocator>::value_type>
- basic_rope<CharT, Traits, Allocator>::c_str()
+ basic_rope<CharT, Traits, Allocator>::c_str() const
{
return {impl_->blob_, impl_->capacity_};
}
@@ -603,7 +603,7 @@ namespace ocl::tproc
{
return data();
}
-
+
template <class CharT, class Traits, class Allocator>
basic_rope<CharT, Traits, Allocator>::rope_ptr basic_rope<CharT, Traits, Allocator>::operator++()
{
diff --git a/include/ocl/tproc/rope.hpp b/include/ocl/tproc/rope.hpp
index 05e5399..fba755a 100644
--- a/include/ocl/tproc/rope.hpp
+++ b/include/ocl/tproc/rope.hpp
@@ -194,14 +194,28 @@ namespace ocl::tproc
} // namespace ocl::tproc
-inline std::ostream & operator<<(std::ostream& os, ocl::tproc::crope& r){
- os << r.data();
- return os;
+inline std::ostream& operator<<(std::ostream& os, ocl::tproc::crope& r)
+{
+ os << r.data();
+ return os;
+}
+
+inline std::wostream& operator<<(std::wostream& os, ocl::tproc::wrope& r)
+{
+ os << r.data();
+ return os;
}
-inline std::wostream & operator<<(std::wostream& os, ocl::tproc::wrope& r){
- os << r.data();
- return os;
+inline std::ostream& operator<<(std::ostream& os, const ocl::tproc::crope& r)
+{
+ os << r.c_str();
+ return os;
+}
+
+inline std::wostream& operator<<(std::wostream& os, const ocl::tproc::wrope& r)
+{
+ os << r.c_str();
+ return os;
}
#include "rope.inl"