From 2a7470e98630673d7eacf0fa8d65be9a47bc6ea0 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Tue, 2 Jun 2009 23:32:58 +0300 Subject: [PATCH] Changed EOL character to LF in a few files. --- gui/applicationdialog.h | 42 +++---- gui/applicationlist.h | 120 +++++++++---------- gui/common.h | 6 +- gui/settingsdialog.h | 42 +++---- src/mathlib.cpp | 258 ++++++++++++++++++++-------------------- src/mathlib.h | 88 +++++++------- 6 files changed, 278 insertions(+), 278 deletions(-) diff --git a/gui/applicationdialog.h b/gui/applicationdialog.h index 60488d050..bb4ef4d38 100644 --- a/gui/applicationdialog.h +++ b/gui/applicationdialog.h @@ -22,34 +22,34 @@ #include #include -/** +/** * @brief Dialog to edit a startable application. * User can open errors with user specified applications. This is a dialog -* to modify/add an application to open errors with. -* +* to modify/add an application to open errors with. +* */ class ApplicationDialog : public QDialog { Q_OBJECT public: - /** - * @brief Constructor - * - * @param name Default name for the application to start + /** + * @brief Constructor + * + * @param name Default name for the application to start * @param path Path for the application - * @param title Title for the dialog + * @param title Title for the dialog */ ApplicationDialog(const QString &name, const QString &path, const QString &title); virtual ~ApplicationDialog(); - /** - * @brief Get modified name + /** + * @brief Get modified name * This is just a name to display the application. This has nothing to do * with executing the application. - * - * @return Modified name + * + * @return Modified name */ QString GetName(); @@ -62,22 +62,22 @@ public: protected slots: void Ok(); - /** - * @brief Slot to browse for an application - * + /** + * @brief Slot to browse for an application + * */ void Browse(); protected: - /** - * @brief Editbox for the application's name + /** + * @brief Editbox for the application's name * This is just a name to display the application. This has nothing to do - * with executing the application. + * with executing the application. */ QLineEdit *mName; - /** - * @brief Editbox for the application's path - * This also contains all parameters user wants to specify. + /** + * @brief Editbox for the application's path + * This also contains all parameters user wants to specify. */ QLineEdit *mPath; private: diff --git a/gui/applicationlist.h b/gui/applicationlist.h index 5a2970299..ed1edfd15 100644 --- a/gui/applicationlist.h +++ b/gui/applicationlist.h @@ -23,8 +23,8 @@ #include -/** -* @brief List of applications user has specified to open errors with +/** +* @brief List of applications user has specified to open errors with * Each application has a name and a path. Name is displayed to the user * and has no other meaning. It isn't used to start the application. * Path contains the path to the application as well as the executable itself and @@ -39,27 +39,27 @@ * * Example opening a file with Kate and make Kate scroll to the corret line: * kate -l(line) (file) -* +* */ class ApplicationList : public QObject { public: - /** - * @brief Struct containing information of the application - * + /** + * @brief Struct containing information of the application + * */ typedef struct { - /** - * @brief Applicaton's name - * + /** + * @brief Applicaton's name + * */ QString Name; - /** - * @brief Application's path and commandline arguments - * + /** + * @brief Application's path and commandline arguments + * */ QString Path; }ApplicationType; @@ -67,93 +67,93 @@ public: ApplicationList(); virtual ~ApplicationList(); - /** - * @brief Load all applications - * - * @param programSettings QSettings to load application list from + /** + * @brief Load all applications + * + * @param programSettings QSettings to load application list from */ void LoadSettings(QSettings &programSettings); - /** - * @brief Save all applications - * @param programSettings QSettings to save applications to + /** + * @brief Save all applications + * @param programSettings QSettings to save applications to */ void SaveSettings(QSettings &programSettings); - /** - * @brief Get the amount of applications in the list - * @return The count of applications + /** + * @brief Get the amount of applications in the list + * @return The count of applications */ int GetApplicationCount(); - /** - * @brief Get spesific application's name - * - * @param index Index of the application whose name to get - * @return Name of the application + /** + * @brief Get spesific application's name + * + * @param index Index of the application whose name to get + * @return Name of the application */ QString GetApplicationName(const int index); - /** - * @brief Get Application's path - * - * @param index of the application whose path to get - * @return Application's path + /** + * @brief Get Application's path + * + * @param index of the application whose path to get + * @return Application's path */ QString GetApplicationPath(const int index); - /** - * @brief Modify an application - * - * @param index Index of the application to modify + /** + * @brief Modify an application + * + * @param index Index of the application to modify * @param name New name for the application - * @param path New path for the application + * @param path New path for the application */ void SetApplicationType(const int index, const QString &name, const QString &path); - /** - * @brief Add a new application - * - * @param name Name of the application - * @param path Path to the application + /** + * @brief Add a new application + * + * @param name Name of the application + * @param path Path to the application */ void AddApplicationType(const QString &name, const QString &path); - /** - * @brief Remove an application from the list - * - * @param index Index of the application to remove. + /** + * @brief Remove an application from the list + * + * @param index Index of the application to remove. */ void RemoveApplication(const int index); - /** + /** * @brief Move certain application as first. * Position of the application is used by the application to determine * which of the applications is the default application. First application - * (index 0) is the default application. - * - * @param index Index of the application to make the default one + * (index 0) is the default application. + * + * @param index Index of the application to make the default one */ void MoveFirst(const int index); - /** - * @brief Remove all applications from this list and copy all applications from - * list given as a parameter. - * @param list Copying source + /** + * @brief Remove all applications from this list and copy all applications from + * list given as a parameter. + * @param list Copying source */ void Copy(ApplicationList &list); protected: - /** - * @brief Clear the list - * + /** + * @brief Clear the list + * */ void Clear(); - /** - * @brief List of applications - * + /** + * @brief List of applications + * */ QList mApplications; private: diff --git a/gui/common.h b/gui/common.h index d8b0105c8..6b66617df 100644 --- a/gui/common.h +++ b/gui/common.h @@ -19,9 +19,9 @@ #ifndef COMMON_H #define COMMON_H -/** -* @brief List of error types to show -* +/** +* @brief List of error types to show +* */ typedef enum { diff --git a/gui/settingsdialog.h b/gui/settingsdialog.h index fcf327866..4dce226d8 100644 --- a/gui/settingsdialog.h +++ b/gui/settingsdialog.h @@ -44,22 +44,22 @@ public: SettingsDialog(QSettings &programSettings, ApplicationList &list); virtual ~SettingsDialog(); - /** - * @brief Save all values to QSettings - * + /** + * @brief Save all values to QSettings + * */ void SaveCheckboxValues(); protected slots: - /** - * @brief Slot for clicking OK. - * + /** + * @brief Slot for clicking OK. + * */ void Ok(); - /** - * @brief Slot for adding a new application to the list - * + /** + * @brief Slot for adding a new application to the list + * */ void AddApplication(); @@ -82,9 +82,9 @@ protected slots: void DefaultApplication(); protected: - /** - * @brief Clear all applications from the list and re insert them from mTempApplications - * + /** + * @brief Clear all applications from the list and re insert them from mTempApplications + * */ void PopulateListWidget(); @@ -152,9 +152,9 @@ protected: */ QCheckBox *mForce; - /** - * @brief List of all applications that can be started when right clicking - * an error + /** + * @brief List of all applications that can be started when right clicking + * an error */ QListWidget *mListWidget; @@ -165,16 +165,16 @@ protected: */ QSettings &mSettings; - /** - * @brief List of applications user has specified - * + /** + * @brief List of applications user has specified + * */ ApplicationList &mApplications; - /** - * @brief Temporary list of applications + /** + * @brief Temporary list of applications * This will be copied to actual list of applications (mApplications) - * when user clicks ok. + * when user clicks ok. */ ApplicationList mTempApplications; private: diff --git a/src/mathlib.cpp b/src/mathlib.cpp index 8b4543f73..63696591d 100644 --- a/src/mathlib.cpp +++ b/src/mathlib.cpp @@ -1,132 +1,132 @@ /* * Cppcheck - A tool for static C/C++ code analysis * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see -#include -#include -#include -#include -#include -#include - -long MathLib::toLongNumber(const std::string &str) -{ - if (strncmp(str.c_str(), "0x", 2) == 0) - { - return strtoul(str.c_str(), '\0', 16); - } - if (strncmp(str.c_str(), "0", 1) == 0) - { - return strtoul(str.c_str(), '\0', 8); - } - return atol(str.c_str()); -} - -double MathLib::toDoubleNumber(const std::string &str) -{ - return atof(str.c_str()); -} - -template -std::string MathLib::toString(T d) -{ - std::ostringstream result; - result << d; - return result.str(); -} - -bool MathLib::isInt(const std::string & str) -{ - if (str.find(".", 0) != std::string::npos || str.find("e", 0) != std::string::npos - || str.find("E", 0) != std::string::npos) - { - return false; - } - return true; -} - -std::string MathLib::add(const std::string & first, const std::string & second) -{ - if (MathLib::isInt(first) && MathLib::isInt(second)) - { - return toString(toLongNumber(first) + toLongNumber(second)); - } - return toString(toDoubleNumber(first) + toDoubleNumber(second)); -} - -std::string MathLib::subtract(const std::string &first, const std::string &second) -{ - if (MathLib::isInt(first) && MathLib::isInt(second)) - { - return toString(toLongNumber(first) - toLongNumber(second)); - } - return toString(toDoubleNumber(first) - toDoubleNumber(second)); -} - -std::string MathLib::divide(const std::string &first, const std::string &second) -{ - if (MathLib::isInt(first) && MathLib::isInt(second)) - { - return toString(toLongNumber(first) / toLongNumber(second)); - } - return toString(toDoubleNumber(first) / toDoubleNumber(second)); -} - -std::string MathLib::multiply(const std::string &first, const std::string &second) -{ - if (MathLib::isInt(first) && MathLib::isInt(second)) - { - return toString(toLongNumber(first) * toLongNumber(second)); - } - return toString(toDoubleNumber(first) * toDoubleNumber(second)); -} - - -std::string MathLib::sin(const std::string &tok) -{ - return toString(::sin(toDoubleNumber(tok))); -} - - -std::string MathLib::cos(const std::string &tok) -{ - return toString(::cos(toDoubleNumber(tok))); -} - -std::string MathLib::tan(const std::string &tok) -{ - return toString(::tan(toDoubleNumber(tok))); -} - - -std::string MathLib::abs(const std::string &tok) -{ - return toString(::abs(toDoubleNumber(tok))); -} - -bool MathLib::isGreater(const std::string &first, const std::string &second) -{ - return toDoubleNumber(first) > toDoubleNumber(second); -} - - + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see +#include +#include +#include +#include +#include +#include + +long MathLib::toLongNumber(const std::string &str) +{ + if (strncmp(str.c_str(), "0x", 2) == 0) + { + return strtoul(str.c_str(), '\0', 16); + } + if (strncmp(str.c_str(), "0", 1) == 0) + { + return strtoul(str.c_str(), '\0', 8); + } + return atol(str.c_str()); +} + +double MathLib::toDoubleNumber(const std::string &str) +{ + return atof(str.c_str()); +} + +template +std::string MathLib::toString(T d) +{ + std::ostringstream result; + result << d; + return result.str(); +} + +bool MathLib::isInt(const std::string & str) +{ + if (str.find(".", 0) != std::string::npos || str.find("e", 0) != std::string::npos + || str.find("E", 0) != std::string::npos) + { + return false; + } + return true; +} + +std::string MathLib::add(const std::string & first, const std::string & second) +{ + if (MathLib::isInt(first) && MathLib::isInt(second)) + { + return toString(toLongNumber(first) + toLongNumber(second)); + } + return toString(toDoubleNumber(first) + toDoubleNumber(second)); +} + +std::string MathLib::subtract(const std::string &first, const std::string &second) +{ + if (MathLib::isInt(first) && MathLib::isInt(second)) + { + return toString(toLongNumber(first) - toLongNumber(second)); + } + return toString(toDoubleNumber(first) - toDoubleNumber(second)); +} + +std::string MathLib::divide(const std::string &first, const std::string &second) +{ + if (MathLib::isInt(first) && MathLib::isInt(second)) + { + return toString(toLongNumber(first) / toLongNumber(second)); + } + return toString(toDoubleNumber(first) / toDoubleNumber(second)); +} + +std::string MathLib::multiply(const std::string &first, const std::string &second) +{ + if (MathLib::isInt(first) && MathLib::isInt(second)) + { + return toString(toLongNumber(first) * toLongNumber(second)); + } + return toString(toDoubleNumber(first) * toDoubleNumber(second)); +} + + +std::string MathLib::sin(const std::string &tok) +{ + return toString(::sin(toDoubleNumber(tok))); +} + + +std::string MathLib::cos(const std::string &tok) +{ + return toString(::cos(toDoubleNumber(tok))); +} + +std::string MathLib::tan(const std::string &tok) +{ + return toString(::tan(toDoubleNumber(tok))); +} + + +std::string MathLib::abs(const std::string &tok) +{ + return toString(::abs(toDoubleNumber(tok))); +} + +bool MathLib::isGreater(const std::string &first, const std::string &second) +{ + return toDoubleNumber(first) > toDoubleNumber(second); +} + + diff --git a/src/mathlib.h b/src/mathlib.h index b9bd1e9a1..706381d3a 100644 --- a/src/mathlib.h +++ b/src/mathlib.h @@ -1,47 +1,47 @@ /* * Cppcheck - A tool for static C/C++ code analysis * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - static std::string toString(T d); - - static bool isInt(const std::string & str); - - static std::string add(const std::string & first, const std::string & second); - static std::string subtract(const std::string & first, const std::string & second); - static std::string multiply(const std::string & first, const std::string & second); - static std::string divide(const std::string & first, const std::string & second); - static std::string sin(const std::string & tok); - static std::string cos(const std::string & tok); - static std::string tan(const std::string & tok); - static std::string abs(const std::string & tok); - static bool isGreater(const std::string & first, const std::string & second); -}; - -#endif + * + * 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. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see + static std::string toString(T d); + + static bool isInt(const std::string & str); + + static std::string add(const std::string & first, const std::string & second); + static std::string subtract(const std::string & first, const std::string & second); + static std::string multiply(const std::string & first, const std::string & second); + static std::string divide(const std::string & first, const std::string & second); + static std::string sin(const std::string & tok); + static std::string cos(const std::string & tok); + static std::string tan(const std::string & tok); + static std::string abs(const std::string & tok); + static bool isGreater(const std::string & first, const std::string & second); +}; + +#endif