mirror of
https://gitee.com/openharmony/inputmethod_imf
synced 2024-11-27 17:01:21 +00:00
Signed-off-by: ma-shaoyin <mashaoyin1@huawei.com>
Changes to be committed:
This commit is contained in:
parent
403ad5d241
commit
cfecf56226
@ -55,9 +55,6 @@ namespace MiscServices {
|
||||
void ClearData();
|
||||
bool FindKey(const std::u16string& key) const;
|
||||
|
||||
bool Marshalling(Parcel &parcel) const override;
|
||||
static InputMethodSetting *Unmarshalling(Parcel &parcel);
|
||||
|
||||
private:
|
||||
std::map<std::u16string, std::u16string> setting;
|
||||
const char16_t DELIM_IME = ':';
|
||||
|
@ -90,7 +90,7 @@ namespace MiscServices {
|
||||
*/
|
||||
bool InputMethodProperty::Marshalling(Parcel &parcel) const
|
||||
{
|
||||
if (!(parcel.WriteString16(mImeId)
|
||||
return parcel.WriteString16(mImeId)
|
||||
&& parcel.WriteString16(mPackageName)
|
||||
&& parcel.WriteString16(mAbilityName)
|
||||
&& parcel.WriteString16(mConfigurationPage)
|
||||
@ -99,17 +99,7 @@ namespace MiscServices {
|
||||
&& parcel.WriteInt32(labelId)
|
||||
&& parcel.WriteInt32(descriptionId)
|
||||
&& parcel.WriteString16(label)
|
||||
&& parcel.WriteString16(description)))
|
||||
return false;
|
||||
int32_t size = (int32_t)mTypes.size();
|
||||
parcel.WriteInt32(size);
|
||||
if (!size) {
|
||||
return true;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
parcel.WriteParcelable(mTypes[i]);
|
||||
}
|
||||
return true;
|
||||
&& parcel.WriteString16(description);
|
||||
}
|
||||
|
||||
/*! Get InputMethodProperty from parcel
|
||||
@ -131,22 +121,6 @@ namespace MiscServices {
|
||||
info->label = parcel.ReadString16();
|
||||
info->description = parcel.ReadString16();
|
||||
|
||||
int32_t size = parcel.ReadInt32();
|
||||
if (size < 0) {
|
||||
return info;
|
||||
}
|
||||
|
||||
size_t readAbleSize = parcel.GetReadableBytes() / sizeof(KeyboardType);
|
||||
size_t len = static_cast<size_t>(size);
|
||||
if(len > readAbleSize) {
|
||||
return info;
|
||||
}
|
||||
|
||||
if (!size)
|
||||
return info;
|
||||
for (int i = 0; i < size; i++) {
|
||||
info->mTypes.push_back(parcel.ReadParcelable<KeyboardType>());
|
||||
}
|
||||
return info;
|
||||
}
|
||||
} // namespace MiscServices
|
||||
|
@ -58,49 +58,6 @@ namespace MiscServices {
|
||||
return *this;
|
||||
}
|
||||
|
||||
/*! Write setting data to parcel
|
||||
\param[out] parcel the setting data is written to parcel returned to caller.
|
||||
\return ErrorCode::NO_ERROR
|
||||
*/
|
||||
bool InputMethodSetting::Marshalling(OHOS::Parcel &parcel) const
|
||||
{
|
||||
int32_t size = setting.size();
|
||||
parcel.WriteInt32(size);
|
||||
std::map<std::u16string, std::u16string>::const_iterator it;
|
||||
for (it = setting.cbegin(); it != setting.cend(); ++it) {
|
||||
parcel.WriteString16(it->first);
|
||||
parcel.WriteString16(it->second);
|
||||
}
|
||||
return ErrorCode::NO_ERROR;
|
||||
}
|
||||
|
||||
/*! Read setting data from parcel
|
||||
\param parcel read the setting data from the given parcel
|
||||
\return ErrorCode::NO_ERROR
|
||||
*/
|
||||
InputMethodSetting *InputMethodSetting::Unmarshalling(OHOS::Parcel &parcel)
|
||||
{
|
||||
auto ims = new InputMethodSetting();
|
||||
int32_t size = parcel.ReadInt32();
|
||||
|
||||
if (size < 0) {
|
||||
return ims;
|
||||
}
|
||||
|
||||
size_t readAbleSize = parcel.GetReadableBytes() / (sizeof(std::u16string) * 2);
|
||||
size_t len = static_cast<size_t>(size);
|
||||
if(len > readAbleSize) {
|
||||
return ims;
|
||||
}
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
std::u16string key = parcel.ReadString16();
|
||||
std::u16string value = parcel.ReadString16();
|
||||
ims->setting.insert(std::pair<std::u16string, std::u16string>(key, value));
|
||||
}
|
||||
return ims;
|
||||
}
|
||||
|
||||
/*! Set setting data for an item
|
||||
\param key the name of setting item
|
||||
\param value the value of setting item
|
||||
|
Loading…
Reference in New Issue
Block a user