Changed EOL character to LF in a few files.

This commit is contained in:
Reijo Tomperi 2009-06-02 23:32:58 +03:00
parent 5ca3ba59d5
commit 2a7470e986
6 changed files with 278 additions and 278 deletions

View File

@ -22,34 +22,34 @@
#include <QDialog> #include <QDialog>
#include <QLineEdit> #include <QLineEdit>
/** /**
* @brief Dialog to edit a startable application. * @brief Dialog to edit a startable application.
* User can open errors with user specified applications. This is a dialog * 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 class ApplicationDialog : public QDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
/** /**
* @brief Constructor * @brief Constructor
* *
* @param name Default name for the application to start * @param name Default name for the application to start
* @param path Path for the application * @param path Path for the application
* @param title Title for the dialog * @param title Title for the dialog
*/ */
ApplicationDialog(const QString &name, ApplicationDialog(const QString &name,
const QString &path, const QString &path,
const QString &title); const QString &title);
virtual ~ApplicationDialog(); virtual ~ApplicationDialog();
/** /**
* @brief Get modified name * @brief Get modified name
* This is just a name to display the application. This has nothing to do * This is just a name to display the application. This has nothing to do
* with executing the application. * with executing the application.
* *
* @return Modified name * @return Modified name
*/ */
QString GetName(); QString GetName();
@ -62,22 +62,22 @@ public:
protected slots: protected slots:
void Ok(); void Ok();
/** /**
* @brief Slot to browse for an application * @brief Slot to browse for an application
* *
*/ */
void Browse(); void Browse();
protected: 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 * This is just a name to display the application. This has nothing to do
* with executing the application. * with executing the application.
*/ */
QLineEdit *mName; QLineEdit *mName;
/** /**
* @brief Editbox for the application's path * @brief Editbox for the application's path
* This also contains all parameters user wants to specify. * This also contains all parameters user wants to specify.
*/ */
QLineEdit *mPath; QLineEdit *mPath;
private: private:

View File

