Skip to content
Permalink
Browse files

Automated cleanups for passing by reference and fixing pointer owners…

…hip on calls.
  • Loading branch information...
gpsbabel committed Dec 3, 2018
1 parent 9215cea commit 409f64dbd53263344b35eb3c1c81d285967af2ad
Showing with 20 additions and 16 deletions.
  1. +4 −2 csv_util.h
  2. +12 −12 defs.h
  3. +2 −1 inifile.cc
  4. +2 −1 session.h
@@ -22,6 +22,7 @@
#include "defs.h"
#include <QtCore/QStringList>
class QTextStream;
#include <utility>

/* function prototypes */

@@ -91,8 +92,9 @@ struct field_map {
unsigned options{0};

field_map() = default;
field_map(const QByteArray& k, const QByteArray& v, const QByteArray& p, int hk) : key{k},val{v},printfc{p},hashed_key{hk} {}
field_map(const QByteArray& k, const QByteArray& v, const QByteArray& p, int hk, unsigned o) : key{k},val{v},printfc{p},hashed_key{hk},options{o} {}
field_map(QByteArray k, QByteArray v, QByteArray p, int hk) : key{std::move(k)},val{std::move(v)},printfc{std::move(p)},hashed_key{hk} {}
field_map(QByteArray k, QByteArray v, QByteArray p, int hk, unsigned o) : key{std::move(k)},val{std::move(v)},printfc{
std::move(p)},hashed_key{hk},options{o} {}
};

/* something to map config file constants to chars */
24 defs.h
@@ -35,7 +35,7 @@
#include "session.h"

#include <QtCore/QString>

#include <utility>
#include "src/core/datetime.h"
#include "src/core/optional.h"

@@ -246,9 +246,9 @@ class utf_string
{
public:
utf_string() = default;
utf_string(bool html, const QString& str) :
utf_string(bool html, QString str) :
is_html{html},
utfstring{str}
utfstring{std::move(str)}
{}
bool is_html{false};
QString utfstring;
@@ -332,20 +332,20 @@ class UrlLink
{
public:
UrlLink() = default;
UrlLink(const QString& url) :
url_(url)
UrlLink(QString url) :
url_(std::move(url))
{ }
UrlLink(const char* url) :
url_(url)
{ }
UrlLink(const QString& url, const QString& url_link_text) :
url_(url),
url_link_text_(url_link_text)
UrlLink(QString url, QString url_link_text) :
url_(std::move(url)),
url_link_text_(std::move(url_link_text))
{ }
UrlLink(const QString& url, const QString& url_link_text, const QString& url_link_type) :
url_(url),
url_link_text_(url_link_text),
url_link_type_(url_link_type)
UrlLink(QString url, QString url_link_text, QString url_link_type) :
url_(std::move(url)),
url_link_text_(std::move(url_link_text)),
url_link_type_(std::move(url_link_type))
{ }
QString url_;
QString url_link_text_;
@@ -31,6 +31,7 @@
#include <QtCore/QTextStream> // for QTextStream
#include <QtCore/Qt> // for CaseInsensitive
#include <QtCore/QtGlobal> // for qPrintable
#include <utility>

#define MYNAME "inifile"

@@ -41,7 +42,7 @@ class InifileSection
QHash<QString, QString> entries;

InifileSection() = default;
explicit InifileSection(QString nm) : name{nm} {}
explicit InifileSection(QString nm) : name{std::move(nm)} {}
};

/* internal procedures */
@@ -23,14 +23,15 @@
#define SESSION_H_INCLUDED_

#include <QtCore/QString> // for QString
#include <utility>

struct session_t {
public:
QString name; /* in normal case the name of a format */
QString filename; /* used file within format */

public:
session_t(const QString& name_p, const QString& filename_p) : name{name_p},filename{filename_p} {}
session_t(QString name_p, QString filename_p) : name{std::move(name_p)},filename{std::move(filename_p)} {}
};

void session_init();

0 comments on commit 409f64d

Please sign in to comment.
You can’t perform that action at this time.