Add ICU message format support
[chromium-blink-merge.git] / chrome / tools / convert_dict / dic_reader.h
blob74ceafd06edc1c8bed61ef1c3217675e17b4bff1
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
3 // found in the LICENSE file.
5 #ifndef CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__
6 #define CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__
8 #include <stdio.h>
10 #include <string>
11 #include <vector>
13 namespace base {
14 class FilePath;
17 namespace convert_dict {
19 class AffReader;
21 // Reads Hunspell .dic files.
22 class DicReader {
23 public:
24 // Associated with each word is a list of affix group IDs. This will typically
25 // be only one long, but may be more if there are multiple groups of
26 // independent affix rules for a base word.
27 typedef std::pair<std::string, std::vector<int> > WordEntry;
28 typedef std::vector<WordEntry> WordList;
30 explicit DicReader(const base::FilePath& path);
31 ~DicReader();
33 // Non-numeric affixes will be added to the given AffReader and converted into
34 // indices.
35 bool Read(AffReader* aff_reader);
37 // Returns the words read by Read(). These will be in order.
38 const WordList& words() const { return words_; }
40 private:
41 FILE* file_;
42 FILE* additional_words_file_;
44 // Contains all words and their corresponding affix index.
45 WordList words_;
48 } // namespace convert_dict
50 #endif // CHROME_TOOLS_CONVERT_DICT_DIC_READER_H__