Lines Matching refs:data
25 template <> size_t CountBufferSize(const std::nullptr_t &input, TLVObject &data)
27 return data.CountHead();
30 template <> bool Writing(const std::nullptr_t &input, TLVObject &data, TAG tag)
32 InitWhenFirst(input, data);
33 return data.WriteHead(static_cast<uint16_t>(tag), 0);
36 template <> bool Reading(std::nullptr_t &output, TLVObject &data, const TLVHead &head)
38 return data.Read(output, head);
41 template <> size_t CountBufferSize(const std::monostate &input, TLVObject &data)
43 return data.Count(input);
46 template <> bool Writing(const std::monostate &input, TLVObject &data, TAG tag)
48 InitWhenFirst(input, data);
49 return data.Write(tag, input);
52 template <> bool Reading(std::monostate &output, TLVObject &data, const TLVHead &head)
54 return data.Read(output, head);
57 template <> size_t CountBufferSize(const std::string &input, TLVObject &data)
59 return data.Count(input);
62 template <> bool Writing(const std::string &input, TLVObject &data, TAG tag)
64 InitWhenFirst(input, data);
65 return data.Write(tag, input);
68 template <> bool Reading(std::string &output, TLVObject &data, const TLVHead &head)
70 return data.Read(output, head);
73 template <> size_t CountBufferSize(const std::vector<uint8_t> &input, TLVObject &data)
75 return data.Count(input);
78 template <> bool Writing(const std::vector<uint8_t> &input, TLVObject &data, TAG tag)
80 InitWhenFirst(input, data);
81 return data.Write(tag, input);
84 template <> bool Reading(std::vector<uint8_t> &output, TLVObject &data, const TLVHead &head)
86 return data.Read(output, head);
89 template <> size_t CountBufferSize(const UDType &input, TLVObject &data)
92 return data.CountBasic(type);
95 template <> bool Writing(const UDType &input, TLVObject &data, TAG tag)
97 InitWhenFirst(input, data);
99 return data.WriteBasic(tag, type);
102 template <> bool Reading(UDType &output, TLVObject &data, const TLVHead &head)
105 if (!Reading(type, data, head)) {
115 template <> size_t CountBufferSize(const DataStatus &input, TLVObject &data)
118 return data.CountBasic(status);
121 template <> bool Writing(const DataStatus &input, TLVObject &data, TAG tag)
123 InitWhenFirst(input, data);
125 return data.WriteBasic(tag, status);
128 template <> bool Reading(DataStatus &output, TLVObject &data, const TLVHead &head)
131 if (!data.ReadBasic(status, head)) {
141 template <> size_t CountBufferSize(const Object &input, TLVObject &data)
143 return data.CountHead() + CountBufferSize(input.value_, data);
146 template <> bool Writing(const Object &input, TLVObject &data, TAG tag)
148 InitWhenFirst(input, data);
149 auto tagCursor = data.GetCursor();
150 data.OffsetHead();
151 if (!Writing(input.value_, data, TAG::TAG_OBJECT_VALUE)) {
154 return data.WriteBackHead(static_cast<uint16_t>(tag), tagCursor, data.GetCursor() - tagCursor - sizeof(TLVHead));
156 template <> bool Reading(Object &output, TLVObject &data, const TLVHead &head)
159 if (!data.ReadHead(headValue)) {
165 if (!Reading(output.value_, data, headValue)) {
171 template <> size_t CountBufferSize(const UnifiedKey &input, TLVObject &data)
173 return data.CountHead() + data.Count(input.key) + data.Count(input.intention) + data.Count(input.bundleName) +
174 data.Count(input.groupId);
176 template <> bool Writing(const UnifiedKey &input, TLVObject &data, TAG tag)
178 InitWhenFirst(input, data);
179 auto tagCursor = data.GetCursor();
180 data.OffsetHead();
181 if (!data.Write(TAG::TAG_KEY, input.key)) {
184 if (!data.Write(TAG::TAG_INTENTION, input.intention)) {
187 if (!data.Write(TAG::TAG_BUNDLE_NAME, input.bundleName)) {
190 if (!data.Write(TAG::TAG_GROUP_ID, input.groupId)) {
193 return data.WriteBackHead(static_cast<uint16_t>(tag), tagCursor, data.GetCursor() - tagCursor - sizeof(TLVHead));
196 template <> bool Reading(UnifiedKey &output, TLVObject &data, const TLVHead &head)
198 auto endCursor = data.GetCursor() + head.len;
199 while (data.GetCursor() < endCursor) {
201 if (!data.ReadHead(headItem)) {
206 if (!data.Read(output.key, headItem)) {
211 if (!data.Read(output.intention, headItem)) {
216 if (!data.Read(output.bundleName, headItem)) {
221 if (!data.Read(output.groupId, headItem)) {
226 data.Skip(headItem);
232 template <> size_t CountBufferSize(const UnifiedData &input, TLVObject &data)
235 return data.CountHead() + data.Count(version) + TLVUtil::CountBufferSize(input.GetRecords(), data);
238 template <> bool Writing(const UnifiedData &input, TLVObject &data, TAG tag)
240 InitWhenFirst(input, data);
241 auto tagCursor = data.GetCursor();
242 data.OffsetHead();
244 if (!data.Write(TAG::TAG_VERSION, version)) {
247 if (!TLVUtil::Writing(input.GetRecords(), data, TAG::TAG_UNIFIED_RECORD)) {
250 return data.WriteBackHead(static_cast<uint16_t>(tag), tagCursor, data.GetCursor() - tagCursor - sizeof(TLVHead));
253 template <> bool Reading(UnifiedData &output, TLVObject &data, const TLVHead &head)
255 auto endCursor = data.GetCursor() + head.len;
256 while (data.GetCursor() < endCursor) {
258 if (!data.ReadHead(headItem)) {
262 data.Skip(headItem);
267 if (!Reading(records, data, headItem)) {
273 data.Skip(headItem);
278 template <> size_t CountBufferSize(const UnifiedRecord &input, TLVObject &data)
281 return data.CountHead() + data.Count(version) + data.CountBasic(static_cast<int32_t>(input.GetType())) +
282 data.Count(input.GetUid()) + CountBufferSize(input.GetOriginValue(), data);
285 template <> bool Writing(const UnifiedRecord &input, TLVObject &data, TAG tag)
287 InitWhenFirst(input, data);
288 auto tagCursor = data.GetCursor();
289 data.OffsetHead();
291 if (!data.Write(TAG::TAG_VERSION, version)) {
294 if (!data.WriteBasic(TAG::TAG_UD_TYPE, static_cast<int32_t>(input.GetType()))) {
297 if (!data.Write(TAG::TAG_UID, input.GetUid())) {
300 if (!TLVUtil::Writing(input.GetOriginValue(), data, TAG::TAG_RECORD_VALUE)) {
303 return data.WriteBackHead(static_cast<uint16_t>(tag), tagCursor, data.GetCursor() - tagCursor - sizeof(TLVHead));
306 template <> bool Reading(UnifiedRecord &output, TLVObject &data, const TLVHead &head)
308 auto endCursor = data.GetCursor() + head.len;
312 while (data.GetCursor() < endCursor) {
314 if (!data.ReadHead(headItem)) {
319 data.Skip(headItem);
322 if (!TLVUtil::Reading(dataType, data, headItem)) {
328 if (!data.Read(uid, headItem)) {
334 if (!TLVUtil::Reading(value, data, headItem)) {
340 data.Skip(headItem);
346 template <> size_t CountBufferSize(const Runtime &input, TLVObject &data)
349 return data.CountHead() + data.CountBasic(input.isPrivate) + data.CountBasic(input.dataVersion) +
350 data.CountBasic(input.recordTotalNum) + data.CountBasic(input.tokenId) +
351 data.CountBasic(static_cast<int64_t>(input.createTime)) +
352 data.CountBasic(static_cast<int64_t>(input.lastModifiedTime)) +
353 data.CountBasic(static_cast<int32_t>(input.dataStatus)) + data.Count(input.sourcePackage) +
354 data.Count(input.createPackage) + data.Count(input.deviceId) + TLVUtil::CountBufferSize(input.key, data) +
355 data.Count(version) + TLVUtil::CountBufferSize(input.privileges, data);
358 template <> bool Writing(const Runtime &input, TLVObject &data, TAG tag)
360 InitWhenFirst(input, data);
361 auto tagCursor = data.GetCursor();
362 data.OffsetHead();
364 if (!TLVUtil::Writing(version, data, TAG::TAG_VERSION)) {
367 if (!TLVUtil::Writing(input.key, data, TAG::TAG_KEY)) {
370 if (!data.WriteBasic(TAG::TAG_IS_PRIVATE, input.isPrivate)) {
373 if (!TLVUtil::Writing(input.privileges, data, TAG::TAG_PRIVILEGE)) {
376 if (!data.WriteBasic(TAG::TAG_CREATE_TIME, static_cast<int64_t>(input.createTime))) {
379 if (!data.Write(TAG::TAG_SOURCE_PACKAGE, input.sourcePackage)) {
382 if (!data.WriteBasic(TAG::TAG_DATA_STATUS, static_cast<int32_t>(input.dataStatus))) {
385 if (!data.WriteBasic(TAG::TAG_DATA_VERSION, input.dataVersion)) {
388 if (!data.WriteBasic(TAG::TAG_LAST_MODIFIED_TIME, static_cast<int64_t>(input.lastModifiedTime))) {
391 if (!data.Write(TAG::TAG_CREATE_PACKAGE, input.createPackage)) {
394 if (!data.Write(TAG::TAG_DEVICE_ID, input.deviceId)) {
397 if (!data.WriteBasic(TAG::TAG_RECORD_TOTAL_NUM, input.recordTotalNum)) {
400 if (!data.WriteBasic(TAG::TAG_TOKEN_ID, input.tokenId)) {
403 return data.WriteBackHead(static_cast<uint16_t>(tag), tagCursor, data.GetCursor() - tagCursor - sizeof(TLVHead));
406 template <> bool Reading(Runtime &output, TLVObject &data, const TLVHead &head)
408 auto endCursor = data.GetCursor() + head.len;
409 while (data.GetCursor() < endCursor) {
411 if (!data.ReadHead(headItem)) {
419 result = TLVUtil::Reading(output.key, data, headItem);
422 result = data.ReadBasic(output.isPrivate, headItem);
425 result = TLVUtil::Reading(output.privileges, data, headItem);
428 result = data.ReadBasic(createTime, headItem);
432 result = data.Read(output.sourcePackage, headItem);
435 result = TLVUtil::Reading(output.dataStatus, data, headItem);
438 result = data.ReadBasic(output.dataVersion, headItem);
441 result = data.ReadBasic(lastModifiedTime, headItem);
445 result = data.Read(output.createPackage, headItem);
448 result = data.Read(output.deviceId, headItem);
451 result = data.ReadBasic(output.recordTotalNum, headItem);
454 result = data.ReadBasic(output.tokenId, headItem);
457 result = data.Skip(headItem);
466 template <> size_t CountBufferSize(const Privilege &input, TLVObject &data)
468 return data.CountHead() + data.CountBasic(input.tokenId) + data.Count(input.readPermission) +
469 data.Count(input.writePermission);
472 template <> bool Writing(const Privilege &input, TLVObject &data, TAG tag)
474 InitWhenFirst(input, data);
475 auto tagCursor = data.GetCursor();
476 data.OffsetHead();
477 if (!data.WriteBasic(TAG::TAG_TOKEN_ID, input.tokenId)) {
480 if (!data.Write(TAG::TAG_READPERMISSION, input.readPermission)) {
483 if (!data.Write(TAG::TAG_WRITEPERMISSION, input.writePermission)) {
486 return data.WriteBackHead(static_cast<uint16_t>(tag), tagCursor, data.GetCursor() - tagCursor - sizeof(TLVHead));
489 template <> bool Reading(Privilege &output, TLVObject &data, const TLVHead &head)
491 auto endCursor = data.GetCursor() + head.len;
492 while (data.GetCursor() < endCursor) {
494 if (!data.ReadHead(headItem)) {
499 if (!data.ReadBasic(output.tokenId, headItem)) {
504 if (!data.Read(output.readPermission, headItem)) {
509 if (!data.Read(output.writePermission, headItem)) {
514 data.Skip(headItem);
520 template <> size_t CountBufferSize(const std::shared_ptr<OHOS::Media::PixelMap> &input, TLVObject &data)
527 return CountBufferSize(val, data);
530 template <> bool Writing(const std::shared_ptr<OHOS::Media::PixelMap> &input, TLVObject &data, TAG tag)
532 InitWhenFirst(input, data);
538 return data.Write(tag, val);
541 template <> bool Reading(std::shared_ptr<OHOS::Media::PixelMap> &output, TLVObject &data, const TLVHead &head)
544 if (!data.Read(val, head)) {
556 template <> size_t CountBufferSize(const std::shared_ptr<OHOS::AAFwk::Want> &input, TLVObject &data)
565 return CountBufferSize(val, data);
568 template <> bool Writing(const std::shared_ptr<OHOS::AAFwk::Want> &input, TLVObject &data, TAG tag)
570 InitWhenFirst(input, data);
580 auto err = memcpy_s(val.data(), size, reinterpret_cast<const void *>(buffer), size);
586 return data.Write(tag, val);
589 template <> bool Reading(std::shared_ptr<OHOS::AAFwk::Want> &output, TLVObject &data, const TLVHead &head)
592 if (!data.Read(val, head)) {
603 auto err = memcpy_s(buffer, val.size(), val.data(), val.size());