OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__ | 5 #ifndef CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__ |
6 #define CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__ | 6 #define CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__ |
7 | 7 |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
| 13 namespace base { |
13 class FilePath; | 14 class FilePath; |
| 15 } |
14 | 16 |
15 namespace convert_dict { | 17 namespace convert_dict { |
16 | 18 |
17 class AffReader; | 19 class AffReader; |
18 | 20 |
19 // Reads Hunspell .dic files. | 21 // Reads Hunspell .dic files. |
20 class DicReader { | 22 class DicReader { |
21 public: | 23 public: |
22 // Associated with each word is a list of affix group IDs. This will typically | 24 // Associated with each word is a list of affix group IDs. This will typically |
23 // be only one long, but may be more if there are multiple groups of | 25 // be only one long, but may be more if there are multiple groups of |
24 // independent affix rules for a base word. | 26 // independent affix rules for a base word. |
25 typedef std::pair<std::string, std::vector<int> > WordEntry; | 27 typedef std::pair<std::string, std::vector<int> > WordEntry; |
26 typedef std::vector<WordEntry> WordList; | 28 typedef std::vector<WordEntry> WordList; |
27 | 29 |
28 explicit DicReader(const FilePath& path); | 30 explicit DicReader(const base::FilePath& path); |
29 ~DicReader(); | 31 ~DicReader(); |
30 | 32 |
31 // Non-numeric affixes will be added to the given AffReader and converted into | 33 // Non-numeric affixes will be added to the given AffReader and converted into |
32 // indices. | 34 // indices. |
33 bool Read(AffReader* aff_reader); | 35 bool Read(AffReader* aff_reader); |
34 | 36 |
35 // Returns the words read by Read(). These will be in order. | 37 // Returns the words read by Read(). These will be in order. |
36 const WordList& words() const { return words_; } | 38 const WordList& words() const { return words_; } |
37 | 39 |
38 private: | 40 private: |
39 FILE* file_; | 41 FILE* file_; |
40 FILE* additional_words_file_; | 42 FILE* additional_words_file_; |
41 | 43 |
42 // Contains all words and their corresponding affix index. | 44 // Contains all words and their corresponding affix index. |
43 WordList words_; | 45 WordList words_; |
44 }; | 46 }; |
45 | 47 |
46 } // namespace convert_dict | 48 } // namespace convert_dict |
47 | 49 |
48 #endif // CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__ | 50 #endif // CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__ |
OLD | NEW |