Put classes under dictionary/file to mozc::dictionary namespace.
This is just a code cleanup. Hence no behavior change should occur.
BUG=none
TEST=unittest
diff --git a/src/converter/converter_test.cc b/src/converter/converter_test.cc
index d3178cf..b9feb80 100644
--- a/src/converter/converter_test.cc
+++ b/src/converter/converter_test.cc
@@ -81,6 +81,7 @@
DECLARE_string(test_tmpdir);
using mozc::dictionary::DictionaryImpl;
+using mozc::dictionary::DictionaryMock;
using mozc::dictionary::SuffixDictionary;
using mozc::dictionary::SuffixToken;
using mozc::dictionary::SuppressionDictionary;
diff --git a/src/dictionary/dictionary_mock.cc b/src/dictionary/dictionary_mock.cc
index 020eb7a..e007a09 100644
--- a/src/dictionary/dictionary_mock.cc
+++ b/src/dictionary/dictionary_mock.cc
@@ -41,6 +41,7 @@
#include "dictionary/dictionary_token.h"
namespace mozc {
+namespace dictionary {
namespace {
const int kDummyPosId = 1;
@@ -258,4 +259,5 @@
CreateToken(str, key, value, attributes));
}
+} // namespace dictionary
} // namespace mozc
diff --git a/src/dictionary/dictionary_mock.h b/src/dictionary/dictionary_mock.h
index 5899eae..ecd1bb6 100644
--- a/src/dictionary/dictionary_mock.h
+++ b/src/dictionary/dictionary_mock.h
@@ -62,6 +62,7 @@
#include "dictionary/dictionary_token.h"
namespace mozc {
+namespace dictionary {
class DictionaryMock : public DictionaryInterface {
public:
@@ -127,6 +128,8 @@
DISALLOW_COPY_AND_ASSIGN(DictionaryMock);
};
+
+} // namespace dictionary
} // namespace mozc
#endif // MOZC_DICTIONARY_DICTIONARY_MOCK_H_
diff --git a/src/dictionary/dictionary_mock_test.cc b/src/dictionary/dictionary_mock_test.cc
index ba254fa..a2216a6 100644
--- a/src/dictionary/dictionary_mock_test.cc
+++ b/src/dictionary/dictionary_mock_test.cc
@@ -40,9 +40,9 @@
#include "testing/base/public/googletest.h"
#include "testing/base/public/gunit.h"
-using mozc::dictionary::CollectTokenCallback;
-
namespace mozc {
+namespace dictionary {
+namespace {
class DictionaryMockTest : public ::testing::Test {
protected:
@@ -236,4 +236,6 @@
EXPECT_TRUE(callback.tokens().empty());
}
+} // namespace
+} // namespace dictionary
} // namespace mozc
diff --git a/src/dictionary/file/codec.cc b/src/dictionary/file/codec.cc
index 0e6418f..5e20359 100644
--- a/src/dictionary/file/codec.cc
+++ b/src/dictionary/file/codec.cc
@@ -42,6 +42,7 @@
namespace mozc {
+namespace dictionary {
namespace {
void WriteInt(int value, ostream *ofs) {
@@ -142,13 +143,13 @@
}
namespace {
-DictionaryFileCodecInterface *g_dictionary_file_codec = NULL;
+DictionaryFileCodecInterface *g_dictionary_file_codec = nullptr;
} // namespace
typedef DictionaryFileCodec DefaultCodec;
DictionaryFileCodecInterface *DictionaryFileCodecFactory::GetCodec() {
- if (g_dictionary_file_codec == NULL) {
+ if (g_dictionary_file_codec == nullptr) {
return Singleton<DefaultCodec>::get();
} else {
return g_dictionary_file_codec;
@@ -159,4 +160,5 @@
g_dictionary_file_codec = codec;
}
+} // namespace dictionary
} // namespace mozc
diff --git a/src/dictionary/file/codec.h b/src/dictionary/file/codec.h
index 5f5ea27..e54dee6 100644
--- a/src/dictionary/file/codec.h
+++ b/src/dictionary/file/codec.h
@@ -41,6 +41,7 @@
#include "dictionary/file/section.h"
namespace mozc {
+namespace dictionary {
class DictionaryFileCodec : public DictionaryFileCodecInterface {
@@ -66,6 +67,7 @@
DISALLOW_COPY_AND_ASSIGN(DictionaryFileCodec);
};
+} // namespace dictionary
} // namespace mozc
#endif // MOZC_DICTIONARY_FILE_CODEC_H_
diff --git a/src/dictionary/file/codec_interface.h b/src/dictionary/file/codec_interface.h
index 5ce5f51..d4a09ca 100644
--- a/src/dictionary/file/codec_interface.h
+++ b/src/dictionary/file/codec_interface.h
@@ -37,18 +37,19 @@
#include "dictionary/file/section.h"
namespace mozc {
+namespace dictionary {
class DictionaryFileCodecInterface {
public:
- // Write sections to output file stream
+ // Writes sections to an output file stream.
virtual void WriteSections(const vector<DictionaryFileSection> §ions,
ostream *ofs) const = 0;
- // Read sections from memory image
+ // Reads sections from memory image.
virtual bool ReadSections(const char *image, int length,
vector<DictionaryFileSection> *sections) const = 0;
- // Get section name
+ // Gets section name.
virtual string GetSectionName(const string &name) const = 0;
protected:
@@ -61,16 +62,17 @@
class DictionaryFileCodecFactory {
public:
- // return singleton object
+ // Returns the singleton instance.
static DictionaryFileCodecInterface *GetCodec();
- // dependency injectin for unittesting
+ // For dependency injectin in unit tests.
static void SetCodec(DictionaryFileCodecInterface *codec);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(DictionaryFileCodecFactory);
};
+} // namespace dictionary
} // namespace mozc
#endif // MOZC_DICTIONARY_FILE_CODEC_INTERFACE_H_
diff --git a/src/dictionary/file/codec_test.cc b/src/dictionary/file/codec_test.cc
index 59b0445..996af6a 100644
--- a/src/dictionary/file/codec_test.cc
+++ b/src/dictionary/file/codec_test.cc
@@ -42,6 +42,7 @@
DECLARE_string(test_tmpdir);
namespace mozc {
+namespace dictionary {
namespace {
class CodecTest : public ::testing::Test {
@@ -222,4 +223,5 @@
} // namespace
+} // namespace dictionary
} // namespace mozc
diff --git a/src/dictionary/file/dictionary_file.cc b/src/dictionary/file/dictionary_file.cc
index 50a7ab8..2501d66 100644
--- a/src/dictionary/file/dictionary_file.cc
+++ b/src/dictionary/file/dictionary_file.cc
@@ -38,6 +38,7 @@
#include "dictionary/file/section.h"
namespace mozc {
+namespace dictionary {
DictionaryFile::DictionaryFile() {}
@@ -68,6 +69,8 @@
return sections_[i].ptr;
}
}
- return NULL;
+ return nullptr;
}
+
+} // namespace dictionary
} // namespace mozc
diff --git a/src/dictionary/file/dictionary_file.h b/src/dictionary/file/dictionary_file.h
index 63ddac1..4e5c7e7 100644
--- a/src/dictionary/file/dictionary_file.h
+++ b/src/dictionary/file/dictionary_file.h
@@ -36,11 +36,13 @@
#include <string>
#include <vector>
+#include "base/mmap.h"
#include "base/port.h"
#include "base/scoped_ptr.h"
namespace mozc {
-class Mmap;
+namespace dictionary {
+
struct DictionaryFileSection;
class DictionaryFile {
@@ -60,13 +62,14 @@
const char *GetSection(const string §ion_name, int *len) const;
private:
- // This will be NULL if the mapping source is given as a pointer.
+ // This will be nullptr if the mapping source is given as a pointer.
scoped_ptr<Mmap> mapping_;
-
vector<DictionaryFileSection> sections_;
DISALLOW_COPY_AND_ASSIGN(DictionaryFile);
};
-}
+
+} // namespace dictionary
+} // namespace mozc
#endif // MOZC_DICTIONARY_FILE_DICTIONARY_FILE_H_
diff --git a/src/dictionary/file/dictionary_file_builder.cc b/src/dictionary/file/dictionary_file_builder.cc
index 2777465..a8f2681 100644
--- a/src/dictionary/file/dictionary_file_builder.cc
+++ b/src/dictionary/file/dictionary_file_builder.cc
@@ -38,6 +38,7 @@
#include "dictionary/file/section.h"
namespace mozc {
+namespace dictionary {
DictionaryFileBuilder::DictionaryFileBuilder() {}
@@ -62,16 +63,15 @@
ifs.seekg(0, ios::end);
const int len = ifs.tellg();
- // reads the file
+ // Reads the file
ifs.seekg(0, ios::beg);
char *ptr = new char[len];
ifs.read(ptr, len);
sections_.push_back(DictionaryFileSection(ptr, len, ""));
- const string name =
+ sections_.back().name =
DictionaryFileCodecFactory::GetCodec()->GetSectionName(section_name);
- sections_.back().name = name;
return true;
}
@@ -82,4 +82,6 @@
DictionaryFileCodecFactory::GetCodec()->WriteSections(sections_, &ofs);
LOG(INFO) << "Generated";
}
+
+} // namespace dictionary
} // namespace mozc
diff --git a/src/dictionary/file/dictionary_file_builder.h b/src/dictionary/file/dictionary_file_builder.h
index 3b33ad8..508b406 100644
--- a/src/dictionary/file/dictionary_file_builder.h
+++ b/src/dictionary/file/dictionary_file_builder.h
@@ -38,17 +38,17 @@
#include "dictionary/file/section.h"
namespace mozc {
+namespace dictionary {
+
class DictionaryFileBuilder {
public:
DictionaryFileBuilder();
-
virtual ~DictionaryFileBuilder();
- // Add section from file
- bool AddSectionFromFile(const string §ion_name,
- const string &file_name);
+ // Adds a section from a file
+ bool AddSectionFromFile(const string §ion_name, const string &file_name);
- // Write image of dictionary file to file
+ // Writes the image of dictionary file to a file.
void WriteImageToFile(const string &file_name) const;
private:
@@ -57,6 +57,8 @@
DISALLOW_COPY_AND_ASSIGN(DictionaryFileBuilder);
};
+
+} // namespace dictionary
} // namespace mozc
#endif // MOZC_DICTIONARY_FILE_DICTIONARY_FILE_BUILDER_H_
diff --git a/src/dictionary/file/dictionary_file_test.cc b/src/dictionary/file/dictionary_file_test.cc
index 09f6c74..2ff7730 100644
--- a/src/dictionary/file/dictionary_file_test.cc
+++ b/src/dictionary/file/dictionary_file_test.cc
@@ -30,6 +30,7 @@
#include "dictionary/file/dictionary_file.h"
#include <cstdio>
+#include <string>
#include "base/file_util.h"
#include "base/flags.h"
@@ -41,6 +42,7 @@
DECLARE_string(test_tmpdir);
namespace mozc {
+namespace dictionary {
namespace {
TEST(DictionaryFileTest, Basic) {
@@ -89,4 +91,5 @@
}
} // namespace
+} // namespace dictionary
} // namespace mozc
diff --git a/src/dictionary/file/section.h b/src/dictionary/file/section.h
index d472bc3..bc562aa 100644
--- a/src/dictionary/file/section.h
+++ b/src/dictionary/file/section.h
@@ -30,18 +30,22 @@
#ifndef MOZC_DICTIONARY_FILE_SECTION_H_
#define MOZC_DICTIONARY_FILE_SECTION_H_
+#include <cstddef>
#include <string>
namespace mozc {
+namespace dictionary {
+
struct DictionaryFileSection {
+ DictionaryFileSection(const char *ptr, size_t len, const string &name)
+ : ptr(ptr), len(len), name(name) {}
+
const char *ptr;
size_t len;
string name;
-
- DictionaryFileSection(const char *ptr, size_t len, const string &name)
- : ptr(ptr), len(len), name(name) {
- }
};
+
+} // namespace dictionary
} // namespace mozc
#endif // MOZC_DICTIONARY_FILE_SECTION_H_
diff --git a/src/dictionary/system/system_dictionary.h b/src/dictionary/system/system_dictionary.h
index 29bf908..5de8d51 100644
--- a/src/dictionary/system/system_dictionary.h
+++ b/src/dictionary/system/system_dictionary.h
@@ -45,11 +45,9 @@
#include "storage/louds/louds_trie.h"
namespace mozc {
-
-class DictionaryFile;
-
namespace dictionary {
+class DictionaryFile;
class SystemDictionaryCodecInterface;
class SystemDictionary : public DictionaryInterface {
diff --git a/src/dictionary/system/value_dictionary.h b/src/dictionary/system/value_dictionary.h
index 1783351..d05fffc 100644
--- a/src/dictionary/system/value_dictionary.h
+++ b/src/dictionary/system/value_dictionary.h
@@ -42,22 +42,19 @@
#include "dictionary/dictionary_interface.h"
namespace mozc {
-
-namespace dictionary {
-class SystemDictionaryCodecInterface;
-} // namespace dictionary
-
namespace storage {
namespace louds {
class LoudsTrie;
} // namespace louds
} // namespace storage
-class DictionaryFile;
class POSMatcher;
namespace dictionary {
+class DictionaryFile;
+class SystemDictionaryCodecInterface;
+
class ValueDictionary : public DictionaryInterface {
public:
virtual ~ValueDictionary();
diff --git a/src/mozc_version_template.txt b/src/mozc_version_template.txt
index e3e2748..dbd0dad 100644
--- a/src/mozc_version_template.txt
+++ b/src/mozc_version_template.txt
@@ -1,6 +1,6 @@
MAJOR=2
MINOR=17
-BUILD=2086
+BUILD=2087
REVISION=102
# NACL_DICTIONARY_VERSION is the target version of the system dictionary to be
# downloaded by NaCl Mozc.
diff --git a/src/prediction/dictionary_predictor_test.cc b/src/prediction/dictionary_predictor_test.cc
index fbc3e0c..c8c9e8a 100644
--- a/src/prediction/dictionary_predictor_test.cc
+++ b/src/prediction/dictionary_predictor_test.cc
@@ -74,6 +74,7 @@
#include "transliteration/transliteration.h"
using ::testing::_;
+using mozc::dictionary::DictionaryMock;
using mozc::dictionary::SuffixDictionary;
using mozc::dictionary::SuffixToken;
using mozc::dictionary::SuppressionDictionary;
diff --git a/src/prediction/predictor_test.cc b/src/prediction/predictor_test.cc
index 4276b3b..9f8ee6c 100644
--- a/src/prediction/predictor_test.cc
+++ b/src/prediction/predictor_test.cc
@@ -56,6 +56,7 @@
using ::testing::AtMost;
using ::testing::Return;
using ::testing::_;
+using mozc::dictionary::DictionaryMock;
using mozc::dictionary::SuppressionDictionary;
namespace mozc {
diff --git a/src/prediction/user_history_predictor_test.cc b/src/prediction/user_history_predictor_test.cc
index b955cd3..a9f8312 100644
--- a/src/prediction/user_history_predictor_test.cc
+++ b/src/prediction/user_history_predictor_test.cc
@@ -57,6 +57,7 @@
DECLARE_bool(enable_expansion_for_user_history_predictor);
using mozc::commands::Request;
+using mozc::dictionary::DictionaryMock;
using mozc::dictionary::SuppressionDictionary;
namespace mozc {
diff --git a/src/rewriter/language_aware_rewriter_test.cc b/src/rewriter/language_aware_rewriter_test.cc
index c0892b5..7ecb0fa 100644
--- a/src/rewriter/language_aware_rewriter_test.cc
+++ b/src/rewriter/language_aware_rewriter_test.cc
@@ -55,9 +55,11 @@
DECLARE_string(test_tmpdir);
-namespace mozc {
+using mozc::dictionary::DictionaryMock;
+namespace mozc {
namespace {
+
void InsertASCIISequence(const string &text, composer::Composer *composer) {
for (size_t i = 0; i < text.size(); ++i) {
commands::KeyEvent key;
@@ -65,6 +67,7 @@
composer->InsertCharacterKeyEvent(key);
}
}
+
} // namespace
class LanguageAwareRewriterTest : public testing::Test {