Lines Matching defs:key
38 bool PutIntValueToFormatMap(FormatDataMap &formatMap, const std::string_view &key, int32_t value)
43 auto ret = formatMap.insert(std::make_pair(std::string(key), data));
47 bool PutLongValueToFormatMap(FormatDataMap &formatMap, const std::string_view &key, int64_t value)
52 auto ret = formatMap.insert(std::make_pair(std::string(key), data));
56 bool PutFloatValueToFormatMap(FormatDataMap &formatMap, const std::string_view &key, float value)
61 auto ret = formatMap.insert(std::make_pair(std::string(key), data));
65 bool PutDoubleValueToFormatMap(FormatDataMap &formatMap, const std::string_view &key, double value)
70 auto ret = formatMap.insert(std::make_pair(std::string(key), data));
74 bool PutStringValueToFormatMap(FormatDataMap &formatMap, const std::string_view &key, const std::string_view &value)
79 auto ret = formatMap.insert(std::make_pair(std::string(key), data));
83 bool PutBufferToFormatMap(FormatDataMap &formatMap, const std::string_view &key, uint8_t *addr, size_t size)
90 auto ret = formatMap.insert(std::make_pair(std::string(key), data));
144 bool Format::PutIntValue(const std::string_view &key, int32_t value)
146 auto defaultValue = GetDefaultAnyValueOpt(key.data());
150 Any::IsSameTypeWith<bool>(defaultValue.value()) || IsIntEnum(key.data());
151 FALSE_RETURN_V_MSG_E(isSameType, false, "Key's value type does not match int32, key: %{public}s", key.data());
154 return SetMetaData(*meta_, std::string(key), value);
157 bool Format::PutLongValue(const std::string_view &key, int64_t value)
159 auto defaultValue = GetDefaultAnyValueOpt(key.data());
162 Any::IsSameTypeWith<int64_t>(defaultValue.value()) || IsLongEnum(key.data());
163 FALSE_RETURN_V_MSG_E(isSameType, false, "Key's value type does not match int64, key: %{public}s", key.data());
165 return SetMetaData(*meta_, std::string(key), value);
168 bool Format::PutFloatValue(const std::string_view &key, float value)
170 auto defaultValue = GetDefaultAnyValueOpt(key.data());
173 FALSE_RETURN_V_MSG_E(isSameType, false, "Key's value type does not match float, key: %{public}s", key.data());
176 meta_->SetData(std::string(key), value);
180 bool Format::PutDoubleValue(const std::string_view &key, double value)
182 auto defaultValue = GetDefaultAnyValueOpt(key.data());
185 FALSE_RETURN_V_MSG_E(isSameType, false, "Key's value type does not match double, key: %{public}s", key.data());
188 meta_->SetData(std::string(key), value);
192 bool Format::PutStringValue(const std::string_view &key, const std::string_view &value)
194 auto defaultValue = GetDefaultAnyValueOpt(key.data());
197 FALSE_RETURN_V_MSG_E(isSameType, false, "Key's value type does not match string, key: %{public}s", key.data());
200 meta_->SetData(std::string(key), std::string(value));
204 bool Format::PutBuffer(const std::string_view &key, const uint8_t *addr, size_t size)
206 auto defaultValue = GetDefaultAnyValueOpt(key.data());
209 FALSE_RETURN_V_MSG_E(isSameType, false, "Key's value type does not match buffer, key: %{public}s", key.data());
212 FALSE_RETURN_V_MSG_E(size <= BUFFER_SIZE_MAX, false, "PutBuffer input size failed. Key: " PUBLIC_LOG_S, key.data());
214 auto iter = meta_->Find(std::string(key));
217 meta_->SetData(std::string(key), std::move(value));
222 FALSE_RETURN_V_MSG_E(tmpVector != nullptr, false, "Any value is invalid. Key: " PUBLIC_LOG_S, key.data());
229 auto formatMapIter = formatMap_.find(key);
232 PutBufferToFormatMap(formatMap_, key, anyAddr, size);
237 bool Format::GetIntValue(const std::string_view &key, int32_t &value) const
239 return GetMetaData(*meta_, std::string(key), value);
242 bool Format::GetLongValue(const std::string_view &key, int64_t &value) const
244 return GetMetaData(*meta_, std::string(key), value);
247 bool Format::GetFloatValue(const std::string_view &key, float &value) const
249 return meta_->GetData(std::string(key), value);
252 bool Format::GetDoubleValue(const std::string_view &key, double &value) const
254 return meta_->GetData(std::string(key), value);
257 bool Format::GetStringValue(const std::string_view &key, std::string &value) const
259 return meta_->GetData(std::string(key), value);
262 bool Format::GetBuffer(const std::string_view &key, uint8_t **addr, size_t &size) const
265 auto iter = meta_->Find(std::string(key));
277 bool Format::PutFormatVector(const std::string_view &key, std::vector<Format> &value)
279 RemoveKey(key);
280 auto ret = formatVecMap_.insert(std::make_pair(std::string(key), value));
284 bool Format::GetFormatVector(const std::string_view &key, std::vector<Format> &value) const
286 auto iter = formatVecMap_.find(key);
288 false, "GetFormatVector failed. Key: %{public}s", key.data());
293 bool Format::ContainKey(const std::string_view &key) const
295 auto iter = meta_->Find(std::string(key));
299 auto vecMapIter = formatVecMap_.find(key);
303 FormatDataType Format::GetValueType(const std::string_view &key) const
305 auto iter = meta_->Find(std::string(key));
321 bool isLongValue = GetMetaData(*meta_, std::string(key), valueTemp);
328 void Format::RemoveKey(const std::string_view &key)
330 meta_->Remove(std::string(key));
332 auto vecMapIter = formatVecMap_.find(key);
370 FALSE_LOG_MSG(ret, "Put value to formatMap failed, key = %{public}s", iter->first.c_str());