aboutsummaryrefslogtreecommitdiffstats
path: root/examples/samplebinding/icecream.h
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2022-03-17 14:16:33 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2022-03-21 16:15:35 +0100
commitc3c692d26e2d6976afa226a3f49e1745e94712e7 (patch)
tree2ecb64587c5a2250b9c3f6f95cff1f068c2e0970 /examples/samplebinding/icecream.h
parentec7ad296f48f3f1856c3eb7cc3685249a096d6b8 (diff)
Polish the samplebinding example
- Use a std::shared_ptr for internal storage. - Simplify copy and assignment. - Fix constness of the flavor accessor - Add ostream operator to IceCream Pick-to: 6.2 Change-Id: I814fa14095cbb96ab5642735e16b8b50101d4771 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/samplebinding/icecream.h')
-rw-r--r--examples/samplebinding/icecream.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/examples/samplebinding/icecream.h b/examples/samplebinding/icecream.h
index 1997fdc49..7c1d1cbdb 100644
--- a/examples/samplebinding/icecream.h
+++ b/examples/samplebinding/icecream.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2018 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt for Python examples of the Qt Toolkit.
@@ -51,21 +51,23 @@
#ifndef ICECREAM_H
#define ICECREAM_H
-#include <string>
-
#include "macros.h"
+#include <iosfwd>
+#include <string>
+
class BINDINGS_API Icecream
{
public:
- Icecream(const std::string &flavor);
+ explicit Icecream(const std::string &flavor);
virtual Icecream *clone();
virtual ~Icecream();
- virtual const std::string getFlavor();
+ virtual std::string getFlavor() const;
private:
std::string m_flavor;
};
+std::ostream &operator<<(std::ostream &str, const Icecream &i);
#endif // ICECREAM_H