Revision control

Copy as Markdown

<svg
viewBox="-410 -30 540 470"
version="1.1"
<style>
svg path.node { fill: inherit; stroke: inherit; }
svg .node-style { fill: #56E59D; stroke: #333333; }
svg #footnotes { fill: #333333; }
svg #arrow-tip { fill: #333333; }
svg .arrow-style { stroke: #333333; }
svg .text-style { font: 12px arial; fill: #333333; }
svg .text-style-arrows { font: 12px arial; fill: #333333; }
svg .small-style { font: 8px arial; fill: #333333; }
svg.dark .node-style { fill: #1A8550; stroke: #F2F2F2; }
svg.dark #footnotes { fill: #F2F2F2; }
svg.dark #arrow-tip { fill: #F2F2F2; }
svg.dark .arrow-style { stroke: #F2F2F2; }
svg.dark .text-style { font: 12px arial; fill: #F2F2F2; }
svg.dark .text-style-arrows { font: 12px arial; fill: #F2F2F2; }
svg.dark .small-style { font: 8px arial; fill: #F2F2F2; }
[data-theme="dark"] svg .node-style { fill: #1A8550; stroke: #F2F2F2; }
[data-theme="dark"] svg #footnotes { fill: #F2F2F2; }
[data-theme="dark"] svg #arrow-tip { fill: #F2F2F2; }
[data-theme="dark"] svg .arrow-style { stroke: #F2F2F2; }
[data-theme="dark"] svg .text-style { font: 12px arial; fill: #F2F2F2; }
[data-theme="dark"] svg .text-style-arrows { font: 12px arial; fill: #F2F2F2; }
[data-theme="dark"] svg .small-style { font: 8px arial; fill: #F2F2F2; }
[data-theme="light"] svg .node-style { fill: #56E59D; stroke: #333333; }
[data-theme="light"] svg #footnotes { fill: #333333; }
[data-theme="light"] svg #arrow-tip { fill: #333333; }
[data-theme="light"] svg .arrow-style { stroke: #333333; }
[data-theme="light"] svg .text-style { font: 12px arial; fill: #333333; }
[data-theme="light"] svg .text-style-arrows { font: 12px arial; fill: #333333; }
[data-theme="light"] svg .small-style { font: 8px arial; fill: #333333; }
</style>
<defs>
<path id="raute" class="node"
stroke-width="1px"
d="m 0 -40 L 80 0 L 0 40 L -80 0 z" />
<path id="lozenge" class="node"
stroke-width="1px"
d="M -60,-20
h 120
a 20,20 0 0 1 20,20
v 0
a 20,20 0 0 1 -20,20
h -120
a 20,20 0 0 1 -20,-20
v 0
a 20,20 0 0 1 20,-20
Z"/>
<path id="lozenge_small" class="node"
stroke-width="1px"
d="M -40,-20
h 80
a 20,20 0 0 1 20,20
v 0
a 20,20 0 0 1 -20,20
h -80
a 20,20 0 0 1 -20,-20
v 0
a 20,20 0 0 1 20,-20
Z"/>
<marker
id="triangle"
viewBox="0 0 10 10"
refX="1"
refY="5"
markerUnits="strokeWidth"
markerWidth="10"
markerHeight="10"
orient="auto">
<path id="arrow-tip" d="M 0 0 L 10 5 L 0 10 z" fill="#333333" />
</marker>
</defs>
<g id="start" transform="translate(-160, 0)">
<use class="node-style" href="#lozenge" fill="#56E59D" stroke="#333333" />
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="-3"
class="text-style">Choosing a string class</text>
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="11"
class="text-style">for creating an API</text>
</g>
<g id="param_or_return" transform="translate(-160, 100)">
<use class="node-style" href="#raute" fill="#56E59D" stroke="#333333" />
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="-4" class="text-style">For a parameter</text>
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="10" class="text-style">or the return value?</text>
</g>
<g id="make_copy" transform="translate(-320, 200)">
<use class="node-style" href="#raute" fill="#56E59D" stroke="#333333" />
<text font-size="12px" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="-4" class="text-style">Will you make</text>
<text font-size="12px" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="10" class="text-style">a persistent copy?</text>
</g>
<g id="ref_or_perm" transform="translate(40, 200)">
<use class="node-style" href="#raute" fill="#56E59D" stroke="#333333" />
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="-10" class="text-style">Reference to</text>
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="4" class="text-style">permanent or</text>
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="18" class="text-style">temporary?</text>
</g>
<g id="make_copy" transform="translate(-80, 300)">
<use class="node-style" href="#raute" fill="#56E59D" stroke="#333333" />
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="-2" class="text-style">Reference to full</text>
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="12" class="text-style">or part?</text>
</g>
<g id="const_ref" transform="translate(-320, 300)">
<use class="node-style" href="#lozenge" fill="#56E59D" stroke="#333333" />
<text
font-size="12" font-family="arial" fill="#333333"
text-anchor="middle"
x="0" y="3" class="text-style">const QString&amp;¹</text>
</g>
<g id="anystringview" transform="translate(-200, 380)">
<use class="node-style" href="#lozenge" fill="#56E59D" stroke="#333333" />
<text font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
x="0" y="-6" class="text-style">Q*StringView</text>
<text font-size="8" font-family="Arial" text-anchor="middle"
x="0" y="5"
class="small-style">Parameters: preferably QAnyStringView</text>
<text font-size="8" font-family="Arial" text-anchor="middle"
x="0" y="15"
class="small-style">Generally: any of L1, UTF-8, or UTF-16
</text>
</g>
<g id="anystringview" transform="translate(40, 380)">
<use class="node-style" href="#lozenge" fill="#56E59D" stroke="#333333" />
<text
font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle"
class="text-style" x="0" y="3">QString</text>
</g>
<g transform="translate(-160, 20)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l 0 30" />
</g>
<g transform="translate(-240, 100)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l -80 0 l 0 50" />
<text x="-40" y="-5"
font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle" dominant-baseline="auto"
class="text-style-arrows">
parameter
</text>
</g>
<g transform="translate(-80, 100)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l 120 0 l 0 50" />
<text x="60" y="-5"
font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle" dominant-baseline="auto"
class="text-style-arrows">
return value
</text>
</g>
<g transform="translate(-320, 240)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l 0 30" />
<text x="5" y="15"
font-size="12" font-family="Arial" fill="#333333"
text-anchor="left" dominant-baseline="middle"
class="text-style-arrows">
yes
</text>
</g>
<g transform="translate(-240, 200)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l 40 0 l 0 150" />
<text x="20" y="-5"
font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle" dominant-baseline="auto"
class="text-style-arrows">
no
</text>
</g>
<g transform="translate(-40, 200)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l -40 0 l 0 50" />
<text x="-20" y="-5"
font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle" dominant-baseline="auto"
class="text-style-arrows">
reference
</text>
</g>
<g transform="translate(-160, 300)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l -70 0" />
<text x="-20" y="-5"
font-size="12" font-family="Arial" fill="#333333"
text-anchor="middle" dominant-baseline="auto"
class="text-style-arrows">
full
</text>
</g>
<g transform="translate(-80, 340)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l 0 40 l -30 0" />
<text x="5" y="20"
font-size="12" font-family="Arial" fill="#333333"
text-anchor="left" dominant-baseline="auto"
class="text-style-arrows">
part
</text>
</g>
<g transform="translate(40, 240)">
<path
fill="none" stroke="#333333" marker-end="url(#triangle)"
class="arrow-style"
d="M 0 0 l 0 110" />
<text x="5" y="55"
font-size="12" font-family="Arial" fill="#333333"
text-anchor="left" dominant-baseline="auto"
class="text-style-arrows">
temporary
</text>
</g>
<g transform="translate(-400, 415)">
<text id="footnotes" x="5" y="5"
font-size="9" font-family="Arial" fill="#333333"
text-anchor="left">1:</text>
<text id="footnotes" x="15" y="5"
font-size="9" font-family="Arial" fill="#333333"
text-anchor="left">If you return a QString in full, you can choose
to return a value instead of a reference, allowing you to return a
temporary in the</text>
<text id="footnotes" x="15" y="15"
font-size="9" font-family="Arial" fill="#333333"
text-anchor="left">future without breaking source code compatibility.
This is also done for all Qt APIs.</text>
</g>
</svg>