2011-08-10 06:44:08 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2011 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_CORRECTION_STATE_H
|
|
|
|
#define LATINIME_CORRECTION_STATE_H
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#include "defines.h"
|
|
|
|
|
|
|
|
namespace latinime {
|
|
|
|
|
2011-08-10 13:19:33 +00:00
|
|
|
struct CorrectionState {
|
2011-08-10 06:44:08 +00:00
|
|
|
int mParentIndex;
|
|
|
|
int mSiblingPos;
|
2011-08-10 13:19:33 +00:00
|
|
|
uint16_t mChildCount;
|
|
|
|
uint8_t mInputIndex;
|
2011-08-17 08:55:16 +00:00
|
|
|
|
2011-10-05 05:55:07 +00:00
|
|
|
uint8_t mEquivalentCharCount;
|
2011-08-11 12:25:39 +00:00
|
|
|
uint8_t mProximityCount;
|
2011-08-17 08:55:16 +00:00
|
|
|
uint8_t mTransposedCount;
|
|
|
|
uint8_t mExcessiveCount;
|
2011-08-10 13:19:33 +00:00
|
|
|
uint8_t mSkippedCount;
|
2011-08-17 08:55:16 +00:00
|
|
|
|
|
|
|
int8_t mTransposedPos;
|
|
|
|
int8_t mExcessivePos;
|
2011-08-11 07:27:28 +00:00
|
|
|
int8_t mSkipPos; // should be signed
|
2011-08-17 08:55:16 +00:00
|
|
|
|
|
|
|
// TODO: int?
|
|
|
|
bool mLastCharExceeded;
|
|
|
|
|
2011-08-10 13:19:33 +00:00
|
|
|
bool mMatching;
|
2011-08-17 08:55:16 +00:00
|
|
|
bool mTransposing;
|
|
|
|
bool mExceeding;
|
2011-08-10 13:19:33 +00:00
|
|
|
bool mSkipping;
|
2011-08-11 16:05:27 +00:00
|
|
|
bool mProximityMatching;
|
2012-02-02 09:49:22 +00:00
|
|
|
bool mAdditionalProximityMatching;
|
2011-08-17 08:55:16 +00:00
|
|
|
|
2011-08-10 13:19:33 +00:00
|
|
|
bool mNeedsToTraverseAllNodes;
|
2011-08-10 06:44:08 +00:00
|
|
|
};
|
2011-08-10 13:19:33 +00:00
|
|
|
|
|
|
|
inline static void initCorrectionState(CorrectionState *state, const int rootPos,
|
|
|
|
const uint16_t childCount, const bool traverseAll) {
|
|
|
|
state->mParentIndex = -1;
|
|
|
|
state->mChildCount = childCount;
|
|
|
|
state->mInputIndex = 0;
|
|
|
|
state->mSiblingPos = rootPos;
|
2011-08-17 08:55:16 +00:00
|
|
|
state->mNeedsToTraverseAllNodes = traverseAll;
|
|
|
|
|
|
|
|
state->mTransposedPos = -1;
|
|
|
|
state->mExcessivePos = -1;
|
|
|
|
state->mSkipPos = -1;
|
|
|
|
|
2011-10-05 05:55:07 +00:00
|
|
|
state->mEquivalentCharCount = 0;
|
2011-08-17 08:55:16 +00:00
|
|
|
state->mProximityCount = 0;
|
|
|
|
state->mTransposedCount = 0;
|
|
|
|
state->mExcessiveCount = 0;
|
2011-08-10 13:19:33 +00:00
|
|
|
state->mSkippedCount = 0;
|
2011-08-17 08:55:16 +00:00
|
|
|
|
|
|
|
state->mLastCharExceeded = false;
|
|
|
|
|
2011-08-10 13:19:33 +00:00
|
|
|
state->mMatching = false;
|
2011-08-11 16:05:27 +00:00
|
|
|
state->mProximityMatching = false;
|
2011-08-17 08:55:16 +00:00
|
|
|
state->mTransposing = false;
|
|
|
|
state->mExceeding = false;
|
|
|
|
state->mSkipping = false;
|
2012-02-02 09:49:22 +00:00
|
|
|
state->mAdditionalProximityMatching = false;
|
2011-08-10 13:19:33 +00:00
|
|
|
}
|
|
|
|
|
2011-08-10 06:44:08 +00:00
|
|
|
} // namespace latinime
|
|
|
|
#endif // LATINIME_CORRECTION_STATE_H
|