Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
utility: created for base file name function
to remove dependency from the command line class of Qt, the base file name function was moved into a new utility class where only its source file needs to include Qt headers, which releases any callers of its member functions from having to include them (the class itself was made so that it can't be instanced or used as a base class) to remove dependency from the tester class of the command line class, the copyright statement string is now passed into the run function as a standard string
- Loading branch information
1 parent
c998b1f
commit 3020cd6
Showing
7 changed files
with
84 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// vim:ts=4:sw=4: | ||
// | ||
// Interactive BASIC Compiler Project | ||
// File: utility.cpp - utility class source file | ||
// Copyright (C) 2014 Thunder422 | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// For a copy of the GNU General Public License, | ||
// see <http://www.gnu.org/licenses/>. | ||
// | ||
// | ||
// Change History: | ||
// | ||
// 2014-10-18 initial version (parts removed from commandline.cpp) | ||
|
||
#include <QFileInfo> | ||
|
||
#include "utility.h" | ||
|
||
|
||
// function to retrieve a base file name from a file path string | ||
std::string Utility::baseFileName(const std::string &filePath) | ||
{ | ||
return QFileInfo(filePath.c_str()).baseName().toStdString(); | ||
} | ||
|
||
|
||
// end: utility.cpp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// vim:ts=4:sw=4: | ||
// | ||
// Interactive BASIC Compiler Project | ||
// File: utility.h - utility class header file | ||
// Copyright (C) 2014 | ||
// | ||
// This program is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
// | ||
// This program is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
// | ||
// For a copy of the GNU General Public License, | ||
// see <http://www.gnu.org/licenses/>. | ||
// | ||
// | ||
// Change History: | ||
// | ||
// 2014-10-18 initial version (parts removed from commandline.h) | ||
|
||
#ifndef UTILITY_H | ||
#define UTILITY_H | ||
|
||
#include <string> | ||
|
||
|
||
class Utility final // final prevents derived classes | ||
{ | ||
Utility() = delete; // prevent instances; | ||
public: | ||
static std::string baseFileName(const std::string &filePath); | ||
}; | ||
|
||
#endif // UTILITY_H |