Debian Codegraph @

src/rime/config/legacy_preset_config_plugin.cc

raw symbols SCIP
1 //cxx . . $ `<file>/src/rime/config/legacy_preset_config_plugin.cc`/
2 // Copyright RIME Developers
3 // Distributed under the BSD License
4 //
5 #include <boost/algorithm/string.hpp>
6 #include <rime/config/config_compiler_impl.h>cxx . . $ `<file>/src/rime/config/config_compiler_impl.h`/
7 #include <rime/config/config_cow_ref.h>cxx . . $ `<file>/src/rime/config/config_cow_ref.h`/
8 #include <rime/config/plugins.h>cxx . . $ `<file>/src/rime/config/plugins.h`/
9
10 namespace rimecxx . . $ rime/ {
11
12 bool LegacyPresetConfigPlugincxx . . $ rime/LegacyPresetConfigPlugin#::ReviewCompileOutputcxx . . $ rime/LegacyPresetConfigPlugin#ReviewCompileOutput(8ebeb6fbc6f6012d).(
13 ConfigCompilercxx . . $ rime/ConfigCompiler#* compiler,
14 ancxx . . $ rime/an#<ConfigResourcecxx . . $ rime/ConfigResource#> resource) {
15 return true;
16 }
17
18 bool LegacyPresetConfigPlugincxx . . $ rime/LegacyPresetConfigPlugin#::ReviewLinkOutputcxx . . $ rime/LegacyPresetConfigPlugin#ReviewLinkOutput(8ebeb6fbc6f6012d).(ConfigCompilercxx . . $ rime/ConfigCompiler#* compiler,
19 ancxx . . $ rime/an#<ConfigResourcecxx . . $ rime/ConfigResource#> resource) {
20 if (!boostcxx . . $ boost/::ends_withcxx . . $ boost/ends_with(acb94948942028a1).(resource->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).resource_idcxx . . $ rime/ConfigResource#resource_id., ".schema"))
21 return true;
22 if (auto preset = resource->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).datacxx . . $ rime/ConfigResource#data.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).Traversecxx . . $ rime/ConfigData#Traverse(31193a337a6d9a00).("key_binder/import_preset"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).)) {
23 if (!Iscxx . . $ rime/Is(cc6f6ab668392acd).<ConfigValuecxx . . $ rime/ConfigValue#>(preset))
24 return false;
25 auto preset_config_id = Ascxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).<ConfigValuecxx . . $ rime/ConfigValue#>(preset)->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).strcxx . . $ rime/ConfigValue#str(f4fff0029955a25f).();
26 LOGcxx . . $ `<external>/8254875247241458228/logging.h:610:9`!(INFO) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "interpreting key_binder/import_preset: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). preset_config_id;
27 auto target = Cowcxx . . $ rime/Cow(6ec5af7d5be58712).(resourcecxx . . $ std/shared_ptr#shared_ptr(d70455e50ed85f60)., "key_binder"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
28 auto map = Ascxx . . $ rime/As(f7ae99698a17f8b6).<ConfigMapcxx . . $ rime/ConfigMap#>(*cxx . . $ rime/ConfigItemRef#`operator*`(940c12adcf964a72).*cxx . . $ std/__shared_ptr_access#`operator*`(d426bc7b625886b7).target);
29 if (map && map->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).HasKeycxx . . $ rime/ConfigMap#HasKey(13a55b95a0133754).("bindings"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).)) {
30 // append to included list `key_binder/bindings/+` instead of overwriting
31 auto appended = map->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).Getcxx . . $ rime/ConfigMap#Get(5cb32bf87d44925a).("bindings"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).);
32 *cxx . . $ std/__shared_ptr_access#`operator*`(d426bc7b625886b7).Cowcxx . . $ rime/Cow(6ec5af7d5be58712).(targetcxx . . $ std/shared_ptr#shared_ptr(159b2ef84668bf93)., "bindings/+"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).) =cxx . . $ rime/ConfigItemRef#`operator=`(6ccbc758b4fa24b6). appended;
33 // `*target` is already referencing a copied map, safe to edit directly
34 (*cxx . . $ std/__shared_ptr_access#`operator*`(d426bc7b625886b7).target)[cxx . . $ rime/ConfigItemRef#`operator[]`(d7481d3880d4f286)."bindings"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).] =cxx . . $ rime/ConfigItemRef#`operator=`(6ccbc758b4fa24b6). nullptr;
35 }
36 Referencecxx . . $ rime/Reference# reference{preset_config_id, "key_binder", false};
37 if (!IncludeReferencecxx . . $ rime/IncludeReference#IncludeReference(6b5aab9989e04ffc).{reference}.TargetedAtcxx . . $ rime/Dependency#TargetedAt(7d723a6d1190687b).(targetcxx . . $ std/shared_ptr#shared_ptr(159b2ef84668bf93).).Resolvecxx . . $ rime/Dependency#Resolve(75253e1edc3ee18).(compiler)) {
38 LOGcxx . . $ `<external>/8254875247241458228/logging.h:610:9`!(ERROR) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "failed to include section " <<cxx . . $ rime/`operator<<`(f42c1be8afa536a9). reference;
39 return false;
40 }
41 }
42 // NOTE: in the following cases, Cow() is not strictly necessary because
43 // we know for sure that no other ConfigResource is going to reference the
44 // root map node that will be modified. But other than the root node of the
45 // resource being linked, it's possible a map or list has multiple references
46 // in the node tree, therefore Cow() is recommended to make sure the
47 // modifications only happen to one place.
48 if (auto preset = resource->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).datacxx . . $ rime/ConfigResource#data.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).Traversecxx . . $ rime/ConfigData#Traverse(31193a337a6d9a00).("punctuator/import_preset"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).)) {
49 if (!Iscxx . . $ rime/Is(cc6f6ab668392acd).<ConfigValuecxx . . $ rime/ConfigValue#>(preset))
50 return false;
51 auto preset_config_id = Ascxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).<ConfigValuecxx . . $ rime/ConfigValue#>(preset)->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).strcxx . . $ rime/ConfigValue#str(f4fff0029955a25f).();
52 LOGcxx . . $ `<external>/8254875247241458228/logging.h:610:9`!(INFO) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "interpreting punctuator/import_preset: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). preset_config_id;
53 Referencecxx . . $ rime/Reference# reference{preset_config_id, "punctuator", false};
54 if (!IncludeReferencecxx . . $ rime/IncludeReference#IncludeReference(6b5aab9989e04ffc).{reference}
55 .TargetedAtcxx . . $ rime/Dependency#TargetedAt(7d723a6d1190687b).(Cowcxx . . $ rime/Cow(6ec5af7d5be58712).(resourcecxx . . $ std/shared_ptr#shared_ptr(d70455e50ed85f60)., "punctuator"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).))
56 .Resolvecxx . . $ rime/Dependency#Resolve(75253e1edc3ee18).(compiler)) {
57 LOGcxx . . $ `<external>/8254875247241458228/logging.h:610:9`!(ERROR) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "failed to include section " <<cxx . . $ rime/`operator<<`(f42c1be8afa536a9). reference;
58 return false;
59 }
60 }
61 if (auto preset = resource->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).datacxx . . $ rime/ConfigResource#data.->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).Traversecxx . . $ rime/ConfigData#Traverse(31193a337a6d9a00).("recognizer/import_preset"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).)) {
62 if (!Iscxx . . $ rime/Is(cc6f6ab668392acd).<ConfigValuecxx . . $ rime/ConfigValue#>(preset))
63 return false;
64 auto preset_config_id = Ascxx . . $ std/__cxx11/basic_string#basic_string(a47f53d4115f6ce5).<ConfigValuecxx . . $ rime/ConfigValue#>(preset)->cxx . . $ std/__shared_ptr_access#`operator->`(34d6acfd341ba7ab).strcxx . . $ rime/ConfigValue#str(f4fff0029955a25f).();
65 LOGcxx . . $ `<external>/8254875247241458228/logging.h:610:9`!(INFO) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "interpreting recognizer/import_preset: " <<cxx . . $ std/`operator<<`(88df5bef833f7f83). preset_config_id;
66 Referencecxx . . $ rime/Reference# reference{preset_config_id, "recognizer", false};
67 if (!IncludeReferencecxx . . $ rime/IncludeReference#IncludeReference(6b5aab9989e04ffc).{reference}
68 .TargetedAtcxx . . $ rime/Dependency#TargetedAt(7d723a6d1190687b).(Cowcxx . . $ rime/Cow(6ec5af7d5be58712).(resourcecxx . . $ std/shared_ptr#shared_ptr(d70455e50ed85f60)., "recognizer"cxx . . $ std/__cxx11/basic_string#basic_string(e36662616dba894d).))
69 .Resolvecxx . . $ rime/Dependency#Resolve(75253e1edc3ee18).(compiler)) {
70 LOGcxx . . $ `<external>/8254875247241458228/logging.h:610:9`!(ERROR) <<cxx . . $ std/`operator<<`(efaf8c13fc75f3c7). "failed to include section " <<cxx . . $ rime/`operator<<`(f42c1be8afa536a9). reference;
71 return false;
72 }
73 }
74 return true;
75 }
76
77 } // namespace rime