118 lines
2.7 KiB
C
118 lines
2.7 KiB
C
|
/*
|
||
|
* Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com)
|
||
|
*
|
||
|
* 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 <https://www.gnu.org/licenses/>.
|
||
|
*/
|
||
|
#ifndef UTILS_H
|
||
|
#define UTILS_H
|
||
|
#include <type_traits>
|
||
|
#include <utility>
|
||
|
#include <functional>
|
||
|
#include <QString>
|
||
|
#include <QRect>
|
||
|
#include <QStringList>
|
||
|
#include <memory>
|
||
|
#include <QThread>
|
||
|
#include <QProcessEnvironment>
|
||
|
#include "SimpleIni.h"
|
||
|
#include "qt_utils/utils.h"
|
||
|
|
||
|
using SimpleIni = CSimpleIniA;
|
||
|
using PSimpleIni = std::shared_ptr<SimpleIni>;
|
||
|
|
||
|
enum class FileType{
|
||
|
CSource, // c source file (.c)
|
||
|
CppSource, // c++ source file (.cpp)
|
||
|
CHeader, // c header (.h)
|
||
|
CppHeader, // c++ header (.hpp)
|
||
|
WindowsResourceSource, // resource source (.res)
|
||
|
Project, //Red Panda C++ Project (.dev)
|
||
|
Text, // text file
|
||
|
Other // any others
|
||
|
};
|
||
|
|
||
|
enum class SearchFileScope {
|
||
|
currentFile,
|
||
|
wholeProject,
|
||
|
openedFiles
|
||
|
};
|
||
|
|
||
|
enum AutoSaveTarget {
|
||
|
astCurrentFile,
|
||
|
astAllOpennedFiles,
|
||
|
astAllProjectFiles
|
||
|
};
|
||
|
|
||
|
enum AutoSaveStrategy {
|
||
|
assOverwrite,
|
||
|
assAppendUnixTimestamp,
|
||
|
assAppendFormatedTimeStamp
|
||
|
};
|
||
|
|
||
|
enum FormatterBraceStyle {
|
||
|
fbsDefault,
|
||
|
fbsAllman,
|
||
|
fbsJava,
|
||
|
fbsKR,
|
||
|
fbsStroustrup,
|
||
|
fbsWitesmith,
|
||
|
fbsVtk,
|
||
|
fbsRatliff,
|
||
|
fbsGNU,
|
||
|
fbsLinux,
|
||
|
fbsHorstmann,
|
||
|
fbs1TBS,
|
||
|
fbsGoogle,
|
||
|
fbsMozilla,
|
||
|
fbsWebkit,
|
||
|
fbsPico,
|
||
|
fbsLisp
|
||
|
};
|
||
|
|
||
|
enum FormatterOperatorAlign {
|
||
|
foaNone,
|
||
|
foaType,
|
||
|
foaMiddle,
|
||
|
foaName
|
||
|
};
|
||
|
|
||
|
enum FormatterIndentType {
|
||
|
fitSpace,
|
||
|
fitTab
|
||
|
};
|
||
|
|
||
|
enum class SplitProcessCommandQuoteType {
|
||
|
None,
|
||
|
Single,
|
||
|
Double
|
||
|
};
|
||
|
|
||
|
FileType getFileType(const QString& filename);
|
||
|
QStringList splitProcessCommand(const QString& cmd);
|
||
|
|
||
|
QString genMakePath(const QString& fileName,bool escapeSpaces, bool encloseInQuotes);
|
||
|
QString genMakePath1(const QString& fileName);
|
||
|
QString genMakePath2(const QString& fileName);
|
||
|
QString getCompiledExecutableName(const QString& filename);
|
||
|
bool programHasConsole(const QString& filename);
|
||
|
|
||
|
QString parseMacros(const QString& s);
|
||
|
|
||
|
class CppParser;
|
||
|
void resetCppParser(std::shared_ptr<CppParser> parser, int compilerSetIndex=-1);
|
||
|
|
||
|
int getNewFileNumber();
|
||
|
|
||
|
#endif // UTILS_H
|