[vte] vteunistr: Add method to concatenate two unistrs



commit 27411d1642d3bbafe5986e4f406db361a326a31e
Author: Egmont Koblinger <egmont gmail com>
Date:   Mon Feb 4 23:05:45 2019 +0100

    vteunistr: Add method to concatenate two unistrs

 src/vteunistr.cc | 13 +++++++++++++
 src/vteunistr.h  | 13 +++++++++++++
 2 files changed, 26 insertions(+)
---
diff --git a/src/vteunistr.cc b/src/vteunistr.cc
index 2e412e3e..69c47fe0 100644
--- a/src/vteunistr.cc
+++ b/src/vteunistr.cc
@@ -140,6 +140,19 @@ _vte_unistr_append_unichar (vteunistr s, gunichar c)
        return ret;
 }
 
+vteunistr
+_vte_unistr_append_unistr (vteunistr s, vteunistr t)
+{
+        g_return_val_if_fail (s < unistr_next, s);
+        g_return_val_if_fail (t < unistr_next, s);
+        if (G_UNLIKELY (t >= VTE_UNISTR_START)) {
+                s = _vte_unistr_append_unistr (s, DECOMP_FROM_UNISTR (t).prefix);
+                return _vte_unistr_append_unichar (s, DECOMP_FROM_UNISTR (t).suffix);
+        } else {
+                return _vte_unistr_append_unichar (s, t);
+        }
+}
+
 gunichar
 _vte_unistr_get_base (vteunistr s)
 {
diff --git a/src/vteunistr.h b/src/vteunistr.h
index 04aa9fb6..9bde6b2c 100644
--- a/src/vteunistr.h
+++ b/src/vteunistr.h
@@ -57,6 +57,19 @@ typedef guint32 vteunistr;
 vteunistr
 _vte_unistr_append_unichar (vteunistr s, gunichar c);
 
+/**
+ * _vte_unistr_append_unistr:
+ * @s: a #vteunistr
+ * @t: another #vteunistr to append to @s
+ *
+ * Creates a vteunistr value for the string @s followed by the
+ * string @t.
+ *
+ * Returns: the new #vteunistr value
+ **/
+vteunistr
+_vte_unistr_append_unistr (vteunistr s, vteunistr t);
+
 gunichar
 _vte_unistr_get_base (vteunistr s);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]