From 59f44e7ff217a29648f88cfa8f1400107a2ec54f Mon Sep 17 00:00:00 2001 From: Thomas Lauf Date: Fri, 5 Oct 2018 18:31:35 +0200 Subject: [PATCH] Small refactoring - use const and reference in fromJson - reformat code --- src/IntervalFactory.cpp | 7 +++---- src/IntervalFactory.h | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/IntervalFactory.cpp b/src/IntervalFactory.cpp index 11ad5d3d..5f7980a1 100644 --- a/src/IntervalFactory.cpp +++ b/src/IntervalFactory.cpp @@ -32,7 +32,7 @@ //////////////////////////////////////////////////////////////////////////////// // Syntax: // 'inc' [ [ '-' ]] [ '#' [ ... ]] -Interval IntervalFactory::fromSerialization (const std::string &line) +Interval IntervalFactory::fromSerialization (const std::string& line) { Lexer lexer (line); std::vector tokens; @@ -45,8 +45,7 @@ Interval IntervalFactory::fromSerialization (const std::string &line) } // Minimal requirement 'inc'. - if (!tokens.empty () && - tokens[0] == "inc") + if (!tokens.empty () && tokens[0] == "inc") { Interval interval = Interval (); @@ -85,7 +84,7 @@ Interval IntervalFactory::fromSerialization (const std::string &line) } //////////////////////////////////////////////////////////////////////////////// -Interval IntervalFactory::fromJson (std::string jsonString) +Interval IntervalFactory::fromJson (const std::string& jsonString) { Interval interval = Interval (); diff --git a/src/IntervalFactory.h b/src/IntervalFactory.h index efa2e231..02aa6580 100644 --- a/src/IntervalFactory.h +++ b/src/IntervalFactory.h @@ -33,8 +33,8 @@ class IntervalFactory { public: - static Interval fromSerialization (const std::string &line); - static Interval fromJson (std::string jsonString); + static Interval fromSerialization (const std::string& line); + static Interval fromJson (const std::string& jsonString); }; #endif