Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
9e3082e0
Commit
9e3082e0
authored
11 years ago
by
Keisuke Kuroyanagi
Browse files
Options
Downloads
Patches
Plain Diff
Add DynamicShortcutListPolicy::copyAllShortcuts().
Bug: 6669677 Change-Id: I74959fe3ca59d77ba0279c75f4d72db13735322f
parent
eaee1561
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
native/jni/src/suggest/policyimpl/dictionary/shortcut/dynamic_shortcut_list_policy.h
+25
-2
25 additions, 2 deletions
...cyimpl/dictionary/shortcut/dynamic_shortcut_list_policy.h
with
25 additions
and
2 deletions
native/jni/src/suggest/policyimpl/dictionary/shortcut/dynamic_shortcut_list_policy.h
+
25
−
2
View file @
9e3082e0
...
...
@@ -31,7 +31,7 @@ namespace latinime {
*/
class
DynamicShortcutListPolicy
:
public
DictionaryShortcutsStructurePolicy
{
public:
explicit
DynamicShortcutListPolicy
(
const
BufferWithExtendableBuffer
*
const
buffer
)
explicit
DynamicShortcutListPolicy
(
BufferWithExtendableBuffer
*
const
buffer
)
:
mBuffer
(
buffer
)
{}
~
DynamicShortcutListPolicy
()
{}
...
...
@@ -82,10 +82,33 @@ class DynamicShortcutListPolicy : public DictionaryShortcutsStructurePolicy {
}
}
// Copy shortcuts from the shortcut list that starts at fromPos to toPos and advance these
// positions after the shortcut lists.
void
copyAllShortcuts
(
int
*
const
fromPos
,
int
*
const
toPos
)
{
const
bool
usesAdditionalBuffer
=
mBuffer
->
isInAdditionalBuffer
(
*
fromPos
);
const
uint8_t
*
const
buffer
=
mBuffer
->
getBuffer
(
usesAdditionalBuffer
);
if
(
usesAdditionalBuffer
)
{
*
fromPos
-=
mBuffer
->
getOriginalBufferSize
();
}
const
int
shortcutListSize
=
ShortcutListReadingUtils
::
getShortcutListSizeAndForwardPointer
(
buffer
,
fromPos
);
// Copy shortcut list size.
mBuffer
->
writeUintAndAdvancePosition
(
shortcutListSize
+
ShortcutListReadingUtils
::
getShortcutListSizeFieldSize
(),
ShortcutListReadingUtils
::
getShortcutListSizeFieldSize
(),
toPos
);
for
(
int
i
=
0
;
i
<
shortcutListSize
;
++
i
)
{
const
uint8_t
data
=
ByteArrayUtils
::
readUint8AndAdvancePosition
(
buffer
,
fromPos
);
mBuffer
->
writeUintAndAdvancePosition
(
data
,
1
/* size */
,
toPos
);
}
if
(
usesAdditionalBuffer
)
{
*
fromPos
+=
mBuffer
->
getOriginalBufferSize
();
}
}
private
:
DISALLOW_IMPLICIT_CONSTRUCTORS
(
DynamicShortcutListPolicy
);
const
BufferWithExtendableBuffer
*
const
mBuffer
;
BufferWithExtendableBuffer
*
const
mBuffer
;
};
}
// namespace latinime
#endif // LATINIME_DYNAMIC_SHORTCUT_LIST_POLICY_H
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment