Codebase list mozc / 8902bb4
Protobuf file location refactoring part 3. This is a series of CLs to move *.proto files into protocol/ directory. Following file will be moved in this CL. - user_dictionary_storage.proto This is just a refactoring. No user-visible behavior change should occur. BUG=none TEST=unittest Hiroyuki Komatsu authored 8 years ago Yohei Yukawa committed 8 years ago
24 changed file(s) with 371 addition(s) and 371 deletion(s). Raw diff Collapse all Expand all
175175 'type': 'none',
176176 'variables': {
177177 'proto_files': [
178 '../dictionary/user_dictionary_storage.proto',
178 '../protocol/user_dictionary_storage.proto',
179179 ],
180180 },
181181 'actions': [
6565 '../base/base.gyp:base',
6666 '../config/config.gyp:config_handler',
6767 '../config/config.gyp:config_protocol',
68 'dictionary_base.gyp:dictionary_protocol',
68 '../protocol/protocol.gyp:user_dictionary_storage_proto',
6969 'dictionary_base.gyp:pos_matcher',
7070 'dictionary_base.gyp:suppression_dictionary',
7171 ],
112112 ],
113113 },
114114 {
115 'target_name': 'genproto_dictionary',
116 'type': 'none',
117 'toolsets': ['host'],
118 'sources': [
119 'user_dictionary_storage.proto',
120 ],
121 'includes': [
122 '../protobuf/genproto.gypi',
123 ],
124 },
125 {
126 'target_name': 'dictionary_protocol',
127 'type': 'static_library',
128 'hard_dependency': 1,
129 'sources': [
130 '<(proto_out_dir)/<(relative_dir)/user_dictionary_storage.pb.cc',
131 ],
132 'dependencies': [
133 '../protobuf/protobuf.gyp:protobuf',
134 'genproto_dictionary#host',
135 ],
136 'export_dependent_settings': [
137 'genproto_dictionary#host',
138 ],
139 },
140 {
141115 'target_name': 'gen_pos_map',
142116 'type': 'none',
143117 'toolsets': ['host'],
199173 '../base/base.gyp:config_file_stream',
200174 '../config/config.gyp:config_handler',
201175 '../config/config.gyp:config_protocol',
176 '../protocol/protocol.gyp:user_dictionary_storage_proto',
202177 '../usage_stats/usage_stats_base.gyp:usage_stats',
203 'dictionary_protocol',
204178 'gen_pos_map#host',
205179 'pos_matcher',
206180 'suppression_dictionary',
3838 #include "dictionary/dictionary_interface.h"
3939 #include "dictionary/pos_matcher.h"
4040 #include "dictionary/suppression_dictionary.h"
41 #include "dictionary/user_dictionary_storage.pb.h"
4241 #include "dictionary/user_pos_interface.h"
42 #include "protocol/user_dictionary_storage.pb.h"
4343
4444 namespace mozc {
4545
3333
3434 #include "base/port.h"
3535 #include "base/string_piece.h"
36 #include "dictionary/user_dictionary_storage.pb.h"
36 #include "protocol/user_dictionary_storage.pb.h"
3737
3838 namespace mozc {
3939
3131
3232 #include "base/flags.h"
3333 #include "dictionary/user_dictionary_importer.h"
34 #include "dictionary/user_dictionary_storage.pb.h"
34 #include "protocol/user_dictionary_storage.pb.h"
3535
3636 int main(int argc, char **argv) {
3737 InitGoogle(argv[0], &argc, &argv, false);
3636 #include "base/protobuf/repeated_field.h"
3737 #include "dictionary/user_dictionary_importer.h"
3838 #include "dictionary/user_dictionary_storage.h"
39 #include "dictionary/user_dictionary_storage.pb.h"
4039 #include "dictionary/user_dictionary_util.h"
40 #include "protocol/user_dictionary_storage.pb.h"
4141
4242 namespace mozc {
4343 namespace user_dictionary {
3333
3434 #include "base/scoped_ptr.h"
3535 #include "base/port.h"
36 #include "dictionary/user_dictionary_storage.pb.h"
36 #include "protocol/user_dictionary_storage.pb.h"
3737
3838 namespace mozc {
3939
3636 #include "base/scoped_ptr.h"
3737 #include "base/util.h"
3838 #include "dictionary/user_dictionary_session.h"
39 #include "dictionary/user_dictionary_storage.pb.h"
4039 #include "dictionary/user_dictionary_util.h"
40 #include "protocol/user_dictionary_storage.pb.h"
4141
4242 namespace mozc {
4343 namespace user_dictionary {
3636 #include "base/protobuf/protobuf.h"
3737 #include "base/protobuf/repeated_field.h"
3838 #include "base/system_util.h"
39 #include "dictionary/user_dictionary_storage.pb.h"
39 #include "protocol/user_dictionary_storage.pb.h"
4040 #include "testing/base/public/gunit.h"
4141 #include "testing/base/public/testing_util.h"
4242
3434
3535 #include "base/file_util.h"
3636 #include "base/system_util.h"
37 #include "dictionary/user_dictionary_storage.pb.h"
3837 #include "dictionary/user_dictionary_storage.h"
38 #include "protocol/user_dictionary_storage.pb.h"
3939 #include "testing/base/public/gunit.h"
4040 #include "testing/base/public/testing_util.h"
4141
6363 #include <string>
6464 #include "base/port.h"
6565 #include "base/scoped_ptr.h"
66 #include "dictionary/user_dictionary_storage.pb.h"
66 #include "protocol/user_dictionary_storage.pb.h"
6767
6868 namespace mozc {
6969
+0
-318
src/dictionary/user_dictionary_storage.proto less more
0 // Copyright 2010-2015, Google Inc.
1 // All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 // * Neither the name of Google Inc. nor the names of its
14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 syntax = "proto2";
30
31 package mozc.user_dictionary;
32
33 option java_outer_classname = "ProtoUserDictionaryStorage";
34 option java_package = "org.mozc.android.inputmethod.japanese.protobuf";
35
36 message UserDictionary {
37 enum PosType {
38 NOUN = 1; // "名詞"
39 ABBREVIATION = 2; // "短縮よみ"
40 SUGGESTION_ONLY = 3; // "サジェストのみ"
41 PROPER_NOUN = 4; // "固有名詞"
42 PERSONAL_NAME = 5; // "人名"
43 FAMILY_NAME = 6; // "姓"
44 FIRST_NAME = 7; // "名"
45 ORGANIZATION_NAME = 8; // "組織"
46 PLACE_NAME = 9; // "地名"
47 SA_IRREGULAR_CONJUGATION_NOUN = 10; // "名詞サ変"
48 ADJECTIVE_VERBAL_NOUN = 11; // "名詞形動"
49 NUMBER = 12; // "数"
50 ALPHABET = 13; // "アルファベット"
51 SYMBOL = 14; // "記号"
52 EMOTICON = 15; // "顔文字"
53
54 ADVERB = 16; // "副詞"
55 PRENOUN_ADJECTIVAL = 17; // "連体詞"
56 CONJUNCTION = 18; // "接続詞"
57 INTERJECTION = 19; // "感動詞"
58
59 PREFIX = 20; // "接頭語"
60 COUNTER_SUFFIX = 21; // "助数詞"
61 GENERIC_SUFFIX = 22; // "接尾一般"
62 PERSON_NAME_SUFFIX = 23; // "接尾人名"
63 PLACE_NAME_SUFFIX = 24; // "接尾地名"
64
65 WA_GROUP1_VERB = 25; // "動詞ワ行五段"
66 KA_GROUP1_VERB = 26; // "動詞カ行五段"
67 SA_GROUP1_VERB = 27; // "動詞サ行五段"
68 TA_GROUP1_VERB = 28; // "動詞タ行五段"
69 NA_GROUP1_VERB = 29; // "動詞ナ行五段"
70 MA_GROUP1_VERB = 30; // "動詞マ行五段"
71 RA_GROUP1_VERB = 31; // "動詞ラ行五段"
72 GA_GROUP1_VERB = 32; // "動詞ガ行五段"
73 BA_GROUP1_VERB = 33; // "動詞バ行五段"
74 HA_GROUP1_VERB = 34; // "動詞ハ行四段"
75 GROUP2_VERB = 35; // "動詞一段"
76 KURU_GROUP3_VERB = 36; // "動詞カ変"
77 SURU_GROUP3_VERB = 37; // "動詞サ変"
78 ZURU_GROUP3_VERB = 38; // "動詞ザ変"
79 RU_GROUP3_VERB = 39; // "動詞ラ変"
80
81 ADJECTIVE = 40; // "形容詞"
82 SENTENCE_ENDING_PARTICLE = 41; // "終助詞"
83 PUNCTUATION = 42; // "句読点"
84 FREE_STANDING_WORD = 43; // "独立語"
85
86 SUPPRESSION_WORD = 44; // "抑制単語"
87 };
88
89 // ID of this dictionary
90 optional uint64 id = 1 [ default = 0 ];
91
92 // set false if this dictionary is not used.
93 // Even if |enabled| is false, the dictionary
94 // it self is visible to user.
95 optional bool enabled = 2 [ default = true ];
96
97 // name of dictionary
98 optional string name = 3 [ default = "" ];
99
100 // entry of each word
101 message Entry {
102 optional string key = 1 [ default = "" ];
103 optional string value = 2 [ default = "" ];
104 // Do NOT use tag number '3' in this proto. Please see below.
105 optional string comment = 4 [ default = "" ];
106
107 // Historically we used to use tag number '3' for POS in string format.
108 // In order to switch it to enum based POS, we removed (deprecated) the
109 // tag number '3' field and created another field numbered '5'.
110 optional PosType pos = 5;
111
112 // set true if this entry is removed.
113 // This flag is used for cloud sync feature.
114 // Cloud sync feature is already deprecated and this flag is only
115 // used to convert sync dictionary to normal dictionary.
116 optional bool removed = 10 [ default = false ];
117
118 // set true if this entry is automatically registered
119 // by converter.
120 optional bool auto_registered = 11 [ default = false ];
121 };
122
123 repeated Entry entries = 4;
124
125 // set true if this dictionary is removed.
126 // This flag is used for cloud sync feature.
127 // Cloud sync feature is already deprecated and this flag is only
128 // used to convert sync dictionary to normal dictionary.
129 optional bool removed = 5 [ default = false ];
130
131 // This flag is used for cloud sync feature.
132 // Cloud sync feature is already deprecated and this flag is only
133 // used to convert sync dictionary to normal dictionary.
134 optional bool syncable = 6 [ default = false ];
135 };
136
137 message UserDictionaryStorage {
138 // version of user dictionary
139 optional int32 version = 1 [ default = 0 ];
140
141 // dictionary body
142 repeated UserDictionary dictionaries = 2;
143
144 enum StorageType {
145 SNAPSHOT = 1; // This storage is a snapshot.
146 UPDATE = 2; // This storage is a diff of some snapshots.
147 };
148
149 optional StorageType storage_type = 10 [ default = SNAPSHOT ];
150 };
151
152 message UserDictionaryCommand {
153 enum CommandType {
154 // Does nothing.
155 NO_OPERATION = 0;
156
157 // Unlink the user dictionary file if necessary.
158 // We can do this operation without creating a session.
159 // This operation is introduced as a last resort to clean up
160 // user dictionary, so it *forces* to unlink the file regardless
161 // of the current user dictionary session status.
162 CLEAR_STORAGE = 1;
163
164 // Creates a new session, and returns its id via
165 // UserDictionaryCommandStatus::session_id.
166 CREATE_SESSION = 2;
167
168 // Deletes the session identified by session_id.
169 DELETE_SESSION = 3;
170
171 // Sets the default dictionary name. It will be used when
172 // ensure_non_empty_storage is enabled and the operation supporting the
173 // flag is invoked.
174 SET_DEFAULT_DICTIONARY_NAME = 4;
175
176 // Checks if the session is currently undoable or not.
177 CHECK_UNDOABILITY = 5;
178
179 // Undoes the last operation.
180 UNDO = 6;
181
182 // Loads from local storage.
183 LOAD = 7;
184
185 // Saves to local storage.
186 SAVE = 8;
187
188 // Returns a list of name and dictionary-id pairs.
189 // They are filled in the form of UserDictionary without any entries
190 // in UserDictionaryCommandStatus::storage.
191 GET_USER_DICTIONARY_NAME_LIST = 9;
192
193 // Returns the number of entries in the dictionary with the
194 // given dictionary_id.
195 GET_ENTRY_SIZE = 10;
196
197 // Use GET_ENTRIES instead.
198 OBSOLETE_GET_ENTRY = 11;
199
200 // Returns if it is possible to add new dictionary or not.
201 // The result is returned by using status code.
202 CHECK_NEW_DICTIONARY_AVAILABILITY = 12;
203
204 // Creates a new dictionary with the dictionary_name.
205 CREATE_DICTIONARY = 13;
206
207 // Deletes the dictionary with the given dictionary_id.
208 DELETE_DICTIONARY = 14;
209
210 // Renames the dictionary with the given dictionary_id to dictionary_name.
211 RENAME_DICTIONARY = 15;
212
213 // Returns if it is possible to add new entry to the dictionary
214 // with the given dictionary_id or not.
215 CHECK_NEW_ENTRY_AVAILABILITY = 16;
216
217 // Adds an entry to the dictionary with the given dictionary_id.
218 // Added entry should be located at the end of the dictionary, and
219 // the data should be passed via entry field.
220 ADD_ENTRY = 17;
221
222 // Edits an entry in the dictionary with the given dictionary_id.
223 // The new data should be passed via entry.
224 // The edit target should be specified via entry_index(0).
225 EDIT_ENTRY = 18;
226
227 // Deletes entries in the dictionary with the given dictionary_id.
228 // The target entries should be specified based on index in entry_index.
229 DELETE_ENTRY = 19;
230
231 // Imports entries from the given data into a dictionary.
232 // There are two ways to specify the dictionary:
233 // 1) set dictionary_id for the dictionary
234 // 2) set dictionary_name to create a new dictionary with the name.
235 IMPORT_DATA = 20;
236
237 // Gets the entire UserDictionaryStorage data.
238 // Note: The result of this command could be too large for IPC, which has a
239 // size limitation of the response data.
240 GET_STORAGE = 21;
241
242 // Returns entries in the dictionary specified by dictionary_id.
243 // The position of the entry should be specified via entry_index().
244 GET_ENTRIES = 22;
245 };
246
247 required CommandType type = 1;
248 optional uint64 session_id = 2;
249 optional uint64 dictionary_id = 3;
250 optional string dictionary_name = 4;
251 repeated int32 entry_index = 5;
252 optional UserDictionary.Entry entry = 6;
253 optional string data = 7;
254 optional bool ensure_non_empty_storage = 8;
255 };
256
257 message UserDictionaryCommandStatus {
258 // Note: this status code is now temporary assgined.
259 // It may be updated (incl. re-numbering) to organize the code.
260 // I.e., the code shouldn't be saved in serialized format for now.
261 // TODO(hidehiko): Re-organize and re-number the enum values,
262 // after we check all necessary codes in.
263 enum Status {
264 // Note: SUCCEEDED is conflicting Windows MACRO.
265 USER_DICTIONARY_COMMAND_SUCCESS = 1;
266 UNKNOWN_ERROR = 2;
267
268 UNKNOWN_COMMAND = 3;
269 INVALID_ARGUMENT = 4;
270
271 UNKNOWN_SESSION_ID = 5;
272
273 FILE_NOT_FOUND = 6;
274 INVALID_FILE_FORMAT = 7;
275
276 // Note: currently if we recieve this error status,
277 // the file is actually saved.
278 FILE_SIZE_LIMIT_EXCEEDED = 8;
279 DICTIONARY_SIZE_LIMIT_EXCEEDED = 9;
280 ENTRY_SIZE_LIMIT_EXCEEDED = 10;
281
282 UNKNOWN_DICTIONARY_ID = 11;
283 ENTRY_INDEX_OUT_OF_RANGE = 12;
284
285 // Errors for dictionary names.
286 DICTIONARY_NAME_EMPTY = 13;
287 DICTIONARY_NAME_TOO_LONG = 14;
288 DICTIONARY_NAME_CONTAINS_INVALID_CHARACTER = 15;
289 DICTIONARY_NAME_DUPLICATED = 16;
290
291 // Errors for entry data.
292 READING_EMPTY = 17;
293 READING_TOO_LONG = 18;
294 READING_CONTAINS_INVALID_CHARACTER = 19;
295 WORD_EMPTY = 20;
296 WORD_TOO_LONG = 21;
297 WORD_CONTAINS_INVALID_CHARACTER = 22;
298 INVALID_POS_TYPE = 23;
299 COMMENT_TOO_LONG = 24;
300 COMMENT_CONTAINS_INVALID_CHARACTER = 25;
301
302 // Errors for importing.
303 IMPORT_TOO_MANY_WORDS = 26;
304 IMPORT_INVALID_ENTRIES = 27;
305
306 NO_UNDO_HISTORY = 28;
307 };
308
309 required Status status = 1;
310 optional uint64 session_id = 2;
311 optional UserDictionaryStorage storage = 3;
312 // Use entries field instead.
313 optional UserDictionary.Entry OBSOLETE_entry = 4;
314 optional uint64 dictionary_id = 5;
315 optional uint32 entry_size = 6;
316 repeated UserDictionary.Entry entries = 7;
317 };
3535 #include <string>
3636 #include <vector>
3737 #include "base/port.h"
38 #include "dictionary/user_dictionary_storage.pb.h"
38 #include "protocol/user_dictionary_storage.pb.h"
3939
4040 namespace mozc {
4141
4646 '../converter/converter_base.gyp:segmenter',
4747 '../dictionary/dictionary.gyp:dictionary_impl',
4848 '../dictionary/dictionary.gyp:suffix_dictionary',
49 '../dictionary/dictionary_base.gyp:dictionary_protocol',
5049 '../dictionary/dictionary_base.gyp:pos_matcher',
5150 '../dictionary/dictionary_base.gyp:suppression_dictionary',
5251 '../dictionary/dictionary_base.gyp:user_dictionary',
5655 '../prediction/prediction.gyp:prediction',
5756 '../prediction/prediction_base.gyp:suggestion_filter',
5857 '../protocol/protocol.gyp:commands_proto',
58 '../protocol/protocol.gyp:user_dictionary_storage_proto',
5959 '../rewriter/rewriter.gyp:rewriter',
6060 ],
6161 },
5050 #include "dictionary/user_dictionary_importer.h"
5151 #include "dictionary/user_dictionary_session.h"
5252 #include "dictionary/user_dictionary_storage.h"
53 #include "dictionary/user_dictionary_storage.pb.h"
5453 #include "dictionary/user_dictionary_util.h"
5554 #include "dictionary/user_pos.h"
5655 #include "gui/base/win_util.h"
5756 #include "gui/config_dialog/combobox_delegate.h"
5857 #include "gui/dictionary_tool/find_dialog.h"
5958 #include "gui/dictionary_tool/import_dialog.h"
59 #include "protocol/user_dictionary_storage.pb.h"
6060
6161 namespace mozc {
6262 namespace gui {
5656 'base/window_title_modifier.cc',
5757 ],
5858 'dependencies': [
59 '../dictionary/dictionary_base.gyp:user_dictionary',
6059 '../ipc/ipc.gyp:ipc',
6160 '../ipc/ipc.gyp:window_info_protocol',
6261 '../protocol/protocol.gyp:commands_proto',
62 '../protocol/protocol.gyp:user_dictionary_storage_proto',
6363 'gen_base_files',
6464 ],
6565 'includes': [
594594 '../config/config.gyp:config_handler',
595595 '../config/config.gyp:config_protocol',
596596 '../data_manager/data_manager.gyp:user_pos_manager',
597 '../dictionary/dictionary_base.gyp:dictionary_protocol',
598597 '../dictionary/dictionary_base.gyp:user_dictionary',
599598 '../protocol/protocol.gyp:commands_proto',
599 '../protocol/protocol.gyp:user_dictionary_storage_proto',
600600 'gen_config_dialog_files',
601601 'gen_dictionary_tool_files',
602602 ],
649649 '../base/base.gyp:base',
650650 '../client/client.gyp:client',
651651 '../data_manager/data_manager.gyp:user_pos_manager',
652 '../dictionary/dictionary_base.gyp:dictionary_protocol',
653652 '../dictionary/dictionary_base.gyp:pos_matcher',
654653 '../dictionary/dictionary_base.gyp:user_dictionary',
655654 '../protocol/protocol.gyp:commands_proto',
655 '../protocol/protocol.gyp:user_dictionary_storage_proto',
656656 'gen_word_register_dialog_files',
657657 ],
658658 'includes': [
4848 #include "data_manager/user_pos_manager.h"
4949 #include "dictionary/user_dictionary_session.h"
5050 #include "dictionary/user_dictionary_storage.h"
51 #include "dictionary/user_dictionary_storage.pb.h"
5251 #include "dictionary/user_dictionary_util.h"
5352 #include "dictionary/user_pos.h"
53 #include "protocol/user_dictionary_storage.pb.h"
5454
5555 namespace mozc {
5656 namespace gui {
00 MAJOR=2
11 MINOR=17
2 BUILD=2101
2 BUILD=2102
33 REVISION=102
44 # NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
55 # downloaded by NaCl Mozc.
3535 syntax = "proto2";
3636
3737 import "config/config.proto";
38 import "dictionary/user_dictionary_storage.proto";
3938 import "protocol/candidates.proto";
39 import "protocol/user_dictionary_storage.proto";
4040
4141 package mozc.commands;
4242
7676 ],
7777 'dependencies': [
7878 '../config/config.gyp:genproto_config',
79 '../dictionary/dictionary_base.gyp:genproto_dictionary',
79 'genproto_user_dictionary_storage_proto',
8080 ],
8181 },
8282 {
8989 'dependencies': [
9090 '../config/config.gyp:config_protocol',
9191 '../protobuf/protobuf.gyp:protobuf',
92 '../dictionary/dictionary_base.gyp:dictionary_protocol',
9392 'candidates_proto',
9493 'genproto_commands_proto#host',
94 'user_dictionary_storage_proto',
9595 ],
9696 'export_dependent_settings': [
9797 'genproto_commands_proto#host',
127127 'genproto_renderer_proto#host',
128128 ],
129129 },
130 {
131 'target_name': 'genproto_user_dictionary_storage_proto',
132 'type': 'none',
133 'toolsets': ['host'],
134 'sources': [
135 'user_dictionary_storage.proto',
136 ],
137 'includes': [
138 '../protobuf/genproto.gypi',
139 ],
140 },
141 {
142 'target_name': 'user_dictionary_storage_proto',
143 'type': 'static_library',
144 'hard_dependency': 1,
145 'sources': [
146 '<(proto_out_dir)/<(relative_dir)/user_dictionary_storage.pb.cc',
147 ],
148 'dependencies': [
149 '../protobuf/protobuf.gyp:protobuf',
150 'genproto_user_dictionary_storage_proto#host',
151 ],
152 'export_dependent_settings': [
153 'genproto_user_dictionary_storage_proto#host',
154 ],
155 },
130156 ],
131157 }
0 // Copyright 2010-2015, Google Inc.
1 // All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
12 // distribution.
13 // * Neither the name of Google Inc. nor the names of its
14 // contributors may be used to endorse or promote products derived from
15 // this software without specific prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 syntax = "proto2";
30
31 package mozc.user_dictionary;
32
33 option java_outer_classname = "ProtoUserDictionaryStorage";
34 option java_package = "org.mozc.android.inputmethod.japanese.protobuf";
35
36 message UserDictionary {
37 enum PosType {
38 NOUN = 1; // "名詞"
39 ABBREVIATION = 2; // "短縮よみ"
40 SUGGESTION_ONLY = 3; // "サジェストのみ"
41 PROPER_NOUN = 4; // "固有名詞"
42 PERSONAL_NAME = 5; // "人名"
43 FAMILY_NAME = 6; // "姓"
44 FIRST_NAME = 7; // "名"
45 ORGANIZATION_NAME = 8; // "組織"
46 PLACE_NAME = 9; // "地名"
47 SA_IRREGULAR_CONJUGATION_NOUN = 10; // "名詞サ変"
48 ADJECTIVE_VERBAL_NOUN = 11; // "名詞形動"
49 NUMBER = 12; // "数"
50 ALPHABET = 13; // "アルファベット"
51 SYMBOL = 14; // "記号"
52 EMOTICON = 15; // "顔文字"
53
54 ADVERB = 16; // "副詞"
55 PRENOUN_ADJECTIVAL = 17; // "連体詞"
56 CONJUNCTION = 18; // "接続詞"
57 INTERJECTION = 19; // "感動詞"
58
59 PREFIX = 20; // "接頭語"
60 COUNTER_SUFFIX = 21; // "助数詞"
61 GENERIC_SUFFIX = 22; // "接尾一般"
62 PERSON_NAME_SUFFIX = 23; // "接尾人名"
63 PLACE_NAME_SUFFIX = 24; // "接尾地名"
64
65 WA_GROUP1_VERB = 25; // "動詞ワ行五段"
66 KA_GROUP1_VERB = 26; // "動詞カ行五段"
67 SA_GROUP1_VERB = 27; // "動詞サ行五段"
68 TA_GROUP1_VERB = 28; // "動詞タ行五段"
69 NA_GROUP1_VERB = 29; // "動詞ナ行五段"
70 MA_GROUP1_VERB = 30; // "動詞マ行五段"
71 RA_GROUP1_VERB = 31; // "動詞ラ行五段"
72 GA_GROUP1_VERB = 32; // "動詞ガ行五段"
73 BA_GROUP1_VERB = 33; // "動詞バ行五段"
74 HA_GROUP1_VERB = 34; // "動詞ハ行四段"
75 GROUP2_VERB = 35; // "動詞一段"
76 KURU_GROUP3_VERB = 36; // "動詞カ変"
77 SURU_GROUP3_VERB = 37; // "動詞サ変"
78 ZURU_GROUP3_VERB = 38; // "動詞ザ変"
79 RU_GROUP3_VERB = 39; // "動詞ラ変"
80
81 ADJECTIVE = 40; // "形容詞"
82 SENTENCE_ENDING_PARTICLE = 41; // "終助詞"
83 PUNCTUATION = 42; // "句読点"
84 FREE_STANDING_WORD = 43; // "独立語"
85
86 SUPPRESSION_WORD = 44; // "抑制単語"
87 };
88
89 // ID of this dictionary
90 optional uint64 id = 1 [ default = 0 ];
91
92 // set false if this dictionary is not used.
93 // Even if |enabled| is false, the dictionary
94 // it self is visible to user.
95 optional bool enabled = 2 [ default = true ];
96
97 // name of dictionary
98 optional string name = 3 [ default = "" ];
99
100 // entry of each word
101 message Entry {
102 optional string key = 1 [ default = "" ];
103 optional string value = 2 [ default = "" ];
104 // Do NOT use tag number '3' in this proto. Please see below.
105 optional string comment = 4 [ default = "" ];
106
107 // Historically we used to use tag number '3' for POS in string format.
108 // In order to switch it to enum based POS, we removed (deprecated) the
109 // tag number '3' field and created another field numbered '5'.
110 optional PosType pos = 5;
111
112 // set true if this entry is removed.
113 // This flag is used for cloud sync feature.
114 // Cloud sync feature is already deprecated and this flag is only
115 // used to convert sync dictionary to normal dictionary.
116 optional bool removed = 10 [ default = false ];
117
118 // set true if this entry is automatically registered
119 // by converter.
120 optional bool auto_registered = 11 [ default = false ];
121 };
122
123 repeated Entry entries = 4;
124
125 // set true if this dictionary is removed.
126 // This flag is used for cloud sync feature.
127 // Cloud sync feature is already deprecated and this flag is only
128 // used to convert sync dictionary to normal dictionary.
129 optional bool removed = 5 [ default = false ];
130
131 // This flag is used for cloud sync feature.
132 // Cloud sync feature is already deprecated and this flag is only
133 // used to convert sync dictionary to normal dictionary.
134 optional bool syncable = 6 [ default = false ];
135 };
136
137 message UserDictionaryStorage {
138 // version of user dictionary
139 optional int32 version = 1 [ default = 0 ];
140
141 // dictionary body
142 repeated UserDictionary dictionaries = 2;
143
144 enum StorageType {
145 SNAPSHOT = 1; // This storage is a snapshot.
146 UPDATE = 2; // This storage is a diff of some snapshots.
147 };
148
149 optional StorageType storage_type = 10 [ default = SNAPSHOT ];
150 };
151
152 message UserDictionaryCommand {
153 enum CommandType {
154 // Does nothing.
155 NO_OPERATION = 0;
156
157 // Unlink the user dictionary file if necessary.
158 // We can do this operation without creating a session.
159 // This operation is introduced as a last resort to clean up
160 // user dictionary, so it *forces* to unlink the file regardless
161 // of the current user dictionary session status.
162 CLEAR_STORAGE = 1;
163
164 // Creates a new session, and returns its id via
165 // UserDictionaryCommandStatus::session_id.
166 CREATE_SESSION = 2;
167
168 // Deletes the session identified by session_id.
169 DELETE_SESSION = 3;
170
171 // Sets the default dictionary name. It will be used when
172 // ensure_non_empty_storage is enabled and the operation supporting the
173 // flag is invoked.
174 SET_DEFAULT_DICTIONARY_NAME = 4;
175
176 // Checks if the session is currently undoable or not.
177 CHECK_UNDOABILITY = 5;
178
179 // Undoes the last operation.
180 UNDO = 6;
181
182 // Loads from local storage.
183 LOAD = 7;
184
185 // Saves to local storage.
186 SAVE = 8;
187
188 // Returns a list of name and dictionary-id pairs.
189 // They are filled in the form of UserDictionary without any entries
190 // in UserDictionaryCommandStatus::storage.
191 GET_USER_DICTIONARY_NAME_LIST = 9;
192
193 // Returns the number of entries in the dictionary with the
194 // given dictionary_id.
195 GET_ENTRY_SIZE = 10;
196
197 // Use GET_ENTRIES instead.
198 OBSOLETE_GET_ENTRY = 11;
199
200 // Returns if it is possible to add new dictionary or not.
201 // The result is returned by using status code.
202 CHECK_NEW_DICTIONARY_AVAILABILITY = 12;
203
204 // Creates a new dictionary with the dictionary_name.
205 CREATE_DICTIONARY = 13;
206
207 // Deletes the dictionary with the given dictionary_id.
208 DELETE_DICTIONARY = 14;
209
210 // Renames the dictionary with the given dictionary_id to dictionary_name.
211 RENAME_DICTIONARY = 15;
212
213 // Returns if it is possible to add new entry to the dictionary
214 // with the given dictionary_id or not.
215 CHECK_NEW_ENTRY_AVAILABILITY = 16;
216
217 // Adds an entry to the dictionary with the given dictionary_id.
218 // Added entry should be located at the end of the dictionary, and
219 // the data should be passed via entry field.
220 ADD_ENTRY = 17;
221
222 // Edits an entry in the dictionary with the given dictionary_id.
223 // The new data should be passed via entry.
224 // The edit target should be specified via entry_index(0).
225 EDIT_ENTRY = 18;
226
227 // Deletes entries in the dictionary with the given dictionary_id.
228 // The target entries should be specified based on index in entry_index.
229 DELETE_ENTRY = 19;
230
231 // Imports entries from the given data into a dictionary.
232 // There are two ways to specify the dictionary:
233 // 1) set dictionary_id for the dictionary
234 // 2) set dictionary_name to create a new dictionary with the name.
235 IMPORT_DATA = 20;
236
237 // Gets the entire UserDictionaryStorage data.
238 // Note: The result of this command could be too large for IPC, which has a
239 // size limitation of the response data.
240 GET_STORAGE = 21;
241
242 // Returns entries in the dictionary specified by dictionary_id.
243 // The position of the entry should be specified via entry_index().
244 GET_ENTRIES = 22;
245 };
246
247 required CommandType type = 1;
248 optional uint64 session_id = 2;
249 optional uint64 dictionary_id = 3;
250 optional string dictionary_name = 4;
251 repeated int32 entry_index = 5;
252 optional UserDictionary.Entry entry = 6;
253 optional string data = 7;
254 optional bool ensure_non_empty_storage = 8;
255 };
256
257 message UserDictionaryCommandStatus {
258 // Note: this status code is now temporary assgined.
259 // It may be updated (incl. re-numbering) to organize the code.
260 // I.e., the code shouldn't be saved in serialized format for now.
261 // TODO(hidehiko): Re-organize and re-number the enum values,
262 // after we check all necessary codes in.
263 enum Status {
264 // Note: SUCCEEDED is conflicting Windows MACRO.
265 USER_DICTIONARY_COMMAND_SUCCESS = 1;
266 UNKNOWN_ERROR = 2;
267
268 UNKNOWN_COMMAND = 3;
269 INVALID_ARGUMENT = 4;
270
271 UNKNOWN_SESSION_ID = 5;
272
273 FILE_NOT_FOUND = 6;
274 INVALID_FILE_FORMAT = 7;
275
276 // Note: currently if we recieve this error status,
277 // the file is actually saved.
278 FILE_SIZE_LIMIT_EXCEEDED = 8;
279 DICTIONARY_SIZE_LIMIT_EXCEEDED = 9;
280 ENTRY_SIZE_LIMIT_EXCEEDED = 10;
281
282 UNKNOWN_DICTIONARY_ID = 11;
283 ENTRY_INDEX_OUT_OF_RANGE = 12;
284
285 // Errors for dictionary names.
286 DICTIONARY_NAME_EMPTY = 13;
287 DICTIONARY_NAME_TOO_LONG = 14;
288 DICTIONARY_NAME_CONTAINS_INVALID_CHARACTER = 15;
289 DICTIONARY_NAME_DUPLICATED = 16;
290
291 // Errors for entry data.
292 READING_EMPTY = 17;
293 READING_TOO_LONG = 18;
294 READING_CONTAINS_INVALID_CHARACTER = 19;
295 WORD_EMPTY = 20;
296 WORD_TOO_LONG = 21;
297 WORD_CONTAINS_INVALID_CHARACTER = 22;
298 INVALID_POS_TYPE = 23;
299 COMMENT_TOO_LONG = 24;
300 COMMENT_CONTAINS_INVALID_CHARACTER = 25;
301
302 // Errors for importing.
303 IMPORT_TOO_MANY_WORDS = 26;
304 IMPORT_INVALID_ENTRIES = 27;
305
306 NO_UNDO_HISTORY = 28;
307 };
308
309 required Status status = 1;
310 optional uint64 session_id = 2;
311 optional UserDictionaryStorage storage = 3;
312 // Use entries field instead.
313 optional UserDictionary.Entry OBSOLETE_entry = 4;
314 optional uint64 dictionary_id = 5;
315 optional uint32 entry_size = 6;
316 repeated UserDictionary.Entry entries = 7;
317 };
8282 ],
8383 'dependencies': [
8484 '../client/client.gyp:client',
85 '../engine/engine.gyp:engine_factory',
8685 '../composer/composer.gyp:composer',
8786 '../config/config.gyp:config_handler',
8887 '../config/config.gyp:config_protocol',
89 '../dictionary/dictionary_base.gyp:dictionary_protocol',
9088 '../dictionary/dictionary_base.gyp:user_dictionary',
89 '../engine/engine.gyp:engine_factory',
90 '../protocol/protocol.gyp:commands_proto',
91 '../protocol/protocol.gyp:user_dictionary_storage_proto',
9192 '../usage_stats/usage_stats_base.gyp:usage_stats',
9293 'session_base.gyp:generic_storage_manager',
93 '../protocol/protocol.gyp:commands_proto',
9494 ],
9595 'conditions': [
9696 ['(target_platform=="NaCl" and _toolset=="target") or target_platform=="Android"', {
4646 #include "config/config.pb.h"
4747 #include "config/config_handler.h"
4848 #include "dictionary/user_dictionary_session_handler.h"
49 #include "dictionary/user_dictionary_storage.pb.h"
5049 #include "engine/engine_interface.h"
5150 #include "engine/user_data_manager_interface.h"
5251 #include "protocol/commands.pb.h"
52 #include "protocol/user_dictionary_storage.pb.h"
5353 #include "session/generic_storage_manager.h"
5454 #include "session/session.h"
5555 #include "session/session_observer_handler.h"