[prev in list] [next in list] [prev in thread] [next in thread] 

List:       calligra-devel
Subject:    Re: [calligra] /: Add api for writing ODF that is generated from the ODF RNG file.
From:       "Friedrich W. H. Kossebau" <kossebau () kde ! org>
Date:       2013-08-04 18:25:19
Message-ID: 1635691.2oKJzDg21I () klux ! site
[Download RAW message or body]

Hi,

really cool work from Jos, happy to see it having made it into Calligra master 
:)

Am Sonntag, 4. August 2013, 17:41:20 schrieb Jos van den Oever:
> Example:
>  Instead of writing:
> ==
>   xmlWriter->startElement("text:p");
>   xmlWriter->addAttribute("text:style-name", "italic");
>   xmlWriter->startElement("text:p");
>   xmlWriter->addAttribute("text:style-name", "bold");
>   xmlWriter->addTextNode("Hello World!");
>   xmlWriter->endElement();
>   xmlWriter->endElement();
> ==
> you can write:
> ==
>   text_p p(xmlWriter);
>   p.set_text_style_name("italic");
>   text_span span(p.add_text_span());
>   span.set_text_style_name("italic");
>   span.addTextNode("Hello World!");
> ==

Having finally given the patch I look as well I found I have a really hard 
time reading all_the_created_methods_and_objects.  

I wonder who else would favour to do like it is done in the browsers' HTML 
DOM, where the hyphens in all element/attribute names are replaced by removing 
them and turning the following letter to Uppercase.

Might need some more work in the generator, but given that this is affecting 
quite some code is should be worth the effort. So the only usages of _ would 
be to separate the element/attribute name from e.g. the set-prefix and as 
replacement for the namespace separator, which at least might help parsing. So 
in the given example it would be:

>   text_p p(xmlWriter);
>   p.set_text_styleName("italic");
>   text_span span(p.add_text_span());
>   span.set_text_styleName("italic");
>   span.addTextNode("Hello World!");

What do people think? What are other downsides of this approach? Will it need 
some special case handling for some cases (and would that still be worth it??

Cheers
Friedrich
_______________________________________________
calligra-devel mailing list
calligra-devel@kde.org
https://mail.kde.org/mailman/listinfo/calligra-devel
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic