blob: dcfeba4509a3947a8f67f65fb6f1c5eb5762a6c9 [file] [log] [blame]
Jean Chalardcf9dbbd2011-12-26 15:16:59 +09001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef LATINIME_TERMINAL_ATTRIBUTES_H
18#define LATINIME_TERMINAL_ATTRIBUTES_H
19
20#include "unigram_dictionary.h"
21
22namespace latinime {
23
24/**
25 * This class encapsulates information about a terminal that allows to
26 * retrieve local node attributes like the list of shortcuts without
27 * exposing the format structure to the client.
28 */
29class TerminalAttributes {
30 public:
31 class ShortcutIterator {
32 const uint8_t* const mDict;
33 int mPos;
34
35 public:
36 ShortcutIterator(const uint8_t* const dict, const int pos) : mDict(dict), mPos(pos) {
37 }
38
39 inline bool hasNextShortcutTarget() const {
40 // TODO: stub method. Fill this in.
41 return false;
42 }
43
44 inline int getNextShortcutTarget(const int maxDepth, uint16_t* outWord) {
45 // TODO: stub method. Fill this in.
46 return 0;
47 }
48 };
49
50 private:
51 const uint8_t* const mDict;
52 const uint8_t mFlags;
53 const int mStartPos;
54
55 public:
56 TerminalAttributes(const uint8_t* const dict, const uint8_t flags, const int pos) :
57 mDict(dict), mFlags(flags), mStartPos(pos) {
58 }
59
60 inline bool isShortcutOnly() const {
61 // TODO: stub method. Fill this in.
62 return false;
63 }
64
65 inline ShortcutIterator getShortcutIterator() const {
66 return ShortcutIterator(mDict, mStartPos);
67 }
68};
69} // namespace latinime
70
71#endif // LATINIME_TERMINAL_ATTRIBUTES_H