hunspell: Cleanup to fix the header include guards under google/ directory.
[chromium-blink-merge.git] / third_party / hunspell / google / bdict_writer.h
blob8f5085fb7a577633dc588c6147fea85b7ee488aa
1 // Copyright (c) 2011 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 THIRD_PARTY_HUNSPELL_GOOGLE_BDICT_WRITER_H_
6 #define THIRD_PARTY_HUNSPELL_GOOGLE_BDICT_WRITER_H_
8 #include <string>
9 #include <vector>
11 #include "base/macros.h"
13 namespace hunspell {
15 class DicNode;
17 // Class for creating a binary dictionary file from data read from Hunspell
18 // spellchecker files.
19 class BDictWriter {
20 public:
21 typedef std::vector< std::pair<std::string, std::vector<int> > > WordList;
23 BDictWriter();
24 ~BDictWriter();
26 // Affix setters.
27 void SetComment(const std::string& comment) {
28 comment_ = comment;
30 void SetAffixRules(const std::vector<std::string>& rules) {
31 affix_rules_ = rules;
33 void SetAffixGroups(const std::vector<std::string>& groups) {
34 affix_groups_ = groups;
36 void SetReplacements(
37 const std::vector< std::pair<std::string, std::string> >& replacements) {
38 replacements_ = replacements;
40 void SetOtherCommands(const std::vector<std::string>& commands) {
41 other_commands_ = commands;
44 // The words must be sorted already.
45 void SetWords(const WordList& words);
47 // Returns the serialized data for the entire file. You must call all the
48 // setters above before this.
49 std::string GetBDict() const;
51 private:
52 // Converts the affix members to a string.
53 void SerializeAff(std::string* output) const;
55 // Affix members.
56 std::string comment_;
57 std::vector<std::string> affix_rules_;
58 std::vector<std::string> affix_groups_;
59 std::vector< std::pair<std::string, std::string> > replacements_;
60 std::vector<std::string> other_commands_;
62 // Root of the generated trie. Filled by SetWords.
63 DicNode* trie_root_;
65 DISALLOW_COPY_AND_ASSIGN(BDictWriter);
68 } // namespace hunspell
70 #endif // THIRD_PARTY_HUNSPELL_GOOGLE_BDICT_WRITER_H_