[protobuf] Re: Issue 190 in protobuf: [C++] Change TextFormat::Printer::TextGenerator class from 'private' to 'protected'

2010-05-24 Thread protobuf

Updates:
Status: WorkingAsIntended

Comment #1 on issue 190 by ken...@google.com: [C++] Change  
TextFormat::Printer::TextGenerator class from 'private' to 'protected'

http://code.google.com/p/protobuf/issues/detail?id=190

TextFormat::Printer is not intended to be subclassed.  We do not want to  
expose
private implementation details like TextGenerator because those details  
could change
in the future (for example, I'm considering replacing it with  
protobuf::io::Printer).


--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: Issue 190 in protobuf: [C++] Change TextFormat::Printer::TextGenerator class from 'private' to 'protected'

2010-05-24 Thread protobuf


Comment #2 on issue 190 by marthaler: [C++] Change  
TextFormat::Printer::TextGenerator class from 'private' to 'protected'

http://code.google.com/p/protobuf/issues/detail?id=190

I understand. I just thought you could look at it since creating different  
output
formats in C++ is much more convoluted than in Python or Java. Python uses  
the
cStringIO package and java uses the Appendable interface, but (as I  
understand it)

there doesn't seem to be something comparable in C++, hence the need for the
TextGenerator class interfacing to the ZeroCopyOutputStream class methods.

Seeing as there is a simple workaround (by creating another private  
TextGenerator
class to interface with the ZeroCopyOutputStream), it does not seem to be  
high-priority.


--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: Issue 190 in protobuf: [C++] Change TextFormat::Printer::TextGenerator class from 'private' to 'protected'

2010-05-24 Thread protobuf


Comment #3 on issue 190 by ken...@google.com: [C++] Change  
TextFormat::Printer::TextGenerator class from 'private' to 'protected'

http://code.google.com/p/protobuf/issues/detail?id=190

Did you look at google::protobuf::io::Printer?

--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.



[protobuf] Re: Issue 190 in protobuf: [C++] Change TextFormat::Printer::TextGenerator class from 'private' to 'protected'

2010-05-24 Thread protobuf


Comment #4 on issue 190 by marthaler: [C++] Change  
TextFormat::Printer::TextGenerator class from 'private' to 'protected'

http://code.google.com/p/protobuf/issues/detail?id=190


I took a look at google::protobuf::io::Printer, in fact, I initially  
thought it was
related to the google::protobuf::TextFormat::Printer class, and it lead to  
much
confusion. However, since google::protobuf::io::Printer does not deal with  
the
formating of google::protobuf::Message objects and (as I currently  
understand it)
deals with text replacement of map objects, I think it's not what I want  
(or at least
I couldn't figure out how the variable_delimeter was related to the  
indentation level).


I specifically followed the
google::protobuf::TextFormat::PrintToString(google::protobuf::Message,  
std::string)
function, since the DebugString() class of methods boil down to using that  
method to

format an output string.

That PrintToString method, of course, is just a wrapper to the message  
reflection and
the PrintField and PrintUnknownFields which uses an instance of the  
TextGenerator class.



The initial request was to make the TextGenerator class protected, so that  
I could
then write a class that extends from the TextFormat::Printer class and use  
the
generator.Print(const char* text), Indent() and Outdent() methods and just  
worry
about the TextFormat::Printer::PrintField(const Message message, const  
Reflection*
reflection, const FieldDescriptor* field, TextGenerator generator)  
function and
corresponding PrintFieldName, PrintFieldValue functions. These three  
functions in the

C++ code determine the string representation of the protocol buffer message.



I see what you're saying with using the protofuf::io::Printer to replace the
TextGenerator class since they seem to share very similar  
ZeroCopyOutputStream
interface code, but until then C++ developers that need to create a method  
to change

the string output format of a protobuf will be using a copy of the internal
TextGenerator class.

--
You received this message because you are subscribed to the Google Groups Protocol 
Buffers group.
To post to this group, send email to proto...@googlegroups.com.
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en.