summaryrefslogtreecommitdiff
path: root/src/string.hh
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2016-11-28 23:53:50 +0000
committerMaxime Coste <frrrwww@gmail.com>2016-11-28 23:58:08 +0000
commit12856066b1065adc99aa1ee0319e91f8eaf522cb (patch)
tree26c8e81b6522d05b1d9632f3f5bd0b19476c413f /src/string.hh
parentda6d7f4530f490ec262bd640f9c51d0bc3d5ef53 (diff)
Cleanup include dependencies a bit
Diffstat (limited to 'src/string.hh')
-rw-r--r--src/string.hh30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/string.hh b/src/string.hh
index 5721dc6a..d7e39ff9 100644
--- a/src/string.hh
+++ b/src/string.hh
@@ -114,7 +114,7 @@ public:
explicit String(Codepoint cp, ColumnCount count)
{
kak_assert(count % codepoint_width(cp) == 0);
- int cp_count = (int)count / codepoint_width(cp);
+ int cp_count = (int)(count / codepoint_width(cp));
reserve(utf8::codepoint_size(cp) * cp_count);
while (cp_count-- > 0)
utf8::dump(std::back_inserter(*this), cp);
@@ -289,7 +289,7 @@ inline String& operator+=(String& lhs, StringView rhs)
inline String operator+(StringView lhs, StringView rhs)
{
String res;
- res.reserve((int)(lhs.length() + rhs.length()));
+ res.reserve(lhs.length() + rhs.length());
res.append(lhs.data(), lhs.length());
res.append(rhs.data(), rhs.length());
return res;
@@ -312,6 +312,11 @@ inline bool operator<(const StringView& lhs, const StringView& rhs)
rhs.begin(), rhs.end());
}
+inline String operator"" _str(const char* str, size_t)
+{
+ return String(str);
+}
+
Vector<String> split(StringView str, char separator, char escape);
Vector<StringView> split(StringView str, char separator);
@@ -335,11 +340,17 @@ String join(const Container& container, char joiner, bool esc_joiner = true)
return res;
}
-inline String operator"" _str(const char* str, size_t)
+inline bool prefix_match(StringView str, StringView prefix)
{
- return String(str);
+ return str.substr(0_byte, prefix.length()) == prefix;
}
+bool subsequence_match(StringView str, StringView subseq);
+
+String expand_tabs(StringView line, ColumnCount tabstop, ColumnCount col = 0);
+
+Vector<StringView> wrap_lines(StringView text, ColumnCount max_width);
+
int str_to_int(StringView str); // throws on error
Optional<int> str_to_int_ifp(StringView str);
@@ -377,17 +388,6 @@ to_string(const StronglyTypedNumber<RealType, ValueType>& val)
return to_string((ValueType)val);
}
-inline bool prefix_match(StringView str, StringView prefix)
-{
- return str.substr(0_byte, prefix.length()) == prefix;
-}
-
-bool subsequence_match(StringView str, StringView subseq);
-
-String expand_tabs(StringView line, ColumnCount tabstop, ColumnCount col = 0);
-
-Vector<StringView> wrap_lines(StringView text, ColumnCount max_width);
-
namespace detail
{