File: README-qstring-ref.md

package info (click to toggle)
clazy 1.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 5,248 kB
  • sloc: cpp: 23,552; python: 1,450; xml: 450; sh: 237; makefile: 46
file content (16 lines) | stat: -rw-r--r-- 543 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# qstring-ref

Finds places where `QString::fooRef()` should be used instead of `QString::foo()`, to avoid temporary heap allocations.

#### Example

    str.mid(5).toInt(ok) // BAD

    str.midRef(5).toInt(ok) // GOOD

Where `mid` can be any of: `mid`, `left`, `right`.
And `toInt()` can be any of: `compare`, `contains`, `count`, `startsWith`, `endsWith`, `indexOf`, `isEmpty`, `isNull`, `lastIndexOf`, `length`, `size`, `to*`, `trimmed`

#### FixIts

This check supports a fixit to rewrite your code. See the README.md on how to enable it.