Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
doc_src_qcache.cpp
Go to the documentation of this file.
1
// Copyright (C) 2016 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
3
4
#
include
<
QCache
>
5
6
struct
Employee
{
7
void
setId
(
int
id);
8
int
id
()
const
{
return
0; }
9
void
setName
(
const
QString &name);
10
};
11
12
struct
MyDataStructure
{ };
13
14
void
example
()
15
{
16
//! [0]
17
QCache<
int
, Employee> cache;
18
//! [0]
19
20
21
//! [1]
22
Employee
*employee =
new
Employee
;
23
employee
->
setId
(
37
)
;
24
employee->setName(
"Richard Schmit"
);
25
//...
26
cache.insert(employee
->
id
(
)
, employee);
27
//! [1]
28
29
{
30
//! [2]
31
QCache<
int
, MyDataStructure> cache(5000);
32
//! [2]
33
}
34
}
Employee
[0]
Definition
doc_src_containers.cpp:10
Employee::id
int id() const
Definition
doc_src_qcache.cpp:8
Employee::setName
void setName(const QString &name)
Employee::setId
void setId(int id)
example
void example()
[5]
Definition
doc_src_groups.cpp:7
MyDataStructure
Definition
doc_src_qcache.cpp:12
qtbase
src
corelib
doc
snippets
code
doc_src_qcache.cpp
Generated on
for Qt by
1.14.0