mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Small refactoring
- use const and reference in fromJson - reformat code
This commit is contained in:
parent
b64f6f7568
commit
59f44e7ff2
2 changed files with 5 additions and 6 deletions
|
@ -32,7 +32,7 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Syntax:
|
// Syntax:
|
||||||
// 'inc' [ <iso> [ '-' <iso> ]] [ '#' <tag> [ <tag> ... ]]
|
// 'inc' [ <iso> [ '-' <iso> ]] [ '#' <tag> [ <tag> ... ]]
|
||||||
Interval IntervalFactory::fromSerialization (const std::string &line)
|
Interval IntervalFactory::fromSerialization (const std::string& line)
|
||||||
{
|
{
|
||||||
Lexer lexer (line);
|
Lexer lexer (line);
|
||||||
std::vector <std::string> tokens;
|
std::vector <std::string> tokens;
|
||||||
|
@ -45,8 +45,7 @@ Interval IntervalFactory::fromSerialization (const std::string &line)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Minimal requirement 'inc'.
|
// Minimal requirement 'inc'.
|
||||||
if (!tokens.empty () &&
|
if (!tokens.empty () && tokens[0] == "inc")
|
||||||
tokens[0] == "inc")
|
|
||||||
{
|
{
|
||||||
Interval interval = Interval ();
|
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 ();
|
Interval interval = Interval ();
|
||||||
|
|
||||||
|
|
|
@ -33,8 +33,8 @@
|
||||||
class IntervalFactory
|
class IntervalFactory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Interval fromSerialization (const std::string &line);
|
static Interval fromSerialization (const std::string& line);
|
||||||
static Interval fromJson (std::string jsonString);
|
static Interval fromJson (const std::string& jsonString);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue