Le Mardi 13 Septembre 2005 13:52, Tom Schindl a écrit :
> Hi,
>
> if you could use Paolos snippet creator from
> http://www.paolo-mantovani.org/.
>
> You can see how to install it on the snippet page. If that's not
> possible I'll try to integrate them when I have time.

Here is the result attached to the mail. Hope it helps.

> Thanks for your contribution to the snippet collection.

You are welcome !

Cheers,
Pierre-André
-- 
StarXpert - www.starxpert.fr
e-mail : [EMAIL PROTECTED]
<?xml version="1.0"?>
<!--
$RCSfile: $
last change: $Revision: $ $Author: $ $Date: $

(c)2003 by the copyright holders listed with the author-tags.
If no explicit copyright holder is mentioned with a certain author,
the author him-/herself is the copyright holder. All rights reserved.

Public Documentation License Notice:

The contents of this Documentation are subject to the
Public Documentation License Version 1.0 (the "License");
you may only use this Documentation if you comply with
the terms of this License. A copy of the License is
available at http://www.openoffice.org/licenses/PDL.html

The Original Documentation can be found in the CVS archives
of openoffice.org at the place specified by RCSfile: in this header.

The Initial Writer(s) of the Original Documentation are listed
with the author-tags below.

The Contributor(s) are listed with the author-tags below
without the marker for being an initial author.

All Rights Reserved.
-->

<snippet language="Cpp" application="">

<keywords>
        <keyword>OUStrings</keyword>
        <keyword>Strings</keyword>
        <keyword>std</keyword>
        <keyword>string</keyword>
        <keyword>print</keyword>
        <keyword>&lt;&lt;</keyword>
        <keyword>cout</keyword>
</keywords>

<authors>
        <author id="pagalmes" initial="true" email="[EMAIL PROTECTED]" 
copyright="StarXpert">Pierre-Andr&#233; Galmes</author>
</authors>

<question heading="Howto print OUStrings ?">Howto print OUStrings ?
<p>I do want to see the content of an OUString. How do I do </p>
<p>to use the standard output to display it ?</p>
</question>

<answer>
<p>In fact, to print an OUString, you need to convert it in a OString.</p>
<p></p>
<p>The result of the code :</p>
<p></p>
<p>aouString : 0xb5b87fd8</p>
<p>aOString : Coucou</p>
</answer>

<versions>
        <version number="2.0.x" status="tested"/>
</versions>

<operating-systems>
<operating-system name="All"/>
</operating-systems>

<changelog>
        <change author-id="pagalmes" date="2005-09-13">Initial version</change>
</changelog>

</snippet>
<?xml version="1.0"?>
<!--
$RCSfile: $
last change: $Revision: $ $Author: $ $Date: $

(c)2003 by the copyright holders listed with the author-tags.
If no explicit copyright holder is mentioned with a certain author,
the author him-/herself is the copyright holder. All rights reserved.

Public Documentation License Notice:

The contents of this Documentation are subject to the
Public Documentation License Version 1.0 (the "License");
you may only use this Documentation if you comply with
the terms of this License. A copy of the License is
available at http://www.openoffice.org/licenses/PDL.html

The Original Documentation can be found in the CVS archives
of openoffice.org at the place specified by RCSfile: in this header.

The Initial Writer(s) of the Original Documentation are listed
with the author-tags below.

The Contributor(s) are listed with the author-tags below
without the marker for being an initial author.

All Rights Reserved.
-->

<snippet language="Cpp" application="">

<keywords>
	<keyword>Sequence</keyword>
	<keyword>Sequences</keyword>
	<keyword>c++</keyword>
	<keyword>cpp</keyword>
	<keyword>getAvailableServiceNames</keyword>
</keywords>

<authors>
	<author id="pagalmes" initial="true" email="[EMAIL PROTECTED]" copyright="StarXpert">Pierre-Andr&#233;  Galmes</author>
</authors>

<question heading="Howto acces to the content of a Sequence ?">Howto acces to the content of a Sequence ?
<p>A function returns a Sequence&lt;class T&gt;. Is there any function</p>
<p>associated with the class to acces its data ?</p>
</question>

<answer>
<p>In fact, Sequences are manipulated like array.</p>
<listing>// Returns a sequence of OUString.
Sequence&lt; ::rtl::OUString &gt; sq =
rxOfficeServiceManager-&gt;getAvailableServiceNames();

// Returns he number of objects in the sequence.
sq.getLength(); 

// Access the content of the sequence.
OUString a = sq[1];
OUString b = sq[801]; // sq.getLength() - 1</listing>
</answer>

<versions>
	<version number="2.0.x" status="tested"/>
	<version number="1.1.x" status="untested"/>
</versions>

<operating-systems>
<operating-system name="All"/>
</operating-systems>

<changelog>
	<change author-id="pagalmes" date="2005-09-13">Initial version</change>
</changelog>

</snippet>
<?xml version="1.0"?>
<!--
$RCSfile: $
last change: $Revision: $ $Author: $ $Date: $

(c)2003 by the copyright holders listed with the author-tags.
If no explicit copyright holder is mentioned with a certain author,
the author him-/herself is the copyright holder. All rights reserved.

Public Documentation License Notice:

The contents of this Documentation are subject to the
Public Documentation License Version 1.0 (the "License");
you may only use this Documentation if you comply with
the terms of this License. A copy of the License is
available at http://www.openoffice.org/licenses/PDL.html

The Original Documentation can be found in the CVS archives
of openoffice.org at the place specified by RCSfile: in this header.

The Initial Writer(s) of the Original Documentation are listed
with the author-tags below.

The Contributor(s) are listed with the author-tags below
without the marker for being an initial author.

All Rights Reserved.
-->

<snippet language="Cpp" application="">

<keywords>
	<keyword>Sequence</keyword>
	<keyword>Sequences</keyword>
	<keyword>iterate</keyword>
	<keyword>iteration</keyword>
</keywords>

<authors>
	<author id="pagalmes" initial="true" email="[EMAIL PROTECTED]" copyright="StarXpert">Pierre-Andr&#233; Galmes</author>
</authors>

<question heading="Iterate over a Sequence">How to iterate over the content of a Sequence ?
</question>

<answer>
<p>Use the following routine :</p>
<listing>// Get a sequence.
Sequence&lt; ::rtl::OUString &gt; sq = 
rxOfficeServiceManager-&gt;getAvailableServiceNames();

// Set some variables on the beginning and the end of the sequence.
rtl::OString aOString;
const ::rtl::OUString* sIterator = sq.getConstArray();
const ::rtl::OUString* sEnd = sIterator + sq.getLength();

// Iterate and display the result.
for ( ; sIterator != sEnd ; ++sIterator)
{
        aOString = ::rtl::OUStringToOString ( *sIterator, RTL_TEXTENCODING_UTF8 );
        cout &lt;&lt; &quot;sq : &quot; &lt;&lt;  aOString &lt;&lt; endl;
}</listing>
</answer>

<versions>
	<version number="2.0.x" status="tested"/>
</versions>

<operating-systems>
<operating-system name="All"/>
</operating-systems>

<changelog>
	<change author-id="pagalmes" date="2005-09-13">Initial version</change>
</changelog>

</snippet>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to