MailImporter

mailimporter_utils.h
1 /*
2  SPDX-FileCopyrightText: 2012-2020 Laurent Montel <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef MAILIMPORTER_UTILS_H
8 #define MAILIMPORTER_UTILS_H
9 
10 #include <QString>
11 
12 namespace MailImporter {
16 template<unsigned int size> class FolderStructureBase
17 {
18 public:
19  typedef QString NString[size];
22  {
23  }
24 
28  FolderStructureBase(const NString &s)
29  {
30  for (unsigned int i = 0; i < size; i++) {
31  d[i] = s[i];
32  }
33  }
34 
37  {
38  for (unsigned int i = 0; i < size; i++) {
39  d[i] = s[i];
40  }
41  }
42 
47  {
48  for (unsigned int i = 0; i < size; i++) {
49  d[i] = s[i];
50  }
51  return *this;
52  }
53 
57  const QString operator [](unsigned int i) const
58  {
59  if (i < size) {
60  return d[i];
61  } else {
62  return QString();
63  }
64  }
65 
67  QString &operator [](unsigned int i)
68  {
69  Q_ASSERT(i < size);
70  if (i < size) {
71  return d[i];
72  } else {
73  return d[0];
74  }
75  }
76 
77 private:
78  QString d[size];
79 };
80 }
81 
82 #endif /* MAILIMPORTER_UTILS_H */
FolderStructureBase & operator=(const FolderStructureBase &s)
Assignment operator.
FolderStructureBase(const FolderStructureBase &s)
Copy Constructor.
const QString operator[](unsigned int i) const
Access the different fields.
FolderStructureBase(const NString &s)
Constructor.
Glorified QString[N] for (a) understandability (b) older gcc compatibility.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Sep 21 2020 23:16:37 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.