Re: [protobuf] Unable to perform SetExtension on 'repeated inside extensions'.

2016-11-17 Thread Sachin Puranik
Thanks a lot Adam, It worked.

Thanks,
Sachin

On Thu, Nov 17, 2016 at 12:36 AM, Adam Cozzette 
wrote:

> I think the MutableExtension() method is the way to go; that will return a
> pointer to your extension field, so in this case a pointer
> to DNSServerNames. Something like this should work:
>
> i->MutableExtension(dnsServerNames)->add_dnsservers("aaa");
>
> Or you could also do it like this:
>
> DNSServerNames temp;
> temp.add_dnsservers("aaa");
> *i->MutableExtension(dnsServerNames) = temp;
>
> On Wed, Nov 16, 2016 at 9:47 AM,  wrote:
>
>> Hi Adam,
>> Please find the below snippet and the associated error:
>> //Code
>>
>> IpInterfaceAddress *i = dynamic_cast
>> (x); //x is of type google::protobuf::Message *
>> if(i != NULL)
>> {
>> DNSServerNames temp;
>> temp.add_dnsservers("aaa");
>> i->MutableExtension.SetExtension(a);
>> }
>>
>> //Error:
>>  error C2228: left of '.SetExtension' must have class/struct/union
>>
>> And tried following as well
>> //code:
>> IpInterfaceAddress *i = dynamic_cast
>> (x); //x is of type google::protobuf::Message *
>> if(i != NULL)
>> {
>> i->AddExtension(dnsServerNames,(char*)value
>> );
>> }
>>
>> //error
>> error C2664: 'void IpInterfaces::IpInterfaceAddre
>> ss::AddExtension(const
>> google::protobuf::internal::ExtensionIdentifier> ,TypeTraitsType,field_type,is_packed> &,const
>> IpInterfaces::DNSServerNames &)' : cannot convert parameter 2 from 'char *'
>> to 'const IpInterfaces::DNSServerNames &'
>>   with
>>   [
>>   Type=IpInterfaces::DNSServerNames,
>>   ExtendeeType=IpInterfaces::IpInterfaceAddress,
>>   TypeTraitsType=google::protobu
>> f::internal::MessageTypeTraits,
>>   field_type=11,
>>   is_packed=false
>>   ]
>>   Reason: cannot convert from 'char *' to 'const
>> IpInterfaces::DNSServerNames'
>>   No constructor could take the source type, or constructor
>> overload resolution was ambiguous
>>
>> Regards,
>> Sachin
>>
>> On Wednesday, November 16, 2016 at 10:09:03 PM UTC+5:30, Adam Cozzette
>> wrote:
>>>
>>> That should work; you should be able to use repeated fields inside your
>>> extension submessage field. I think you might just be running into a syntax
>>> issue; could you post the code snippet and the error you're getting?
>>>
>>> On Wed, Nov 16, 2016 at 4:08 AM,  wrote:
>>>
 import "IpInterfaces.proto";
 package IpInterfaces;

 message DNSServerNames{
 *repeated* string dnsServers=11;//limited only to optional?
 }
 extend IpInterfaceAddress{
 optional DNSServerNames dnsServerNames=101;
 }

 Unable to perform SetExtension(dnsServers,value).
 Is this supported or is it limited only to OPTIONAL?

 Thanks in Advance

 --
 You received this message because you are subscribed to the Google
 Groups "Protocol Buffers" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to protobuf+u...@googlegroups.com.
 To post to this group, send email to prot...@googlegroups.com.
 Visit this group at https://groups.google.com/group/protobuf.
 For more options, visit https://groups.google.com/d/optout.

>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to protobuf+unsubscr...@googlegroups.com.
>> To post to this group, send email to protobuf@googlegroups.com.
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Unable to perform SetExtension on 'repeated inside extensions'.

2016-11-16 Thread 'Adam Cozzette' via Protocol Buffers
I think the MutableExtension() method is the way to go; that will return a
pointer to your extension field, so in this case a pointer
to DNSServerNames. Something like this should work:

i->MutableExtension(dnsServerNames)->add_dnsservers("aaa");

Or you could also do it like this:

DNSServerNames temp;
temp.add_dnsservers("aaa");
*i->MutableExtension(dnsServerNames) = temp;

On Wed, Nov 16, 2016 at 9:47 AM,  wrote:

> Hi Adam,
> Please find the below snippet and the associated error:
> //Code
>
> IpInterfaceAddress *i = dynamic_cast
> (x); //x is of type google::protobuf::Message *
> if(i != NULL)
> {
> DNSServerNames temp;
> temp.add_dnsservers("aaa");
> i->MutableExtension.SetExtension(a);
> }
>
> //Error:
>  error C2228: left of '.SetExtension' must have class/struct/union
>
> And tried following as well
> //code:
> IpInterfaceAddress *i = dynamic_cast
> (x); //x is of type google::protobuf::Message *
> if(i != NULL)
> {
> i->AddExtension(dnsServerNames,(char*)value );
> }
>
> //error
> error C2664: 'void IpInterfaces::IpInterfaceAddress::
> AddExtension(const
> google::protobuf::internal::ExtensionIdentifier<
> ExtendeeType,TypeTraitsType,field_type,is_packed> &,const
> IpInterfaces::DNSServerNames &)' : cannot convert parameter 2 from 'char *'
> to 'const IpInterfaces::DNSServerNames &'
>   with
>   [
>   Type=IpInterfaces::DNSServerNames,
>   ExtendeeType=IpInterfaces::IpInterfaceAddress,
>   TypeTraitsType=google::protobuf::internal::
> MessageTypeTraits,
>   field_type=11,
>   is_packed=false
>   ]
>   Reason: cannot convert from 'char *' to 'const
> IpInterfaces::DNSServerNames'
>   No constructor could take the source type, or constructor
> overload resolution was ambiguous
>
> Regards,
> Sachin
>
> On Wednesday, November 16, 2016 at 10:09:03 PM UTC+5:30, Adam Cozzette
> wrote:
>>
>> That should work; you should be able to use repeated fields inside your
>> extension submessage field. I think you might just be running into a syntax
>> issue; could you post the code snippet and the error you're getting?
>>
>> On Wed, Nov 16, 2016 at 4:08 AM,  wrote:
>>
>>> import "IpInterfaces.proto";
>>> package IpInterfaces;
>>>
>>> message DNSServerNames{
>>> *repeated* string dnsServers=11;//limited only to optional?
>>> }
>>> extend IpInterfaceAddress{
>>> optional DNSServerNames dnsServerNames=101;
>>> }
>>>
>>> Unable to perform SetExtension(dnsServers,value).
>>> Is this supported or is it limited only to OPTIONAL?
>>>
>>> Thanks in Advance
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "Protocol Buffers" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to protobuf+u...@googlegroups.com.
>>> To post to this group, send email to prot...@googlegroups.com.
>>> Visit this group at https://groups.google.com/group/protobuf.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Protocol Buffers" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to protobuf+unsubscr...@googlegroups.com.
> To post to this group, send email to protobuf@googlegroups.com.
> Visit this group at https://groups.google.com/group/protobuf.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


Re: [protobuf] Unable to perform SetExtension on 'repeated inside extensions'.

2016-11-16 Thread sachin . p . puranik
Hi Adam,
Please find the below snippet and the associated error:
//Code

IpInterfaceAddress *i = dynamic_cast 
(x); //x is of type google::protobuf::Message *
if(i != NULL)
{
DNSServerNames temp;
temp.add_dnsservers("aaa");
i->MutableExtension.SetExtension(a);
}

//Error:
 error C2228: left of '.SetExtension' must have class/struct/union

And tried following as well
//code:
IpInterfaceAddress *i = dynamic_cast 
(x); //x is of type google::protobuf::Message *
if(i != NULL)
{
i->AddExtension(dnsServerNames,(char*)value );
}

//error
error C2664: 'void 
IpInterfaces::IpInterfaceAddress::AddExtension(const
 
google::protobuf::internal::ExtensionIdentifier
 
&,const IpInterfaces::DNSServerNames &)' : cannot convert parameter 2 from 
'char *' to 'const IpInterfaces::DNSServerNames &'
  with
  [
  Type=IpInterfaces::DNSServerNames,
  ExtendeeType=IpInterfaces::IpInterfaceAddress,
  
TypeTraitsType=google::protobuf::internal::MessageTypeTraits,
  field_type=11,
  is_packed=false
  ]
  Reason: cannot convert from 'char *' to 'const 
IpInterfaces::DNSServerNames'
  No constructor could take the source type, or constructor 
overload resolution was ambiguous

Regards,
Sachin

On Wednesday, November 16, 2016 at 10:09:03 PM UTC+5:30, Adam Cozzette 
wrote:
>
> That should work; you should be able to use repeated fields inside your 
> extension submessage field. I think you might just be running into a syntax 
> issue; could you post the code snippet and the error you're getting?
>
> On Wed, Nov 16, 2016 at 4:08 AM,  
> wrote:
>
>> import "IpInterfaces.proto";
>> package IpInterfaces;
>>
>> message DNSServerNames{
>> *repeated* string dnsServers=11;//limited only to optional?
>> }
>> extend IpInterfaceAddress{ 
>> optional DNSServerNames dnsServerNames=101;
>> }
>>
>> Unable to perform SetExtension(dnsServers,value).
>> Is this supported or is it limited only to OPTIONAL?
>>
>> Thanks in Advance
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Protocol Buffers" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to protobuf+u...@googlegroups.com .
>> To post to this group, send email to prot...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/protobuf.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.


[protobuf] Unable to perform SetExtension on 'repeated inside extensions'.

2016-11-16 Thread sachin . p . puranik
import "IpInterfaces.proto";
package IpInterfaces;

message DNSServerNames{
*repeated* string dnsServers=11;//limited only to optional?
}
extend IpInterfaceAddress{ 
optional DNSServerNames dnsServerNames=101;
}

Unable to perform SetExtension(dnsServers,value).
Is this supported or is it limited only to OPTIONAL?

Thanks in Advance

-- 
You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to protobuf+unsubscr...@googlegroups.com.
To post to this group, send email to protobuf@googlegroups.com.
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.