Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1535)

Unified Diff: third_party/prediction/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h

Issue 1247903003: Add spellcheck and word suggestion to the prediction service (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/prediction/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h
diff --git a/third_party/prediction/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h b/third_party/prediction/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h
new file mode 100644
index 0000000000000000000000000000000000000000..d5160e5e6bbe40ecb9f2c57ddbacc239df6688a4
--- /dev/null
+++ b/third_party/prediction/suggest/policyimpl/dictionary/utils/dict_file_writing_utils.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (C) 2013, The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef LATINIME_DICT_FILE_WRITING_UTILS_H
+#define LATINIME_DICT_FILE_WRITING_UTILS_H
+
+#include <cstdio>
+
+#include "third_party/prediction/defines.h"
+#include "third_party/prediction/suggest/policyimpl/dictionary/header/header_read_write_utils.h"
+#include "third_party/prediction/suggest/policyimpl/dictionary/utils/format_utils.h"
+
+namespace latinime {
+
+class BufferWithExtendableBuffer;
+
+class DictFileWritingUtils {
+ public:
+ static const char* const TEMP_FILE_SUFFIX_FOR_WRITING_DICT_FILE;
+
+ static bool createEmptyDictFile(
+ const char* const filePath,
+ const int dictVersion,
+ const std::vector<int> localeAsCodePointVector,
+ const DictionaryHeaderStructurePolicy::AttributeMap* const attributeMap);
+
+ static bool flushBufferToFileWithSuffix(
+ const char* const basePath,
+ const char* const suffix,
+ const BufferWithExtendableBuffer* const buffer);
+
+ static bool writeBufferToFileTail(
+ FILE* const file,
+ const BufferWithExtendableBuffer* const buffer);
+
+ private:
+ DISALLOW_IMPLICIT_CONSTRUCTORS(DictFileWritingUtils);
+
+ static const int SIZE_OF_BUFFER_SIZE_FIELD;
+
+ static bool createEmptyV401DictFile(
+ const char* const filePath,
+ const std::vector<int> localeAsCodePointVector,
+ const DictionaryHeaderStructurePolicy::AttributeMap* const attributeMap,
+ const FormatUtils::FORMAT_VERSION formatVersion);
+
+ template <class DictConstants, class DictBuffers, class DictBuffersPtr>
+ static bool createEmptyV4DictFile(
+ const char* const filePath,
+ const std::vector<int> localeAsCodePointVector,
+ const DictionaryHeaderStructurePolicy::AttributeMap* const attributeMap,
+ const FormatUtils::FORMAT_VERSION formatVersion);
+
+ static bool flushBufferToFile(const char* const filePath,
+ const BufferWithExtendableBuffer* const buffer);
+
+ static bool writeBufferToFile(FILE* const file,
+ const BufferWithExtendableBuffer* const buffer);
+};
+} // namespace latinime
+#endif /* LATINIME_DICT_FILE_WRITING_UTILS_H */

Powered by Google App Engine
This is Rietveld 408576698