@ -23,8 +23,8 @@
#include <QSettings> #include <QSettings>
/** /**
* @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 * 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. * 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 * 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: * Example opening a file with Kate and make Kate scroll to the corret line:
* kate -l(line) (file) * kate -l(line) (file)
* *
*/ */
class ApplicationList : public QObject class ApplicationList : public QObject
{ {
public: public:
/** /**
* @brief Struct containing information of the application * @brief Struct containing information of the application
* *
*/ */
typedef struct typedef struct
{ {
/** /**
* @brief Applicaton's name * @brief Applicaton's name
* *
*/ */
QString Name; QString Name;
/** /**
* @brief Application's path and commandline arguments * @brief Application's path and commandline arguments
* *
*/ */
QString Path; QString Path;
}ApplicationType; }ApplicationType;
@ -67,93 +67,93 @@ public:
ApplicationList(); ApplicationList();
virtual ~ApplicationList(); virtual ~ApplicationList();
/** /**
* @brief Load all applications * @brief Load all applications
* *
* @param programSettings QSettings to load application list from * @param programSettings QSettings to load application list from
*/ */
void LoadSettings(QSettings &programSettings); void LoadSettings(QSettings &programSettings);
/** /**
* @brief Save all applications * @brief Save all applications
* @param programSettings QSettings to save applications to * @param programSettings QSettings to save applications to
*/ */
void SaveSettings(QSettings &programSettings); void SaveSettings(QSettings &programSettings);
/** /**
* @brief Get the amount of applications in the list * @brief Get the amount of applications in the list
* @return The count of applications * @return The count of applications
*/ */
int GetApplicationCount(); int GetApplicationCount();
/** /**
* @brief Get spesific application's name * @brief Get spesific application's name
* *
* @param index Index of the application whose name to get * @param index Index of the application whose name to get
* @return Name of the application * @return Name of the application
*/ */
QString GetApplicationName(const int index); QString GetApplicationName(const int index);
/** /**
* @brief Get Application's path * @brief Get Application's path
* *
* @param index of the application whose path to get * @param index of the application whose path to get
* @return Application's path * @return Application's path
*/ */
QString GetApplicationPath(const int index); QString GetApplicationPath(const int index);
/** /**
* @brief Modify an application * @brief Modify an application
* *
* @param index Index of the application to modify * @param index Index of the application to modify
* @param name New name for the application * @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, void SetApplicationType(const int index,
const QString &name, const QString &name,
const QString &path); const QString &path);
/** /**
* @brief Add a new application * @brief Add a new application
* *
* @param name Name of the application * @param name Name of the application
* @param path Path to the application * @param path Path to the application
*/ */
void AddApplicationType(const QString &name, const QString &path); void AddApplicationType(const QString &name, const QString &path);
/** /**
* @brief Remove an application from the list * @brief Remove an application from the list
* *
* @param index Index of the application to remove. * @param index Index of the application to remove.
*/ */
void RemoveApplication(const int index); void RemoveApplication(const int index);
/** /**
* @brief Move certain application as first. * @brief Move certain application as first.
* Position of the application is used by the application to determine * Position of the application is used by the application to determine
* which of the applications is the default application. First application * which of the applications is the default application. First application
* (index 0) is the default application. * (index 0) is the default application.
* *
* @param index Index of the application to make the default one * @param index Index of the application to make the default one
*/ */
void MoveFirst(const int index); void MoveFirst(const int index);
/** /**
* @brief Remove all applications from this list and copy all applications from * @brief Remove all applications from this list and copy all applications from
* list given as a parameter. * list given as a parameter.
* @param list Copying source * @param list Copying source
*/ */
void Copy(ApplicationList &list); void Copy(ApplicationList &list);
protected: protected:
/** /**
* @brief Clear the list * @brief Clear the list
* *
*/ */
void Clear(); void Clear();
/** /**
* @brief List of applications * @brief List of applications
* *
*/ */
QList<ApplicationType> mApplications; QList<ApplicationType> mApplications;
private: private:

View File

@ -19,9 +19,9 @@
#ifndef COMMON_H #ifndef COMMON_H
#define COMMON_H #define COMMON_H
/** /**
* @brief List of error types to show * @brief List of error types to show
* *
*/ */
typedef enum typedef enum
{ {

View File

@ -44,22 +44,22 @@ public:
SettingsDialog(QSettings &programSettings, ApplicationList &list); SettingsDialog(QSettings &programSettings, ApplicationList &list);
virtual ~SettingsDialog(); virtual ~SettingsDialog();
/** /**
* @brief Save all values to QSettings * @brief Save all values to QSettings
* *
*/ */
void SaveCheckboxValues(); void SaveCheckboxValues();
protected slots: protected slots:
/** /**
* @brief Slot for clicking OK. * @brief Slot for clicking OK.
* *
*/ */
void 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(); void AddApplication();
@ -82,9 +82,9 @@ protected slots:
void DefaultApplication(); void DefaultApplication();
protected: 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(); void PopulateListWidget();
@ -152,9 +152,9 @@ protected:
*/ */
QCheckBox *mForce; QCheckBox *mForce;
/** /**
* @brief List of all applications that can be started when right clicking * @brief List of all applications that can be started when right clicking
* an error * an error
*/ */
QListWidget *mListWidget; QListWidget *mListWidget;
@ -165,16 +165,16 @@ protected:
*/ */
QSettings &mSettings; QSettings &mSettings;
/** /**
* @brief List of applications user has specified * @brief List of applications user has specified
* *
*/ */
ApplicationList &mApplications; ApplicationList &mApplications;
/** /**
* @brief Temporary list of applications * @brief Temporary list of applications
* This will be copied to actual list of applications (mApplications) * This will be copied to actual list of applications (mApplications)
* when user clicks ok. * when user clicks ok.
*/ */
ApplicationList mTempApplications; ApplicationList mTempApplications;
private: private:

View File

@ -1,132 +1,132 @@
/* /*
* Cppcheck - A tool for static C/C++ code analysis * Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team.
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/ * along with this program. If not, see <http://www.gnu.org/licenses/
*/ */
#include "mathlib.h" #include "mathlib.h"
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <cstdlib> #include <cstdlib>
#include <cmath> #include <cmath>
long MathLib::toLongNumber(const std::string &str) long MathLib::toLongNumber(const std::string &str)
{ {
if (strncmp(str.c_str(), "0x", 2) == 0) if (strncmp(str.c_str(), "0x", 2) == 0)
{ {
return strtoul(str.c_str(), '\0', 16); return strtoul(str.c_str(), '\0', 16);
} }
if (strncmp(str.c_str(), "0", 1) == 0) if (strncmp(str.c_str(), "0", 1) == 0)
{ {
return strtoul(str.c_str(), '\0', 8); return strtoul(str.c_str(), '\0', 8);
} }
return atol(str.c_str()); return atol(str.c_str());
} }
double MathLib::toDoubleNumber(const std::string &str) double MathLib::toDoubleNumber(const std::string &str)
{ {
return atof(str.c_str()); return atof(str.c_str());
} }
template <typename T> template <typename T>
std::string MathLib::toString(T d) std::string MathLib::toString(T d)
{ {
std::ostringstream result; std::ostringstream result;
result << d; result << d;
return result.str(); return result.str();
} }
bool MathLib::isInt(const std::string & str) bool MathLib::isInt(const std::string & str)
{ {
if (str.find(".", 0) != std::string::npos || str.find("e", 0) != std::string::npos if (str.find(".", 0) != std::string::npos || str.find("e", 0) != std::string::npos
|| str.find("E", 0) != std::string::npos) || str.find("E", 0) != std::string::npos)
{ {
return false; return false;
} }
return true; return true;
} }
std::string MathLib::add(const std::string & first, const std::string & second) std::string MathLib::add(const std::string & first, const std::string & second)
{ {
if (MathLib::isInt(first) && MathLib::isInt(second)) if (MathLib::isInt(first) && MathLib::isInt(second))
{ {
return toString<long>(toLongNumber(first) + toLongNumber(second)); return toString<long>(toLongNumber(first) + toLongNumber(second));
} }
return toString<double>(toDoubleNumber(first) + toDoubleNumber(second)); return toString<double>(toDoubleNumber(first) + toDoubleNumber(second));
} }
std::string MathLib::subtract(const std::string &first, const std::string &second) std::string MathLib::subtract(const std::string &first, const std::string &second)
{ {
if (MathLib::isInt(first) && MathLib::isInt(second)) if (MathLib::isInt(first) && MathLib::isInt(second))
{ {
return toString<long>(toLongNumber(first) - toLongNumber(second)); return toString<long>(toLongNumber(first) - toLongNumber(second));
} }
return toString<double>(toDoubleNumber(first) - toDoubleNumber(second)); return toString<double>(toDoubleNumber(first) - toDoubleNumber(second));
} }
std::string MathLib::divide(const std::string &first, const std::string &second) std::string MathLib::divide(const std::string &first, const std::string &second)
{ {
if (MathLib::isInt(first) && MathLib::isInt(second)) if (MathLib::isInt(first) && MathLib::isInt(second))
{ {
return toString<long>(toLongNumber(first) / toLongNumber(second)); return toString<long>(toLongNumber(first) / toLongNumber(second));
} }
return toString<double>(toDoubleNumber(first) / toDoubleNumber(second)); return toString<double>(toDoubleNumber(first) / toDoubleNumber(second));
} }
std::string MathLib::multiply(const std::string &first, const std::string &second) std::string MathLib::multiply(const std::string &first, const std::string &second)
{ {
if (MathLib::isInt(first) && MathLib::isInt(second)) if (MathLib::isInt(first) && MathLib::isInt(second))
{ {
return toString<long>(toLongNumber(first) * toLongNumber(second)); return toString<long>(toLongNumber(first) * toLongNumber(second));
} }
return toString<double>(toDoubleNumber(first) * toDoubleNumber(second)); return toString<double>(toDoubleNumber(first) * toDoubleNumber(second));
} }
std::string MathLib::sin(const std::string &tok) std::string MathLib::sin(const std::string &tok)
{ {
return toString<double>(::sin(toDoubleNumber(tok))); return toString<double>(::sin(toDoubleNumber(tok)));
} }
std::string MathLib::cos(const std::string &tok) std::string MathLib::cos(const std::string &tok)
{ {
return toString<double>(::cos(toDoubleNumber(tok))); return toString<double>(::cos(toDoubleNumber(tok)));
} }
std::string MathLib::tan(const std::string &tok) std::string MathLib::tan(const std::string &tok)
{ {
return toString<double>(::tan(toDoubleNumber(tok))); return toString<double>(::tan(toDoubleNumber(tok)));
} }
std::string MathLib::abs(const std::string &tok) std::string MathLib::abs(const std::string &tok)
{ {
return toString<double>(::abs(toDoubleNumber(tok))); return toString<double>(::abs(toDoubleNumber(tok)));
} }
bool MathLib::isGreater(const std::string &first, const std::string &second) bool MathLib::isGreater(const std::string &first, const std::string &second)
{ {
return toDoubleNumber(first) > toDoubleNumber(second); return toDoubleNumber(first) > toDoubleNumber(second);
} }

View File

@ -1,47 +1,47 @@
/* /*
* Cppcheck - A tool for static C/C++ code analysis * Cppcheck - A tool for static C/C++ code analysis
* Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team. * Copyright (C) 2007-2009 Daniel Marjamäki and Cppcheck team.
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/ * along with this program. If not, see <http://www.gnu.org/licenses/
*/ */
#ifndef mathlibH #ifndef mathlibH
#define mathlibH #define mathlibH
#include "token.h" #include "token.h"
class MathLib class MathLib
{ {
public: public:
static long toLongNumber(const std::string & str); static long toLongNumber(const std::string & str);
static double toDoubleNumber(const std::string & str); static double toDoubleNumber(const std::string & str);
template<typename T> template<typename T>
static std::string toString(T d); static std::string toString(T d);
static bool isInt(const std::string & str); static bool isInt(const std::string & str);
static std::string add(const std::string & first, const std::string & second); 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 subtract(const std::string & first, const std::string & second);
static std::string multiply(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 divide(const std::string & first, const std::string & second);
static std::string sin(const std::string & tok); static std::string sin(const std::string & tok);
static std::string cos(const std::string & tok); static std::string cos(const std::string & tok);
static std::string tan(const std::string & tok); static std::string tan(const std::string & tok);
static std::string abs(const std::string & tok); static std::string abs(const std::string & tok);
static bool isGreater(const std::string & first, const std::string & second); static bool isGreater(const std::string & first, const std::string & second);
}; };
#endif #endif