Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Deleting Particular repeated field data from Google protocol buffer

Deleting Particular repeated field data from Google protocol buffer

Scheduled Pinned Locked Moved 3rd Party Software
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Zee_07Z Offline
    Zee_07Z Offline
    Zee_07
    wrote on last edited by
    #1

    Hi,

    I am working on Google Protocol Buffers for serializing and de-serializing , I searched through google protocol buffer library but couldn't find a way to delete a particular field from a message,

    .proto file structure

    @message repetedMSG
    {
    required string data = 1;
    }

    message mainMSG
    {
    required repetedMSG_id = 1;
    repeated repetedMSG rptMSG = 2;
    }@

    I have one mainMSG and in it too many (suppose 10) repetedMSG are present. Now i want to delete any particular repetedMSG (suppose 5th repetedMSG )from mainMSG. For this i tried 2 ways but none of them worked.

    @for (int j = 0; j<mainMSG->repetedMSG_size(); j++)
    {
    repetedMSG reptMsg = mainMsg->mutable_repetedMSG(j);

    if (QString::fromStdString(reptMsg->data).compare("deleteMe") == 0)
    

    {
    reptMsg->Clear(); // <-- First tried way
    delete reptMsg; // <-- Second tried Way
    break;
    }
    }@

    Any help will be higly appreciated.
    Regards

    Thanks and Kind Regards,
    Zee_07

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved