diff options
author | crupest <crupest@outlook.com> | 2020-04-20 01:17:28 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-04-20 01:17:28 +0800 |
commit | 857adcb7ee2d45b2e29d4250fa4246bb8861a8f9 (patch) | |
tree | 2ebe62c58768ded27c5c6b15d1ab04400c9ecf9b /include/cru/platform/native/input_method.hpp | |
parent | 494d2db1c1203acc9d9f2b127b75c6df6160057a (diff) | |
download | cru-857adcb7ee2d45b2e29d4250fa4246bb8861a8f9.tar.gz cru-857adcb7ee2d45b2e29d4250fa4246bb8861a8f9.tar.bz2 cru-857adcb7ee2d45b2e29d4250fa4246bb8861a8f9.zip |
...
Diffstat (limited to 'include/cru/platform/native/input_method.hpp')
-rw-r--r-- | include/cru/platform/native/input_method.hpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/include/cru/platform/native/input_method.hpp b/include/cru/platform/native/input_method.hpp index 48895f84..4034be4e 100644 --- a/include/cru/platform/native/input_method.hpp +++ b/include/cru/platform/native/input_method.hpp @@ -1,8 +1,10 @@ #pragma once #include "../resource.hpp" #include "base.hpp" + #include "cru/common/event.hpp" +#include <iostream> #include <memory> #include <vector> @@ -21,6 +23,23 @@ struct CompositionText { TextRange selection; }; +inline std::ostream& operator<<(std::ostream& stream, + const CompositionText& composition_text) { + stream << "text: " << composition_text.text << "\n" + << "clauses:\n"; + for (int i = 0; i < composition_text.clauses.size(); i++) { + const auto& clause = composition_text.clauses[i]; + stream << "\t" << i << ". start:" << clause.start << " end:" << clause.end; + if (clause.target) { + stream << " target"; + } + stream << "\n"; + } + stream << "selection: position:" << composition_text.selection.position + << " count:" << composition_text.selection.count; + return stream; +} + struct IInputMethodContext : virtual INativeResource { // Return true if you should draw composition text manually. Return false if // system will take care of that for you. |