Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c246d5ae46 | ||
|
|
5e85ad4283 | ||
|
|
631e24f690 | ||
|
|
df1613046f | ||
|
|
af89dfd3cb | ||
|
|
62713fe165 | ||
|
|
0add646b21 | ||
|
|
bb885d22ba | ||
|
|
3f467c58de | ||
|
|
8edb11ab09 | ||
|
|
7171c3a9ec | ||
|
|
62ed88a770 | ||
|
|
2e9fe14947 | ||
|
|
a865024320 | ||
|
|
0c3eb8ec46 | ||
|
|
785d52fa55 | ||
|
|
b637cbb6d2 |
@@ -10,7 +10,7 @@ endif()
|
||||
|
||||
# Linux Soname Version
|
||||
set(MAJORVER 3)
|
||||
set(MINORVER 2)
|
||||
set(MINORVER 3)
|
||||
set(PATCHVER 0)
|
||||
set(SOLIBVER ${MAJORVER}.${MINORVER}.${PATCHVER})
|
||||
|
||||
|
||||
@@ -14,6 +14,20 @@
|
||||
|
||||
<h1>Artistic Style News</h1>
|
||||
|
||||
<h3>Artistic Style 3.3 (ongoing)</h3>
|
||||
|
||||
<p>
|
||||
The source code has been refactored to no longer use the std namespace globally.
|
||||
</p>
|
||||
<p>
|
||||
Some features of "modern C++" are now supported, ie. lambda function arguments and array initializers
|
||||
with braces.
|
||||
</p>
|
||||
<p>
|
||||
Two new options to remove superfluous whitespace and empty lines were added: the "squeeze-ws" and
|
||||
"squeeze-lines=#" (parameter value is the number of empty lines to keep).
|
||||
</p>
|
||||
|
||||
<h3>Artistic Style 3.2 (March 2023)</h3>
|
||||
|
||||
<p>
|
||||
|
||||
@@ -14,6 +14,23 @@
|
||||
|
||||
<h1>Artistic Style Release Notes</h1>
|
||||
|
||||
<h3>Artistic Style 3.3 (April 2023)</h3>
|
||||
|
||||
<ul>
|
||||
<li>added new option "--squeeze-ws" to remove superfluous whitespace (experimental)</li>
|
||||
<li>added new option "--squeeze-lines" to remove superfluous empty lines (experimental, #19, #22, #43, #72, #84, #93, #105, #517)</li>
|
||||
<li>fixed indent of lambda bodies in fct calls (#121)</li>
|
||||
<li>fixed indent of struct names including "struct" (#526)</li>
|
||||
<li>fixed indent of C++11 initializer lists (#516)</li>
|
||||
<li>refactored namespace std usage</li>
|
||||
</ul>
|
||||
|
||||
<h3>Artistic Style 3.2.1 (March 2023)</h3>
|
||||
|
||||
<ul>
|
||||
<li>fixed struct recognition related to SF #534 (https://gitlab.com/saalen/astyle/-/issues/1)</li>
|
||||
</ul>
|
||||
|
||||
<h3>Artistic Style 3.2 (March 2023)</h3>
|
||||
|
||||
<ul>
|
||||
|
||||
+7
-1
@@ -1,4 +1,4 @@
|
||||
.TH astyle 1 "2023-02-23" "Andre Simon" "user documentation"
|
||||
.TH astyle 1 "2023-04-18" "Andre Simon" "user documentation"
|
||||
|
||||
.SH NAME
|
||||
astyle - C syntax indenter and formatter
|
||||
@@ -262,6 +262,12 @@ Attach a reference operator (&) to either
|
||||
the operator type (left), middle, or operator name (right).
|
||||
If not set, follow pointer alignment.
|
||||
|
||||
.IP "--squeeze-lines=#"
|
||||
Remove superfluous empty lines exceeding the given number (experimental).
|
||||
|
||||
.IP "--squeeze-ws"
|
||||
Remove superfluous whitespace (experimental).
|
||||
|
||||
.SH Formatting Options
|
||||
|
||||
.IP "--break-closing-braces OR -y"
|
||||
|
||||
@@ -34,7 +34,6 @@ parser:flag "--attach-extern-c"
|
||||
parser:flag "--attach-closing-while"
|
||||
:description "Attach closing while of do-while to the closing brace"
|
||||
|
||||
|
||||
parser:flag "--indent-classes"
|
||||
:description "Indent 'class' blocks so that the entire block is indented"
|
||||
|
||||
@@ -257,6 +256,12 @@ parser:option "--stdin"
|
||||
parser:option "--stdout"
|
||||
:description "Use the file path as output from single file formatting"
|
||||
|
||||
parser:option "--squeeze-lines"
|
||||
:description "Remove superfluous empty lines exceeding the given number"
|
||||
|
||||
parser:flag "--squeeze-ws"
|
||||
:description "Remove superfluous whitespace"
|
||||
|
||||
local p = argparse "gen-completions"
|
||||
p:argument "shell"
|
||||
:choices {"bash", "zsh", "fish"}
|
||||
|
||||
+219
-173
File diff suppressed because it is too large
Load Diff
+24
-24
@@ -34,7 +34,7 @@ void ASEnhancer::init(int _fileType,
|
||||
bool _preprocBlockIndent,
|
||||
bool _preprocDefineIndent,
|
||||
bool _emptyLineFill,
|
||||
vector<const pair<const string, const string>* >* _indentableMacros)
|
||||
std::vector<const std::pair<const std::string, const std::string>* >* _indentableMacros)
|
||||
{
|
||||
// formatting variables from ASFormatter and ASBeautifier
|
||||
ASBase::init(_fileType);
|
||||
@@ -84,7 +84,7 @@ void ASEnhancer::init(int _fileType,
|
||||
*
|
||||
* @param line the original formatted line will be updated if necessary.
|
||||
*/
|
||||
void ASEnhancer::enhance(string& line, bool isInNamespace, bool isInPreprocessor, bool isInSQL)
|
||||
void ASEnhancer::enhance(std::string& line, bool isInNamespace, bool isInPreprocessor, bool isInSQL)
|
||||
{
|
||||
shouldUnindentLine = true;
|
||||
shouldUnindentComment = false;
|
||||
@@ -125,7 +125,7 @@ void ASEnhancer::enhance(string& line, bool isInNamespace, bool isInPreprocessor
|
||||
if (isInDeclareSection)
|
||||
{
|
||||
size_t firstText = line.find_first_not_of(" \t");
|
||||
if (firstText == string::npos || line[firstText] != '#')
|
||||
if (firstText == std::string::npos || line[firstText] != '#')
|
||||
indentLine(line, 1);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ void ASEnhancer::enhance(string& line, bool isInNamespace, bool isInPreprocessor
|
||||
|| (namespaceIndent && isInNamespace)))
|
||||
{
|
||||
size_t firstText = line.find_first_not_of(" \t");
|
||||
if (firstText == string::npos || line[firstText] != '#')
|
||||
if (firstText == std::string::npos || line[firstText] != '#')
|
||||
indentLine(line, 1);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ void ASEnhancer::enhance(string& line, bool isInNamespace, bool isInPreprocessor
|
||||
*
|
||||
* @param line a reference to the line that will be converted.
|
||||
*/
|
||||
void ASEnhancer::convertForceTabIndentToSpaces(string& line) const
|
||||
void ASEnhancer::convertForceTabIndentToSpaces(std::string& line) const
|
||||
{
|
||||
// replace tab indents with spaces
|
||||
for (size_t i = 0; i < line.length(); i++)
|
||||
@@ -171,7 +171,7 @@ void ASEnhancer::convertForceTabIndentToSpaces(string& line) const
|
||||
*
|
||||
* @param line a reference to the line that will be converted.
|
||||
*/
|
||||
void ASEnhancer::convertSpaceIndentToForceTab(string& line) const
|
||||
void ASEnhancer::convertSpaceIndentToForceTab(std::string& line) const
|
||||
{
|
||||
assert(tabLength > 0);
|
||||
|
||||
@@ -188,7 +188,7 @@ void ASEnhancer::convertSpaceIndentToForceTab(string& line) const
|
||||
* @param caseIndex the line index of the case statement.
|
||||
* @return the line index of the colon.
|
||||
*/
|
||||
size_t ASEnhancer::findCaseColon(const string& line, size_t caseIndex) const
|
||||
size_t ASEnhancer::findCaseColon(const std::string& line, size_t caseIndex) const
|
||||
{
|
||||
size_t i = caseIndex;
|
||||
bool isInQuote_ = false;
|
||||
@@ -236,7 +236,7 @@ size_t ASEnhancer::findCaseColon(const string& line, size_t caseIndex) const
|
||||
* @param indent the number of tabsets to insert.
|
||||
* @return the number of characters inserted.
|
||||
*/
|
||||
int ASEnhancer::indentLine(string& line, int indent) const
|
||||
int ASEnhancer::indentLine(std::string& line, int indent) const
|
||||
{
|
||||
if (line.length() == 0
|
||||
&& !emptyLineFill)
|
||||
@@ -276,15 +276,15 @@ int ASEnhancer::indentLine(string& line, int indent) const
|
||||
* @param index the current line index.
|
||||
* @return true if a hit.
|
||||
*/
|
||||
bool ASEnhancer::isBeginDeclareSectionSQL(const string& line, size_t index) const
|
||||
bool ASEnhancer::isBeginDeclareSectionSQL(const std::string& line, size_t index) const
|
||||
{
|
||||
string word;
|
||||
std::string word;
|
||||
size_t hits = 0;
|
||||
size_t i;
|
||||
for (i = index; i < line.length(); i++)
|
||||
{
|
||||
i = line.find_first_not_of(" \t", i);
|
||||
if (i == string::npos)
|
||||
if (i == std::string::npos)
|
||||
return false;
|
||||
if (line[i] == ';')
|
||||
break;
|
||||
@@ -325,15 +325,15 @@ bool ASEnhancer::isBeginDeclareSectionSQL(const string& line, size_t index) cons
|
||||
* @param index the current line index.
|
||||
* @return true if a hit.
|
||||
*/
|
||||
bool ASEnhancer::isEndDeclareSectionSQL(const string& line, size_t index) const
|
||||
bool ASEnhancer::isEndDeclareSectionSQL(const std::string& line, size_t index) const
|
||||
{
|
||||
string word;
|
||||
std::string word;
|
||||
size_t hits = 0;
|
||||
size_t i;
|
||||
for (i = index; i < line.length(); i++)
|
||||
{
|
||||
i = line.find_first_not_of(" \t", i);
|
||||
if (i == string::npos)
|
||||
if (i == std::string::npos)
|
||||
return false;
|
||||
if (line[i] == ';')
|
||||
break;
|
||||
@@ -374,7 +374,7 @@ bool ASEnhancer::isEndDeclareSectionSQL(const string& line, size_t index) const
|
||||
* @return false = one-line brace has not been reached.
|
||||
* true = one-line brace has been reached.
|
||||
*/
|
||||
bool ASEnhancer::isOneLineBlockReached(const string& line, int startChar) const
|
||||
bool ASEnhancer::isOneLineBlockReached(const std::string& line, int startChar) const
|
||||
{
|
||||
assert(line[startChar] == '{');
|
||||
|
||||
@@ -446,7 +446,7 @@ bool ASEnhancer::isOneLineBlockReached(const string& line, int startChar) const
|
||||
* parse characters in the current line to determine if an indent
|
||||
* or unindent is needed.
|
||||
*/
|
||||
void ASEnhancer::parseCurrentLine(string& line, bool isInPreprocessor, bool isInSQL)
|
||||
void ASEnhancer::parseCurrentLine(std::string& line, bool isInPreprocessor, bool isInSQL)
|
||||
{
|
||||
bool isSpecialChar = false; // is a backslash escape character
|
||||
|
||||
@@ -516,7 +516,7 @@ void ASEnhancer::parseCurrentLine(string& line, bool isInPreprocessor, bool isIn
|
||||
shouldUnindentComment = true;
|
||||
isInComment = true;
|
||||
size_t commentEnd = line.find("*/", i);
|
||||
if (commentEnd == string::npos)
|
||||
if (commentEnd == std::string::npos)
|
||||
i = line.length() - 1;
|
||||
else
|
||||
i = commentEnd - 1;
|
||||
@@ -537,7 +537,7 @@ void ASEnhancer::parseCurrentLine(string& line, bool isInPreprocessor, bool isIn
|
||||
if (sw.switchBraceCount == 1 && sw.unindentCase)
|
||||
shouldUnindentComment = true;
|
||||
size_t commentEnd = line.find("*/", i);
|
||||
if (commentEnd == string::npos)
|
||||
if (commentEnd == std::string::npos)
|
||||
i = line.length() - 1;
|
||||
else
|
||||
i = commentEnd - 1;
|
||||
@@ -555,7 +555,7 @@ void ASEnhancer::parseCurrentLine(string& line, bool isInPreprocessor, bool isIn
|
||||
// check for preprocessor within an event table
|
||||
if (isInEventTable && line[i] == '#' && preprocBlockIndent)
|
||||
{
|
||||
string preproc;
|
||||
std::string preproc;
|
||||
preproc = line.substr(i + 1);
|
||||
if (preproc.substr(0, 2) == "if") // #if, #ifdef, #ifndef)
|
||||
eventPreprocDepth += 1;
|
||||
@@ -619,7 +619,7 @@ void ASEnhancer::parseCurrentLine(string& line, bool isInPreprocessor, bool isIn
|
||||
// bypass the entire word
|
||||
if (isPotentialKeyword)
|
||||
{
|
||||
string name = getCurrentWord(line, i);
|
||||
std::string name = getCurrentWord(line, i);
|
||||
i += name.length() - 1;
|
||||
}
|
||||
continue;
|
||||
@@ -637,7 +637,7 @@ void ASEnhancer::parseCurrentLine(string& line, bool isInPreprocessor, bool isIn
|
||||
* @param index the current line index.
|
||||
* @return the new line index.
|
||||
*/
|
||||
size_t ASEnhancer::processSwitchBlock(string& line, size_t index)
|
||||
size_t ASEnhancer::processSwitchBlock(std::string& line, size_t index)
|
||||
{
|
||||
size_t i = index;
|
||||
bool isPotentialKeyword = isCharPotentialHeader(line, i);
|
||||
@@ -712,7 +712,7 @@ size_t ASEnhancer::processSwitchBlock(string& line, size_t index)
|
||||
}
|
||||
if (isPotentialKeyword)
|
||||
{
|
||||
string name = getCurrentWord(line, i); // bypass the entire name
|
||||
std::string name = getCurrentWord(line, i); // bypass the entire name
|
||||
i += name.length() - 1;
|
||||
}
|
||||
return i;
|
||||
@@ -726,11 +726,11 @@ size_t ASEnhancer::processSwitchBlock(string& line, size_t index)
|
||||
* @param unindent the number of tabsets to erase.
|
||||
* @return the number of characters erased.
|
||||
*/
|
||||
int ASEnhancer::unindentLine(string& line, int unindent) const
|
||||
int ASEnhancer::unindentLine(std::string& line, int unindent) const
|
||||
{
|
||||
size_t whitespace = line.find_first_not_of(" \t");
|
||||
|
||||
if (whitespace == string::npos) // if line is blank
|
||||
if (whitespace == std::string::npos) // if line is blank
|
||||
whitespace = line.length(); // must remove padding, if any
|
||||
|
||||
if (whitespace == 0)
|
||||
|
||||
+314
-295
File diff suppressed because it is too large
Load Diff
+16
-16
@@ -183,7 +183,7 @@ void ASLocalizer::setLanguageFromLCID(size_t lcid)
|
||||
|
||||
#endif // _WIN32
|
||||
|
||||
string ASLocalizer::getLanguageID() const
|
||||
std::string ASLocalizer::getLanguageID() const
|
||||
// Returns the language ID in m_langID.
|
||||
{
|
||||
return m_langID;
|
||||
@@ -217,13 +217,13 @@ void ASLocalizer::setLanguageFromName(const char* langID)
|
||||
// de_DE.iso88591@euro
|
||||
{
|
||||
// the constants describing the format of lang_LANG locale string
|
||||
string langStr = langID;
|
||||
std::string langStr = langID;
|
||||
m_langID = langStr.substr(0, 2);
|
||||
|
||||
// need the sublang for chinese
|
||||
if (m_langID == "zh" && langStr[2] == '_')
|
||||
{
|
||||
string subLang = langStr.substr(3, 2);
|
||||
std::string subLang = langStr.substr(3, 2);
|
||||
if (subLang == "CN" || subLang == "SG")
|
||||
m_subLangID = "CHS";
|
||||
else
|
||||
@@ -236,7 +236,7 @@ const char* ASLocalizer::settext(const char* textIn) const
|
||||
// Call the settext class and return the value.
|
||||
{
|
||||
assert(m_translationClass);
|
||||
const string stringIn = textIn;
|
||||
const std::string stringIn = textIn;
|
||||
return m_translationClass->translate(stringIn).c_str();
|
||||
}
|
||||
|
||||
@@ -311,22 +311,22 @@ Translation::Translation()
|
||||
m_translationVector.reserve(translationElements);
|
||||
}
|
||||
|
||||
void Translation::addPair(const string& english, const wstring& translated)
|
||||
void Translation::addPair(const std::string& english, const std::wstring& translated)
|
||||
// Add a string pair to the translation vector.
|
||||
{
|
||||
pair<string, wstring> entry(english, translated);
|
||||
std::pair<std::string, std::wstring> entry(english, translated);
|
||||
m_translationVector.emplace_back(entry);
|
||||
assert(m_translationVector.size() <= translationElements);
|
||||
}
|
||||
|
||||
string Translation::convertToMultiByte(const wstring& wideStr) const
|
||||
std::string Translation::convertToMultiByte(const std::wstring& wideStr) const
|
||||
// Convert wchar_t to a multibyte string using the currently assigned locale.
|
||||
// Return an empty string if an error occurs.
|
||||
{
|
||||
static bool msgDisplayed = false;
|
||||
// get length of the output excluding the nullptr and validate the parameters
|
||||
size_t mbLen = wcstombs(nullptr, wideStr.c_str(), 0);
|
||||
if (mbLen == string::npos)
|
||||
if (mbLen == std::string::npos)
|
||||
{
|
||||
if (!msgDisplayed)
|
||||
{
|
||||
@@ -336,7 +336,7 @@ string Translation::convertToMultiByte(const wstring& wideStr) const
|
||||
return "";
|
||||
}
|
||||
// convert the characters
|
||||
char* mbStr = new (nothrow) char[mbLen + 1];
|
||||
char* mbStr = new (std::nothrow) char[mbLen + 1];
|
||||
if (mbStr == nullptr)
|
||||
{
|
||||
if (!msgDisplayed)
|
||||
@@ -348,16 +348,16 @@ string Translation::convertToMultiByte(const wstring& wideStr) const
|
||||
}
|
||||
wcstombs(mbStr, wideStr.c_str(), mbLen + 1);
|
||||
// return the string
|
||||
string mbTranslation = mbStr;
|
||||
std::string mbTranslation = mbStr;
|
||||
delete[] mbStr;
|
||||
return mbTranslation;
|
||||
}
|
||||
|
||||
string Translation::getTranslationString(size_t i) const
|
||||
std::string Translation::getTranslationString(size_t i) const
|
||||
// Return the translation ascii value. Used for testing.
|
||||
{
|
||||
if (i >= m_translationVector.size())
|
||||
return string();
|
||||
return std::string();
|
||||
return m_translationVector[i].first;
|
||||
}
|
||||
|
||||
@@ -367,10 +367,10 @@ size_t Translation::getTranslationVectorSize() const
|
||||
return m_translationVector.size();
|
||||
}
|
||||
|
||||
bool Translation::getWideTranslation(const string& stringIn, wstring& wideOut) const
|
||||
bool Translation::getWideTranslation(const std::string& stringIn, std::wstring& wideOut) const
|
||||
// Get the wide translation string. Used for testing.
|
||||
{
|
||||
for (const pair<string, wstring>& translation : m_translationVector)
|
||||
for (const std::pair<std::string, std::wstring>& translation : m_translationVector)
|
||||
{
|
||||
if (translation.first == stringIn)
|
||||
{
|
||||
@@ -383,13 +383,13 @@ bool Translation::getWideTranslation(const string& stringIn, wstring& wideOut) c
|
||||
return false;
|
||||
}
|
||||
|
||||
string& Translation::translate(const string& stringIn) const
|
||||
std::string& Translation::translate(const std::string& stringIn) const
|
||||
// Translate a string.
|
||||
// Return a mutable string so the method can have a "const" designation.
|
||||
// This allows "settext" to be called from a "const" method.
|
||||
{
|
||||
m_mbTranslation.clear();
|
||||
for (const pair<string, wstring>& translation : m_translationVector)
|
||||
for (const std::pair<std::string, std::wstring>& translation : m_translationVector)
|
||||
{
|
||||
if (translation.first == stringIn)
|
||||
{
|
||||
|
||||
+14
-16
@@ -19,8 +19,6 @@
|
||||
|
||||
namespace astyle {
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifndef ASTYLE_LIB
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -35,7 +33,7 @@ class ASLocalizer
|
||||
public: // functions
|
||||
ASLocalizer();
|
||||
virtual ~ASLocalizer();
|
||||
string getLanguageID() const;
|
||||
std::string getLanguageID() const;
|
||||
const Translation* getTranslationClass() const;
|
||||
#ifdef _WIN32
|
||||
void setLanguageFromLCID(size_t lcid);
|
||||
@@ -48,8 +46,8 @@ private: // functions
|
||||
|
||||
private: // variables
|
||||
Translation* m_translationClass;// pointer to a polymorphic Translation class
|
||||
string m_langID; // language identifier from the locale
|
||||
string m_subLangID; // sub language identifier, if needed
|
||||
std::string m_langID; // language identifier from the locale
|
||||
std::string m_subLangID; // sub language identifier, if needed
|
||||
#ifdef _WIN32
|
||||
size_t m_lcid; // LCID of the user locale (Windows only)
|
||||
size_t m_codepage; // active codepage, 65001 = utf-8
|
||||
@@ -63,36 +61,36 @@ private: // variables
|
||||
class Translation
|
||||
// This base class is inherited by the language translation classes.
|
||||
// Polymorphism is used to call the correct language translator.
|
||||
// This class contains the translation vector and settext translation method.
|
||||
// The language vector is built by the language sub classes.
|
||||
// This class contains the translation std::vector and settext translation method.
|
||||
// The language std::vector is built by the language sub classes.
|
||||
// NOTE: This class must have virtual methods for typeid() to work.
|
||||
// typeid() is used by AStyleTestI18n_Localizer.cpp.
|
||||
{
|
||||
public:
|
||||
Translation();
|
||||
virtual ~Translation() = default;
|
||||
string convertToMultiByte(const wstring& wideStr) const;
|
||||
string getTranslationString(size_t i) const;
|
||||
std::string convertToMultiByte(const std::wstring& wideStr) const;
|
||||
std::string getTranslationString(size_t i) const;
|
||||
size_t getTranslationVectorSize() const;
|
||||
bool getWideTranslation(const string& stringIn, wstring& wideOut) const;
|
||||
string& translate(const string& stringIn) const;
|
||||
bool getWideTranslation(const std::string& stringIn, std::wstring& wideOut) const;
|
||||
std::string& translate(const std::string& stringIn) const;
|
||||
|
||||
protected:
|
||||
void addPair(const string& english, const wstring& translated);
|
||||
void addPair(const std::string& english, const std::wstring& translated);
|
||||
// variables
|
||||
vector<pair<string, wstring> > m_translationVector;
|
||||
std::vector<std::pair<std::string, std::wstring> > m_translationVector;
|
||||
|
||||
private:
|
||||
// the number of translation pairs added a constructor
|
||||
static const size_t translationElements = 30; // need static for vs2013
|
||||
// the translated string
|
||||
mutable string m_mbTranslation;
|
||||
// the translated std::string
|
||||
mutable std::string m_mbTranslation;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Translation classes
|
||||
// One class for each language.
|
||||
// These classes have only a constructor which builds the language vector.
|
||||
// These classes have only a constructor which builds the language std::vector.
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
class Bulgarian : public Translation
|
||||
|
||||
+172
-166
@@ -16,159 +16,159 @@
|
||||
|
||||
namespace astyle {
|
||||
//
|
||||
const string ASResource::_AS_EXCEPT = string("__except");
|
||||
const string ASResource::_AS_FINALLY = string("__finally");
|
||||
const string ASResource::_AS_TRY = string("__try");
|
||||
const string ASResource::AS_ADD = string("add");
|
||||
const string ASResource::AS_AUTO = string("auto");
|
||||
const string ASResource::AS_AUTORELEASEPOOL = string("autoreleasepool");
|
||||
const string ASResource::AS_CASE = string("case");
|
||||
const string ASResource::AS_CATCH = string("catch");
|
||||
const string ASResource::AS_CLASS = string("class");
|
||||
const string ASResource::AS_CONST = string("const");
|
||||
const string ASResource::AS_CONST_CAST = string("const_cast");
|
||||
const string ASResource::AS_DEFAULT = string("default");
|
||||
const string ASResource::AS_DELEGATE = string("delegate");
|
||||
const string ASResource::AS_DELETE = string("delete");
|
||||
const string ASResource::AS_DO = string("do");
|
||||
const string ASResource::AS_DYNAMIC_CAST = string("dynamic_cast");
|
||||
const string ASResource::AS_ELSE = string("else");
|
||||
const string ASResource::AS_END = string("end");
|
||||
const string ASResource::AS_ENUM = string("enum");
|
||||
const string ASResource::AS_EXTERN = string("extern");
|
||||
const string ASResource::AS_FINAL = string("final");
|
||||
const string ASResource::AS_FINALLY = string("finally");
|
||||
const string ASResource::AS_FIXED = string("fixed");
|
||||
const string ASResource::AS_FOR = string("for");
|
||||
const string ASResource::AS_FOREACH = string("foreach");
|
||||
const string ASResource::AS_FOREVER = string("forever");
|
||||
const string ASResource::AS_GET = string("get");
|
||||
const string ASResource::AS_IF = string("if");
|
||||
const string ASResource::AS_INTERFACE = string("interface");
|
||||
const string ASResource::AS_INTERRUPT = string("interrupt");
|
||||
const string ASResource::AS_LET = string("let");
|
||||
const string ASResource::AS_LOCK = string("lock");
|
||||
const string ASResource::AS_MODULE = string("module"); // CORBA IDL module definition
|
||||
const string ASResource::AS_NAMESPACE = string("namespace");
|
||||
const string ASResource::AS_NEW = string("new");
|
||||
const string ASResource::AS_NOEXCEPT = string("noexcept");
|
||||
const string ASResource::AS_NS_DURING = string("NS_DURING");
|
||||
const string ASResource::AS_NS_HANDLER = string("NS_HANDLER");
|
||||
const string ASResource::AS_OPERATOR = string("operator");
|
||||
const string ASResource::AS_OVERRIDE = string("override");
|
||||
const string ASResource::AS_PRIVATE = string("private");
|
||||
const string ASResource::AS_PROTECTED = string("protected");
|
||||
const string ASResource::AS_PUBLIC = string("public");
|
||||
const string ASResource::AS_QFOREACH = string("Q_FOREACH");
|
||||
const string ASResource::AS_QFOREVER = string("Q_FOREVER");
|
||||
const string ASResource::AS_REINTERPRET_CAST = string("reinterpret_cast");
|
||||
const string ASResource::AS_REMOVE = string("remove");
|
||||
const string ASResource::AS_SEALED = string("sealed");
|
||||
const string ASResource::AS_SELECTOR = string("selector");
|
||||
const string ASResource::AS_SET = string("set");
|
||||
const string ASResource::AS_STATIC = string("static");
|
||||
const string ASResource::AS_STATIC_CAST = string("static_cast");
|
||||
const string ASResource::AS_STRUCT = string("struct");
|
||||
const string ASResource::AS_TYPEDEF_STRUCT = string("typedef struct");
|
||||
const string ASResource::AS_SWITCH = string("switch");
|
||||
const string ASResource::AS_SYNCHRONIZED = string("synchronized");
|
||||
const string ASResource::AS_TEMPLATE = string("template");
|
||||
const string ASResource::AS_THROW = string("throw");
|
||||
const string ASResource::AS_THROWS = string("throws");
|
||||
const string ASResource::AS_TRY = string("try");
|
||||
const string ASResource::AS_UNCHECKED = string("unchecked");
|
||||
const string ASResource::AS_UNION = string("union");
|
||||
const string ASResource::AS_UNSAFE = string("unsafe");
|
||||
const string ASResource::AS_USING = string("using");
|
||||
const string ASResource::AS_VOLATILE = string("volatile");
|
||||
const string ASResource::AS_WHERE = string("where");
|
||||
const string ASResource::AS_WHILE = string("while");
|
||||
const std::string ASResource::_AS_EXCEPT = std::string("__except");
|
||||
const std::string ASResource::_AS_FINALLY = std::string("__finally");
|
||||
const std::string ASResource::_AS_TRY = std::string("__try");
|
||||
const std::string ASResource::AS_ADD = std::string("add");
|
||||
const std::string ASResource::AS_AUTO = std::string("auto");
|
||||
const std::string ASResource::AS_AUTORELEASEPOOL = std::string("autoreleasepool");
|
||||
const std::string ASResource::AS_CASE = std::string("case");
|
||||
const std::string ASResource::AS_CATCH = std::string("catch");
|
||||
const std::string ASResource::AS_CLASS = std::string("class");
|
||||
const std::string ASResource::AS_CONST = std::string("const");
|
||||
const std::string ASResource::AS_CONST_CAST = std::string("const_cast");
|
||||
const std::string ASResource::AS_DEFAULT = std::string("default");
|
||||
const std::string ASResource::AS_DELEGATE = std::string("delegate");
|
||||
const std::string ASResource::AS_DELETE = std::string("delete");
|
||||
const std::string ASResource::AS_DO = std::string("do");
|
||||
const std::string ASResource::AS_DYNAMIC_CAST = std::string("dynamic_cast");
|
||||
const std::string ASResource::AS_ELSE = std::string("else");
|
||||
const std::string ASResource::AS_END = std::string("end");
|
||||
const std::string ASResource::AS_ENUM = std::string("enum");
|
||||
const std::string ASResource::AS_EXTERN = std::string("extern");
|
||||
const std::string ASResource::AS_FINAL = std::string("final");
|
||||
const std::string ASResource::AS_FINALLY = std::string("finally");
|
||||
const std::string ASResource::AS_FIXED = std::string("fixed");
|
||||
const std::string ASResource::AS_FOR = std::string("for");
|
||||
const std::string ASResource::AS_FOREACH = std::string("foreach");
|
||||
const std::string ASResource::AS_FOREVER = std::string("forever");
|
||||
const std::string ASResource::AS_GET = std::string("get");
|
||||
const std::string ASResource::AS_IF = std::string("if");
|
||||
const std::string ASResource::AS_INTERFACE = std::string("interface");
|
||||
const std::string ASResource::AS_INTERRUPT = std::string("interrupt");
|
||||
const std::string ASResource::AS_LET = std::string("let");
|
||||
const std::string ASResource::AS_LOCK = std::string("lock");
|
||||
const std::string ASResource::AS_MODULE = std::string("module"); // CORBA IDL module definition
|
||||
const std::string ASResource::AS_NAMESPACE = std::string("namespace");
|
||||
const std::string ASResource::AS_NEW = std::string("new");
|
||||
const std::string ASResource::AS_NOEXCEPT = std::string("noexcept");
|
||||
const std::string ASResource::AS_NS_DURING = std::string("NS_DURING");
|
||||
const std::string ASResource::AS_NS_HANDLER = std::string("NS_HANDLER");
|
||||
const std::string ASResource::AS_OPERATOR = std::string("operator");
|
||||
const std::string ASResource::AS_OVERRIDE = std::string("override");
|
||||
const std::string ASResource::AS_PRIVATE = std::string("private");
|
||||
const std::string ASResource::AS_PROTECTED = std::string("protected");
|
||||
const std::string ASResource::AS_PUBLIC = std::string("public");
|
||||
const std::string ASResource::AS_QFOREACH = std::string("Q_FOREACH");
|
||||
const std::string ASResource::AS_QFOREVER = std::string("Q_FOREVER");
|
||||
const std::string ASResource::AS_REINTERPRET_CAST = std::string("reinterpret_cast");
|
||||
const std::string ASResource::AS_REMOVE = std::string("remove");
|
||||
const std::string ASResource::AS_SEALED = std::string("sealed");
|
||||
const std::string ASResource::AS_SELECTOR = std::string("selector");
|
||||
const std::string ASResource::AS_SET = std::string("set");
|
||||
const std::string ASResource::AS_STATIC = std::string("static");
|
||||
const std::string ASResource::AS_STATIC_CAST = std::string("static_cast");
|
||||
const std::string ASResource::AS_STRUCT = std::string("struct");
|
||||
const std::string ASResource::AS_TYPEDEF_STRUCT = std::string("typedef struct");
|
||||
const std::string ASResource::AS_SWITCH = std::string("switch");
|
||||
const std::string ASResource::AS_SYNCHRONIZED = std::string("synchronized");
|
||||
const std::string ASResource::AS_TEMPLATE = std::string("template");
|
||||
const std::string ASResource::AS_THROW = std::string("throw");
|
||||
const std::string ASResource::AS_THROWS = std::string("throws");
|
||||
const std::string ASResource::AS_TRY = std::string("try");
|
||||
const std::string ASResource::AS_UNCHECKED = std::string("unchecked");
|
||||
const std::string ASResource::AS_UNION = std::string("union");
|
||||
const std::string ASResource::AS_UNSAFE = std::string("unsafe");
|
||||
const std::string ASResource::AS_USING = std::string("using");
|
||||
const std::string ASResource::AS_VOLATILE = std::string("volatile");
|
||||
const std::string ASResource::AS_WHERE = std::string("where");
|
||||
const std::string ASResource::AS_WHILE = std::string("while");
|
||||
|
||||
const string ASResource::AS_ASM = string("asm");
|
||||
const string ASResource::AS__ASM__ = string("__asm__");
|
||||
const string ASResource::AS_MS_ASM = string("_asm");
|
||||
const string ASResource::AS_MS__ASM = string("__asm");
|
||||
const std::string ASResource::AS_ASM = std::string("asm");
|
||||
const std::string ASResource::AS__ASM__ = std::string("__asm__");
|
||||
const std::string ASResource::AS_MS_ASM = std::string("_asm");
|
||||
const std::string ASResource::AS_MS__ASM = std::string("__asm");
|
||||
|
||||
const string ASResource::AS_BAR_DEFINE = string("#define");
|
||||
const string ASResource::AS_BAR_INCLUDE = string("#include");
|
||||
const string ASResource::AS_BAR_IF = string("#if");
|
||||
const string ASResource::AS_BAR_EL = string("#el");
|
||||
const string ASResource::AS_BAR_ENDIF = string("#endif");
|
||||
const std::string ASResource::AS_BAR_DEFINE = std::string("#define");
|
||||
const std::string ASResource::AS_BAR_INCLUDE = std::string("#include");
|
||||
const std::string ASResource::AS_BAR_IF = std::string("#if");
|
||||
const std::string ASResource::AS_BAR_EL = std::string("#el");
|
||||
const std::string ASResource::AS_BAR_ENDIF = std::string("#endif");
|
||||
|
||||
const string ASResource::AS_OPEN_PAREN = string("(");
|
||||
const string ASResource::AS_CLOSE_PAREN = string(")");
|
||||
const string ASResource::AS_OPEN_BRACE = string("{");
|
||||
const string ASResource::AS_CLOSE_BRACE = string("}");
|
||||
const string ASResource::AS_OPEN_LINE_COMMENT = string("//");
|
||||
const string ASResource::AS_OPEN_COMMENT = string("/*");
|
||||
const string ASResource::AS_CLOSE_COMMENT = string("*/");
|
||||
const std::string ASResource::AS_OPEN_PAREN = std::string("(");
|
||||
const std::string ASResource::AS_CLOSE_PAREN = std::string(")");
|
||||
const std::string ASResource::AS_OPEN_BRACE = std::string("{");
|
||||
const std::string ASResource::AS_CLOSE_BRACE = std::string("}");
|
||||
const std::string ASResource::AS_OPEN_LINE_COMMENT = std::string("//");
|
||||
const std::string ASResource::AS_OPEN_COMMENT = std::string("/*");
|
||||
const std::string ASResource::AS_CLOSE_COMMENT = std::string("*/");
|
||||
|
||||
const string ASResource::AS_ASSIGN = string("=");
|
||||
const string ASResource::AS_PLUS_ASSIGN = string("+=");
|
||||
const string ASResource::AS_MINUS_ASSIGN = string("-=");
|
||||
const string ASResource::AS_MULT_ASSIGN = string("*=");
|
||||
const string ASResource::AS_DIV_ASSIGN = string("/=");
|
||||
const string ASResource::AS_MOD_ASSIGN = string("%=");
|
||||
const string ASResource::AS_OR_ASSIGN = string("|=");
|
||||
const string ASResource::AS_AND_ASSIGN = string("&=");
|
||||
const string ASResource::AS_XOR_ASSIGN = string("^=");
|
||||
const string ASResource::AS_GR_GR_ASSIGN = string(">>=");
|
||||
const string ASResource::AS_LS_LS_ASSIGN = string("<<=");
|
||||
const string ASResource::AS_GR_GR_GR_ASSIGN = string(">>>=");
|
||||
const string ASResource::AS_LS_LS_LS_ASSIGN = string("<<<=");
|
||||
const string ASResource::AS_GCC_MIN_ASSIGN = string("<?");
|
||||
const string ASResource::AS_GCC_MAX_ASSIGN = string(">?");
|
||||
const std::string ASResource::AS_ASSIGN = std::string("=");
|
||||
const std::string ASResource::AS_PLUS_ASSIGN = std::string("+=");
|
||||
const std::string ASResource::AS_MINUS_ASSIGN = std::string("-=");
|
||||
const std::string ASResource::AS_MULT_ASSIGN = std::string("*=");
|
||||
const std::string ASResource::AS_DIV_ASSIGN = std::string("/=");
|
||||
const std::string ASResource::AS_MOD_ASSIGN = std::string("%=");
|
||||
const std::string ASResource::AS_OR_ASSIGN = std::string("|=");
|
||||
const std::string ASResource::AS_AND_ASSIGN = std::string("&=");
|
||||
const std::string ASResource::AS_XOR_ASSIGN = std::string("^=");
|
||||
const std::string ASResource::AS_GR_GR_ASSIGN = std::string(">>=");
|
||||
const std::string ASResource::AS_LS_LS_ASSIGN = std::string("<<=");
|
||||
const std::string ASResource::AS_GR_GR_GR_ASSIGN = std::string(">>>=");
|
||||
const std::string ASResource::AS_LS_LS_LS_ASSIGN = std::string("<<<=");
|
||||
const std::string ASResource::AS_GCC_MIN_ASSIGN = std::string("<?");
|
||||
const std::string ASResource::AS_GCC_MAX_ASSIGN = std::string(">?");
|
||||
|
||||
const string ASResource::AS_RETURN = string("return");
|
||||
const string ASResource::AS_CIN = string("cin");
|
||||
const string ASResource::AS_COUT = string("cout");
|
||||
const string ASResource::AS_CERR = string("cerr");
|
||||
const std::string ASResource::AS_RETURN = std::string("return");
|
||||
const std::string ASResource::AS_CIN = std::string("cin");
|
||||
const std::string ASResource::AS_COUT = std::string("cout");
|
||||
const std::string ASResource::AS_CERR = std::string("cerr");
|
||||
|
||||
const string ASResource::AS_EQUAL = string("==");
|
||||
const string ASResource::AS_PLUS_PLUS = string("++");
|
||||
const string ASResource::AS_MINUS_MINUS = string("--");
|
||||
const string ASResource::AS_NOT_EQUAL = string("!=");
|
||||
const string ASResource::AS_GR_EQUAL = string(">=");
|
||||
const string ASResource::AS_GR_GR = string(">>");
|
||||
const string ASResource::AS_GR_GR_GR = string(">>>");
|
||||
const string ASResource::AS_LS_EQUAL = string("<=");
|
||||
const string ASResource::AS_LS_LS = string("<<");
|
||||
const string ASResource::AS_LS_LS_LS = string("<<<");
|
||||
const string ASResource::AS_QUESTION_QUESTION = string("??");
|
||||
const string ASResource::AS_LAMBDA = string("=>"); // C# lambda expression arrow
|
||||
const string ASResource::AS_ARROW = string("->");
|
||||
const string ASResource::AS_AND = string("&&");
|
||||
const string ASResource::AS_OR = string("||");
|
||||
const string ASResource::AS_SCOPE_RESOLUTION = string("::");
|
||||
const string ASResource::AS_SPACESHIP = string("<=>");
|
||||
const string ASResource::AS_EQUAL_JS = string("===");
|
||||
const std::string ASResource::AS_EQUAL = std::string("==");
|
||||
const std::string ASResource::AS_PLUS_PLUS = std::string("++");
|
||||
const std::string ASResource::AS_MINUS_MINUS = std::string("--");
|
||||
const std::string ASResource::AS_NOT_EQUAL = std::string("!=");
|
||||
const std::string ASResource::AS_GR_EQUAL = std::string(">=");
|
||||
const std::string ASResource::AS_GR_GR = std::string(">>");
|
||||
const std::string ASResource::AS_GR_GR_GR = std::string(">>>");
|
||||
const std::string ASResource::AS_LS_EQUAL = std::string("<=");
|
||||
const std::string ASResource::AS_LS_LS = std::string("<<");
|
||||
const std::string ASResource::AS_LS_LS_LS = std::string("<<<");
|
||||
const std::string ASResource::AS_QUESTION_QUESTION = std::string("??");
|
||||
const std::string ASResource::AS_LAMBDA = std::string("=>"); // C# lambda expression arrow
|
||||
const std::string ASResource::AS_ARROW = std::string("->");
|
||||
const std::string ASResource::AS_AND = std::string("&&");
|
||||
const std::string ASResource::AS_OR = std::string("||");
|
||||
const std::string ASResource::AS_SCOPE_RESOLUTION = std::string("::");
|
||||
const std::string ASResource::AS_SPACESHIP = std::string("<=>");
|
||||
const std::string ASResource::AS_EQUAL_JS = std::string("===");
|
||||
|
||||
const string ASResource::AS_PLUS = string("+");
|
||||
const string ASResource::AS_MINUS = string("-");
|
||||
const string ASResource::AS_MULT = string("*");
|
||||
const string ASResource::AS_DIV = string("/");
|
||||
const string ASResource::AS_MOD = string("%");
|
||||
const string ASResource::AS_GR = string(">");
|
||||
const string ASResource::AS_LS = string("<");
|
||||
const string ASResource::AS_NOT = string("!");
|
||||
const string ASResource::AS_BIT_OR = string("|");
|
||||
const string ASResource::AS_BIT_AND = string("&");
|
||||
const string ASResource::AS_BIT_NOT = string("~");
|
||||
const string ASResource::AS_BIT_XOR = string("^");
|
||||
const string ASResource::AS_QUESTION = string("?");
|
||||
const string ASResource::AS_COLON = string(":");
|
||||
const string ASResource::AS_COMMA = string(",");
|
||||
const string ASResource::AS_SEMICOLON = string(";");
|
||||
const std::string ASResource::AS_PLUS = std::string("+");
|
||||
const std::string ASResource::AS_MINUS = std::string("-");
|
||||
const std::string ASResource::AS_MULT = std::string("*");
|
||||
const std::string ASResource::AS_DIV = std::string("/");
|
||||
const std::string ASResource::AS_MOD = std::string("%");
|
||||
const std::string ASResource::AS_GR = std::string(">");
|
||||
const std::string ASResource::AS_LS = std::string("<");
|
||||
const std::string ASResource::AS_NOT = std::string("!");
|
||||
const std::string ASResource::AS_BIT_OR = std::string("|");
|
||||
const std::string ASResource::AS_BIT_AND = std::string("&");
|
||||
const std::string ASResource::AS_BIT_NOT = std::string("~");
|
||||
const std::string ASResource::AS_BIT_XOR = std::string("^");
|
||||
const std::string ASResource::AS_QUESTION = std::string("?");
|
||||
const std::string ASResource::AS_COLON = std::string(":");
|
||||
const std::string ASResource::AS_COMMA = std::string(",");
|
||||
const std::string ASResource::AS_SEMICOLON = std::string(";");
|
||||
|
||||
|
||||
/**
|
||||
* Sort comparison function.
|
||||
* Compares the length of the value of pointers in the vectors.
|
||||
* The LONGEST strings will be first in the vector.
|
||||
* The LONGEST std::strings will be first in the vector.
|
||||
*
|
||||
* @param a and b, the string pointers to be compared.
|
||||
* @param a and b, the std::string pointers to be compared.
|
||||
*/
|
||||
bool sortOnLength(const string* a, const string* b)
|
||||
bool sortOnLength(const std::string* a, const std::string* b)
|
||||
{
|
||||
return (*a).length() > (*b).length();
|
||||
}
|
||||
@@ -177,9 +177,9 @@ bool sortOnLength(const string* a, const string* b)
|
||||
* Sort comparison function.
|
||||
* Compares the value of pointers in the vectors.
|
||||
*
|
||||
* @param a and b, the string pointers to be compared.
|
||||
* @param a and b, the std::string pointers to be compared.
|
||||
*/
|
||||
bool sortOnName(const string* a, const string* b)
|
||||
bool sortOnName(const std::string* a, const std::string* b)
|
||||
{
|
||||
return *a < *b;
|
||||
}
|
||||
@@ -190,7 +190,7 @@ bool sortOnName(const string* a, const string* b)
|
||||
*
|
||||
* @param assignmentOperators a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildAssignmentOperators(vector<const string*>* assignmentOperators)
|
||||
void ASResource::buildAssignmentOperators(std::vector<const std::string*>* assignmentOperators)
|
||||
{
|
||||
const size_t elements = 15;
|
||||
assignmentOperators->reserve(elements);
|
||||
@@ -223,7 +223,7 @@ void ASResource::buildAssignmentOperators(vector<const string*>* assignmentOpera
|
||||
*
|
||||
* @param castOperators a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildCastOperators(vector<const string*>* castOperators)
|
||||
void ASResource::buildCastOperators(std::vector<const std::string*>* castOperators)
|
||||
{
|
||||
const size_t elements = 5;
|
||||
castOperators->reserve(elements);
|
||||
@@ -243,7 +243,7 @@ void ASResource::buildCastOperators(vector<const string*>* castOperators)
|
||||
*
|
||||
* @param headers a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildHeaders(vector<const string*>* headers, int fileType, bool beautifier)
|
||||
void ASResource::buildHeaders(std::vector<const std::string*>* headers, int fileType, bool beautifier)
|
||||
{
|
||||
const size_t elements = 25;
|
||||
headers->reserve(elements);
|
||||
@@ -310,7 +310,7 @@ void ASResource::buildHeaders(vector<const string*>* headers, int fileType, bool
|
||||
*
|
||||
* @param indentableHeaders a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildIndentableHeaders(vector<const string*>* indentableHeaders)
|
||||
void ASResource::buildIndentableHeaders(std::vector<const std::string*>* indentableHeaders)
|
||||
{
|
||||
indentableHeaders->emplace_back(&AS_RETURN);
|
||||
|
||||
@@ -323,13 +323,13 @@ void ASResource::buildIndentableHeaders(vector<const string*>* indentableHeaders
|
||||
*
|
||||
* @param indentableMacros a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildIndentableMacros(vector<const pair<const string, const string>* >* indentableMacros)
|
||||
void ASResource::buildIndentableMacros(std::vector<const std::pair<const std::string, const std::string>* >* indentableMacros)
|
||||
{
|
||||
const size_t elements = 10;
|
||||
indentableMacros->reserve(elements);
|
||||
|
||||
// the pairs must be retained in memory because of pair pointers
|
||||
using macro_pair = pair<const string, const string>;
|
||||
using macro_pair = std::pair<const std::string, const std::string>;
|
||||
static const macro_pair macros[] =
|
||||
{
|
||||
// wxWidgets
|
||||
@@ -354,7 +354,7 @@ void ASResource::buildIndentableMacros(vector<const pair<const string, const str
|
||||
*
|
||||
* @param nonAssignmentOperators a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildNonAssignmentOperators(vector<const string*>* nonAssignmentOperators)
|
||||
void ASResource::buildNonAssignmentOperators(std::vector<const std::string*>* nonAssignmentOperators)
|
||||
{
|
||||
const size_t elements = 15;
|
||||
nonAssignmentOperators->reserve(elements);
|
||||
@@ -383,9 +383,9 @@ void ASResource::buildNonAssignmentOperators(vector<const string*>* nonAssignmen
|
||||
* Used by BOTH ASFormatter.cpp and ASBeautifier.cpp.
|
||||
* NOTE: Non-paren headers should also be included in the headers vector.
|
||||
*
|
||||
* @param nonParenHeaders a reference to the vector to be built.
|
||||
* @param nonParenHeaders a reference to the std::vector to be built.
|
||||
*/
|
||||
void ASResource::buildNonParenHeaders(vector<const string*>* nonParenHeaders, int fileType, bool beautifier)
|
||||
void ASResource::buildNonParenHeaders(std::vector<const std::string*>* nonParenHeaders, int fileType, bool beautifier)
|
||||
{
|
||||
const size_t elements = 20;
|
||||
nonParenHeaders->reserve(elements);
|
||||
@@ -440,7 +440,7 @@ void ASResource::buildNonParenHeaders(vector<const string*>* nonParenHeaders, in
|
||||
*
|
||||
* @param operators a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildOperators(vector<const string*>* operators, int fileType)
|
||||
void ASResource::buildOperators(std::vector<const std::string*>* operators, int fileType)
|
||||
{
|
||||
const size_t elements = 50;
|
||||
operators->reserve(elements);
|
||||
@@ -509,7 +509,7 @@ void ASResource::buildOperators(vector<const string*>* operators, int fileType)
|
||||
*
|
||||
* @param preBlockStatements a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildPreBlockStatements(vector<const string*>* preBlockStatements, int fileType)
|
||||
void ASResource::buildPreBlockStatements(std::vector<const std::string*>* preBlockStatements, int fileType)
|
||||
{
|
||||
const size_t elements = 10;
|
||||
preBlockStatements->reserve(elements);
|
||||
@@ -549,7 +549,7 @@ void ASResource::buildPreBlockStatements(vector<const string*>* preBlockStatemen
|
||||
* the closing paren and the opening brace.
|
||||
* e.g. in "void foo() const {}", "const" is a preCommandHeader.
|
||||
*/
|
||||
void ASResource::buildPreCommandHeaders(vector<const string*>* preCommandHeaders, int fileType)
|
||||
void ASResource::buildPreCommandHeaders(std::vector<const std::string*>* preCommandHeaders, int fileType)
|
||||
{
|
||||
const size_t elements = 10;
|
||||
preCommandHeaders->reserve(elements);
|
||||
@@ -592,7 +592,7 @@ void ASResource::buildPreCommandHeaders(vector<const string*>* preCommandHeaders
|
||||
*
|
||||
* @param preDefinitionHeaders a reference to the vector to be built.
|
||||
*/
|
||||
void ASResource::buildPreDefinitionHeaders(vector<const string*>* preDefinitionHeaders, int fileType)
|
||||
void ASResource::buildPreDefinitionHeaders(std::vector<const std::string*>* preDefinitionHeaders, int fileType)
|
||||
{
|
||||
const size_t elements = 10;
|
||||
preDefinitionHeaders->reserve(elements);
|
||||
@@ -626,15 +626,15 @@ void ASResource::buildPreDefinitionHeaders(vector<const string*>* preDefinitionH
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
// check if a specific line position contains a header.
|
||||
const string* ASBase::findHeader(const string& line, int i,
|
||||
const vector<const string*>* possibleHeaders) const
|
||||
const std::string* ASBase::findHeader(const std::string& line, int i,
|
||||
const std::vector<const std::string*>* possibleHeaders) const
|
||||
{
|
||||
assert(isCharPotentialHeader(line, i));
|
||||
// check the word
|
||||
size_t maxHeaders = possibleHeaders->size();
|
||||
for (size_t p = 0; p < maxHeaders; p++)
|
||||
{
|
||||
const string* header = (*possibleHeaders)[p];
|
||||
const std::string* header = (*possibleHeaders)[p];
|
||||
const size_t wordEnd = i + header->length();
|
||||
if (wordEnd > line.length())
|
||||
continue;
|
||||
@@ -666,8 +666,9 @@ const string* ASBase::findHeader(const string& line, int i,
|
||||
}
|
||||
|
||||
// check if a specific line position contains a keyword.
|
||||
bool ASBase::findKeyword(const string& line, int i, const string& keyword) const
|
||||
bool ASBase::findKeyword(const std::string& line, int i, const std::string& keyword) const
|
||||
{
|
||||
//std::cerr << "findKeyword "<< i << " "<< line << " -< "<< keyword << "\n";
|
||||
assert(isCharPotentialHeader(line, i));
|
||||
// check the word
|
||||
const size_t keywordLength = keyword.length();
|
||||
@@ -677,20 +678,25 @@ bool ASBase::findKeyword(const string& line, int i, const string& keyword) const
|
||||
if (line.compare(i, keywordLength, keyword) != 0)
|
||||
return false;
|
||||
// check that this is not part of a longer word
|
||||
if (wordEnd == line.length())
|
||||
if (wordEnd == line.length()) {
|
||||
//std::cerr << "findKeyword t1 \n";
|
||||
return true;
|
||||
}
|
||||
|
||||
if (isLegalNameChar(line[wordEnd]))
|
||||
return false;
|
||||
// is not a keyword if part of a definition
|
||||
const char peekChar = peekNextChar(line, (int) wordEnd - 1);
|
||||
if (peekChar == ',' || peekChar == ')')
|
||||
return false;
|
||||
|
||||
//std::cerr << "findKeyword t2 \n";
|
||||
return true;
|
||||
}
|
||||
|
||||
// check if a specific line position contains an operator.
|
||||
const string* ASBase::findOperator(const string& line, int i,
|
||||
const vector<const string*>* possibleOperators) const
|
||||
const std::string* ASBase::findOperator(const std::string& line, int i,
|
||||
const std::vector<const std::string*>* possibleOperators) const
|
||||
{
|
||||
assert(isCharPotentialOperator(line[i]));
|
||||
// find the operator in the vector
|
||||
@@ -710,7 +716,7 @@ const string* ASBase::findOperator(const string& line, int i,
|
||||
|
||||
// get the current word on a line
|
||||
// index must point to the beginning of the word
|
||||
string ASBase::getCurrentWord(const string& line, size_t index) const
|
||||
std::string ASBase::getCurrentWord(const std::string& line, size_t index) const
|
||||
{
|
||||
assert(isCharPotentialHeader(line, index));
|
||||
size_t lineLength = line.length();
|
||||
@@ -737,7 +743,7 @@ bool ASBase::isLegalNameChar(char ch) const
|
||||
}
|
||||
|
||||
// check if a specific character can be part of a header
|
||||
bool ASBase::isCharPotentialHeader(const string& line, size_t i) const
|
||||
bool ASBase::isCharPotentialHeader(const std::string& line, size_t i) const
|
||||
{
|
||||
assert(!isWhiteSpace(line[i]));
|
||||
char prevCh = ' ';
|
||||
@@ -773,7 +779,7 @@ bool ASBase::isDigit(char ch) const
|
||||
}
|
||||
|
||||
// check if a specific character is a digit separator
|
||||
bool ASBase::isDigitSeparator(const string& line, int i) const
|
||||
bool ASBase::isDigitSeparator(const std::string& line, int i) const
|
||||
{
|
||||
assert(line[i] == '\'');
|
||||
// casting to (unsigned char) eliminates negative characters
|
||||
@@ -786,11 +792,11 @@ bool ASBase::isDigitSeparator(const string& line, int i) const
|
||||
}
|
||||
|
||||
// peek at the next unread character.
|
||||
char ASBase::peekNextChar(const string& line, int i) const
|
||||
char ASBase::peekNextChar(const std::string& line, int i) const
|
||||
{
|
||||
char ch = ' ';
|
||||
size_t peekNum = line.find_first_not_of(" \t", i + 1);
|
||||
if (peekNum == string::npos)
|
||||
if (peekNum == std::string::npos)
|
||||
return ch;
|
||||
ch = line[peekNum];
|
||||
return ch;
|
||||
|
||||
+200
-195
@@ -57,8 +57,6 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
namespace astyle {
|
||||
//
|
||||
using namespace std;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// definitions
|
||||
@@ -188,13 +186,13 @@ class ASSourceIterator
|
||||
public:
|
||||
ASSourceIterator() = default;
|
||||
virtual ~ASSourceIterator() = default;
|
||||
virtual streamoff getPeekStart() const = 0;
|
||||
virtual std::streamoff getPeekStart() const = 0;
|
||||
virtual int getStreamLength() const = 0;
|
||||
virtual bool hasMoreLines() const = 0;
|
||||
virtual string nextLine(bool emptyLineWasDeleted) = 0;
|
||||
virtual string peekNextLine() = 0;
|
||||
virtual std::string nextLine(bool emptyLineWasDeleted) = 0;
|
||||
virtual std::string peekNextLine() = 0;
|
||||
virtual void peekReset() = 0;
|
||||
virtual streamoff tellg() = 0;
|
||||
virtual std::streamoff tellg() = 0;
|
||||
};
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -220,7 +218,7 @@ public:
|
||||
bool hasMoreLines() const
|
||||
{ return sourceIterator->hasMoreLines(); }
|
||||
|
||||
string peekNextLine()
|
||||
std::string peekNextLine()
|
||||
{ needReset = true; return sourceIterator->peekNextLine(); }
|
||||
};
|
||||
|
||||
@@ -232,61 +230,61 @@ public:
|
||||
class ASResource
|
||||
{
|
||||
public:
|
||||
void buildAssignmentOperators(vector<const string*>* assignmentOperators);
|
||||
void buildCastOperators(vector<const string*>* castOperators);
|
||||
void buildHeaders(vector<const string*>* headers, int fileType, bool beautifier = false);
|
||||
void buildIndentableMacros(vector<const pair<const string, const string>* >* indentableMacros);
|
||||
void buildIndentableHeaders(vector<const string*>* indentableHeaders);
|
||||
void buildNonAssignmentOperators(vector<const string*>* nonAssignmentOperators);
|
||||
void buildNonParenHeaders(vector<const string*>* nonParenHeaders, int fileType, bool beautifier = false);
|
||||
void buildOperators(vector<const string*>* operators, int fileType);
|
||||
void buildPreBlockStatements(vector<const string*>* preBlockStatements, int fileType);
|
||||
void buildPreCommandHeaders(vector<const string*>* preCommandHeaders, int fileType);
|
||||
void buildPreDefinitionHeaders(vector<const string*>* preDefinitionHeaders, int fileType);
|
||||
void buildAssignmentOperators(std::vector<const std::string*>* assignmentOperators);
|
||||
void buildCastOperators(std::vector<const std::string*>* castOperators);
|
||||
void buildHeaders(std::vector<const std::string*>* headers, int fileType, bool beautifier = false);
|
||||
void buildIndentableMacros(std::vector<const std::pair<const std::string, const std::string>* >* indentableMacros);
|
||||
void buildIndentableHeaders(std::vector<const std::string*>* indentableHeaders);
|
||||
void buildNonAssignmentOperators(std::vector<const std::string*>* nonAssignmentOperators);
|
||||
void buildNonParenHeaders(std::vector<const std::string*>* nonParenHeaders, int fileType, bool beautifier = false);
|
||||
void buildOperators(std::vector<const std::string*>* operators, int fileType);
|
||||
void buildPreBlockStatements(std::vector<const std::string*>* preBlockStatements, int fileType);
|
||||
void buildPreCommandHeaders(std::vector<const std::string*>* preCommandHeaders, int fileType);
|
||||
void buildPreDefinitionHeaders(std::vector<const std::string*>* preDefinitionHeaders, int fileType);
|
||||
|
||||
public:
|
||||
static const string AS_IF, AS_ELSE;
|
||||
static const string AS_DO, AS_WHILE;
|
||||
static const string AS_FOR;
|
||||
static const string AS_SWITCH, AS_CASE, AS_DEFAULT;
|
||||
static const string AS_TRY, AS_CATCH, AS_THROW, AS_THROWS, AS_FINALLY, AS_USING;
|
||||
static const string _AS_TRY, _AS_FINALLY, _AS_EXCEPT;
|
||||
static const string AS_PUBLIC, AS_PROTECTED, AS_PRIVATE;
|
||||
static const string AS_CLASS, AS_STRUCT, AS_TYPEDEF_STRUCT, AS_UNION, AS_INTERFACE, AS_NAMESPACE;
|
||||
static const string AS_MODULE;
|
||||
static const string AS_END;
|
||||
static const string AS_SELECTOR;
|
||||
static const string AS_EXTERN, AS_ENUM;
|
||||
static const string AS_FINAL, AS_OVERRIDE;
|
||||
static const string AS_STATIC, AS_CONST, AS_SEALED, AS_VOLATILE, AS_NEW, AS_DELETE;
|
||||
static const string AS_NOEXCEPT, AS_INTERRUPT, AS_AUTORELEASEPOOL;
|
||||
static const string AS_WHERE, AS_LET, AS_SYNCHRONIZED;
|
||||
static const string AS_OPERATOR, AS_TEMPLATE;
|
||||
static const string AS_OPEN_PAREN, AS_CLOSE_PAREN;
|
||||
static const string AS_OPEN_BRACE, AS_CLOSE_BRACE;
|
||||
static const string AS_OPEN_LINE_COMMENT, AS_OPEN_COMMENT, AS_CLOSE_COMMENT;
|
||||
static const string AS_BAR_DEFINE, AS_BAR_INCLUDE, AS_BAR_IF, AS_BAR_EL, AS_BAR_ENDIF;
|
||||
static const string AS_AUTO, AS_RETURN;
|
||||
static const string AS_CIN, AS_COUT, AS_CERR;
|
||||
static const string AS_ASSIGN, AS_PLUS_ASSIGN, AS_MINUS_ASSIGN, AS_MULT_ASSIGN;
|
||||
static const string AS_DIV_ASSIGN, AS_MOD_ASSIGN, AS_XOR_ASSIGN, AS_OR_ASSIGN, AS_AND_ASSIGN;
|
||||
static const string AS_GR_GR_ASSIGN, AS_LS_LS_ASSIGN, AS_GR_GR_GR_ASSIGN, AS_LS_LS_LS_ASSIGN;
|
||||
static const string AS_GCC_MIN_ASSIGN, AS_GCC_MAX_ASSIGN, AS_SPACESHIP, AS_EQUAL_JS;
|
||||
static const string AS_EQUAL, AS_PLUS_PLUS, AS_MINUS_MINUS, AS_NOT_EQUAL, AS_GR_EQUAL;
|
||||
static const string AS_LS_EQUAL, AS_LS_LS_LS, AS_LS_LS, AS_GR_GR_GR, AS_GR_GR;
|
||||
static const string AS_QUESTION_QUESTION, AS_LAMBDA;
|
||||
static const string AS_ARROW, AS_AND, AS_OR;
|
||||
static const string AS_SCOPE_RESOLUTION;
|
||||
static const string AS_PLUS, AS_MINUS, AS_MULT, AS_DIV, AS_MOD, AS_GR, AS_LS;
|
||||
static const string AS_NOT, AS_BIT_XOR, AS_BIT_OR, AS_BIT_AND, AS_BIT_NOT;
|
||||
static const string AS_QUESTION, AS_COLON, AS_SEMICOLON, AS_COMMA;
|
||||
static const string AS_ASM, AS__ASM__, AS_MS_ASM, AS_MS__ASM;
|
||||
static const string AS_QFOREACH, AS_QFOREVER, AS_FOREVER;
|
||||
static const string AS_FOREACH, AS_LOCK, AS_UNSAFE, AS_FIXED;
|
||||
static const string AS_GET, AS_SET, AS_ADD, AS_REMOVE;
|
||||
static const string AS_DELEGATE, AS_UNCHECKED;
|
||||
static const string AS_CONST_CAST, AS_DYNAMIC_CAST, AS_REINTERPRET_CAST, AS_STATIC_CAST;
|
||||
static const string AS_NS_DURING, AS_NS_HANDLER;
|
||||
static const std::string AS_IF, AS_ELSE;
|
||||
static const std::string AS_DO, AS_WHILE;
|
||||
static const std::string AS_FOR;
|
||||
static const std::string AS_SWITCH, AS_CASE, AS_DEFAULT;
|
||||
static const std::string AS_TRY, AS_CATCH, AS_THROW, AS_THROWS, AS_FINALLY, AS_USING;
|
||||
static const std::string _AS_TRY, _AS_FINALLY, _AS_EXCEPT;
|
||||
static const std::string AS_PUBLIC, AS_PROTECTED, AS_PRIVATE;
|
||||
static const std::string AS_CLASS, AS_STRUCT, AS_TYPEDEF_STRUCT, AS_UNION, AS_INTERFACE, AS_NAMESPACE;
|
||||
static const std::string AS_MODULE;
|
||||
static const std::string AS_END;
|
||||
static const std::string AS_SELECTOR;
|
||||
static const std::string AS_EXTERN, AS_ENUM;
|
||||
static const std::string AS_FINAL, AS_OVERRIDE;
|
||||
static const std::string AS_STATIC, AS_CONST, AS_SEALED, AS_VOLATILE, AS_NEW, AS_DELETE;
|
||||
static const std::string AS_NOEXCEPT, AS_INTERRUPT, AS_AUTORELEASEPOOL;
|
||||
static const std::string AS_WHERE, AS_LET, AS_SYNCHRONIZED;
|
||||
static const std::string AS_OPERATOR, AS_TEMPLATE;
|
||||
static const std::string AS_OPEN_PAREN, AS_CLOSE_PAREN;
|
||||
static const std::string AS_OPEN_BRACE, AS_CLOSE_BRACE;
|
||||
static const std::string AS_OPEN_LINE_COMMENT, AS_OPEN_COMMENT, AS_CLOSE_COMMENT;
|
||||
static const std::string AS_BAR_DEFINE, AS_BAR_INCLUDE, AS_BAR_IF, AS_BAR_EL, AS_BAR_ENDIF;
|
||||
static const std::string AS_AUTO, AS_RETURN;
|
||||
static const std::string AS_CIN, AS_COUT, AS_CERR;
|
||||
static const std::string AS_ASSIGN, AS_PLUS_ASSIGN, AS_MINUS_ASSIGN, AS_MULT_ASSIGN;
|
||||
static const std::string AS_DIV_ASSIGN, AS_MOD_ASSIGN, AS_XOR_ASSIGN, AS_OR_ASSIGN, AS_AND_ASSIGN;
|
||||
static const std::string AS_GR_GR_ASSIGN, AS_LS_LS_ASSIGN, AS_GR_GR_GR_ASSIGN, AS_LS_LS_LS_ASSIGN;
|
||||
static const std::string AS_GCC_MIN_ASSIGN, AS_GCC_MAX_ASSIGN, AS_SPACESHIP, AS_EQUAL_JS;
|
||||
static const std::string AS_EQUAL, AS_PLUS_PLUS, AS_MINUS_MINUS, AS_NOT_EQUAL, AS_GR_EQUAL;
|
||||
static const std::string AS_LS_EQUAL, AS_LS_LS_LS, AS_LS_LS, AS_GR_GR_GR, AS_GR_GR;
|
||||
static const std::string AS_QUESTION_QUESTION, AS_LAMBDA;
|
||||
static const std::string AS_ARROW, AS_AND, AS_OR;
|
||||
static const std::string AS_SCOPE_RESOLUTION;
|
||||
static const std::string AS_PLUS, AS_MINUS, AS_MULT, AS_DIV, AS_MOD, AS_GR, AS_LS;
|
||||
static const std::string AS_NOT, AS_BIT_XOR, AS_BIT_OR, AS_BIT_AND, AS_BIT_NOT;
|
||||
static const std::string AS_QUESTION, AS_COLON, AS_SEMICOLON, AS_COMMA;
|
||||
static const std::string AS_ASM, AS__ASM__, AS_MS_ASM, AS_MS__ASM;
|
||||
static const std::string AS_QFOREACH, AS_QFOREVER, AS_FOREVER;
|
||||
static const std::string AS_FOREACH, AS_LOCK, AS_UNSAFE, AS_FIXED;
|
||||
static const std::string AS_GET, AS_SET, AS_ADD, AS_REMOVE;
|
||||
static const std::string AS_DELEGATE, AS_UNCHECKED;
|
||||
static const std::string AS_CONST_CAST, AS_DYNAMIC_CAST, AS_REINTERPRET_CAST, AS_STATIC_CAST;
|
||||
static const std::string AS_NS_DURING, AS_NS_HANDLER;
|
||||
}; // Class ASResource
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@@ -314,18 +312,18 @@ protected: // inline functions
|
||||
bool isWhiteSpace(char ch) const { return (ch == ' ' || ch == '\t'); }
|
||||
|
||||
protected: // functions definitions are at the end of ASResource.cpp
|
||||
const string* findHeader(const string& line, int i,
|
||||
const vector<const string*>* possibleHeaders) const;
|
||||
bool findKeyword(const string& line, int i, const string& keyword) const;
|
||||
const string* findOperator(const string& line, int i,
|
||||
const vector<const string*>* possibleOperators) const;
|
||||
string getCurrentWord(const string& line, size_t index) const;
|
||||
const std::string* findHeader(const std::string& line, int i,
|
||||
const std::vector<const std::string*>* possibleHeaders) const;
|
||||
bool findKeyword(const std::string& line, int i, const std::string& keyword) const;
|
||||
const std::string* findOperator(const std::string& line, int i,
|
||||
const std::vector<const std::string*>* possibleOperators) const;
|
||||
std::string getCurrentWord(const std::string& line, size_t index) const;
|
||||
bool isDigit(char ch) const;
|
||||
bool isLegalNameChar(char ch) const;
|
||||
bool isCharPotentialHeader(const string& line, size_t i) const;
|
||||
bool isCharPotentialHeader(const std::string& line, size_t i) const;
|
||||
bool isCharPotentialOperator(char ch) const;
|
||||
bool isDigitSeparator(const string& line, int i) const;
|
||||
char peekNextChar(const string& line, int i) const;
|
||||
bool isDigitSeparator(const std::string& line, int i) const;
|
||||
char peekNextChar(const std::string& line, int i) const;
|
||||
|
||||
}; // Class ASBase
|
||||
|
||||
@@ -344,7 +342,7 @@ public:
|
||||
ASBeautifier& operator=(ASBeautifier&&) = delete;
|
||||
virtual void init(ASSourceIterator* iter);
|
||||
|
||||
virtual string beautify(const string& originalLine);
|
||||
virtual std::string beautify(const std::string& originalLine);
|
||||
void setCaseIndent(bool state);
|
||||
void setClassIndent(bool state);
|
||||
void setContinuationIndentation(int indent = 1);
|
||||
@@ -356,6 +354,7 @@ public:
|
||||
void setJavaStyle();
|
||||
void setJSStyle();
|
||||
void setObjCStyle();
|
||||
void setSharpStyle();
|
||||
|
||||
void setLabelIndent(bool state);
|
||||
void setMaxContinuationIndentLength(int max);
|
||||
@@ -366,18 +365,18 @@ public:
|
||||
void setModifierIndent(bool state);
|
||||
void setNamespaceIndent(bool state);
|
||||
void setAlignMethodColon(bool state);
|
||||
void setSharpStyle();
|
||||
void setSpaceIndentation(int length = 4);
|
||||
void setSwitchIndent(bool state);
|
||||
void setTabIndentation(int length = 4, bool forceTabs = false);
|
||||
void setPreprocDefineIndent(bool state);
|
||||
void setPreprocConditionalIndent(bool state);
|
||||
void setSqueezeWhitespace(bool state);
|
||||
int getBeautifierFileType() const;
|
||||
int getFileType() const;
|
||||
int getIndentLength() const;
|
||||
int getTabLength() const;
|
||||
string getIndentString() const;
|
||||
string getNextWord(const string& line, size_t currPos) const;
|
||||
std::string getIndentString() const;
|
||||
std::string getNextWord(const std::string& line, size_t currPos) const;
|
||||
bool getAlignMethodColon() const;
|
||||
bool getBraceIndent() const;
|
||||
bool getBlockIndent() const;
|
||||
@@ -393,14 +392,14 @@ public:
|
||||
|
||||
protected:
|
||||
void deleteBeautifierVectors();
|
||||
int getNextProgramCharDistance(const string& line, int i) const;
|
||||
int indexOf(const vector<const string*>& container, const string* element) const;
|
||||
int getNextProgramCharDistance(const std::string& line, int i) const;
|
||||
int indexOf(const std::vector<const std::string*>& container, const std::string* element) const;
|
||||
void setBlockIndent(bool state);
|
||||
void setBraceIndent(bool state);
|
||||
void setBraceIndentVtk(bool state);
|
||||
string extractPreprocessorStatement(const string& line) const;
|
||||
string trim(const string& str) const;
|
||||
string rtrim(const string& str) const;
|
||||
std::string extractPreprocessorStatement(const std::string& line) const;
|
||||
std::string trim(const std::string& str) const;
|
||||
std::string rtrim(const std::string& str) const;
|
||||
|
||||
// variables set by ASFormatter - must be updated in activeBeautifierStack
|
||||
int inLineNumber;
|
||||
@@ -419,75 +418,76 @@ protected:
|
||||
bool isInIndentablePreproc;
|
||||
|
||||
private: // functions
|
||||
void adjustObjCMethodDefinitionIndentation(const string& line_);
|
||||
void adjustObjCMethodCallIndentation(const string& line_);
|
||||
void adjustObjCMethodDefinitionIndentation(const std::string& line_);
|
||||
void adjustObjCMethodCallIndentation(const std::string& line_);
|
||||
void adjustParsedLineIndentation(size_t iPrelim, bool isInExtraHeaderIndent);
|
||||
void computePreliminaryIndentation();
|
||||
void parseCurrentLine(const string& line);
|
||||
void parseCurrentLine(const std::string& line);
|
||||
void popLastContinuationIndent();
|
||||
void processPreprocessor(const string& preproc, const string& line);
|
||||
void registerContinuationIndent(const string& line, int i, int spaceIndentCount_,
|
||||
void processPreprocessor(const std::string& preproc, const std::string& line);
|
||||
void registerContinuationIndent(const std::string& line, int i, int spaceIndentCount_,
|
||||
int tabIncrementIn, int minIndent, bool updateParenStack);
|
||||
void registerContinuationIndentColon(const string& line, int i, int tabIncrementIn);
|
||||
void registerContinuationIndentColon(const std::string& line, int i, int tabIncrementIn);
|
||||
void initVectors();
|
||||
void initTempStacksContainer(vector<vector<const string*>*>*& container,
|
||||
vector<vector<const string*>*>* value);
|
||||
void initTempStacksContainer(std::vector<std::vector<const std::string*>*>*& container,
|
||||
std::vector<std::vector<const std::string*>*>* value);
|
||||
void clearObjCMethodDefinitionAlignment();
|
||||
void deleteBeautifierContainer(vector<ASBeautifier*>*& container);
|
||||
void deleteTempStacksContainer(vector<vector<const string*>*>*& container);
|
||||
void deleteBeautifierContainer(std::vector<ASBeautifier*>*& container);
|
||||
void deleteTempStacksContainer(std::vector<std::vector<const std::string*>*>*& container);
|
||||
int adjustIndentCountForBreakElseIfComments() const;
|
||||
int computeObjCColonAlignment(const string& line, int colonAlignPosition) const;
|
||||
int computeObjCColonAlignment(const std::string& line, int colonAlignPosition) const;
|
||||
int convertTabToSpaces(int i, int tabIncrementIn) const;
|
||||
int findObjCColonAlignment(const string& line) const;
|
||||
int getContinuationIndentAssign(const string& line, size_t currPos) const;
|
||||
int getContinuationIndentComma(const string& line, size_t currPos) const;
|
||||
int getObjCFollowingKeyword(const string& line, int bracePos) const;
|
||||
bool isIndentedPreprocessor(const string& line, size_t currPos) const;
|
||||
bool isLineEndComment(const string& line, int startPos) const;
|
||||
bool isPreprocessorConditionalCplusplus(const string& line) const;
|
||||
bool isInPreprocessorUnterminatedComment(const string& line);
|
||||
int findObjCColonAlignment(const std::string& line) const;
|
||||
int getContinuationIndentAssign(const std::string& line, size_t currPos) const;
|
||||
int getContinuationIndentComma(const std::string& line, size_t currPos) const;
|
||||
int getObjCFollowingKeyword(const std::string& line, int bracePos) const;
|
||||
bool isIndentedPreprocessor(const std::string& line, size_t currPos) const;
|
||||
bool isLineEndComment(const std::string& line, int startPos) const;
|
||||
bool isPreprocessorConditionalCplusplus(const std::string& line) const;
|
||||
bool isInPreprocessorUnterminatedComment(const std::string& line);
|
||||
bool isTopLevel() const;
|
||||
bool statementEndsWithComma(const string& line, int index) const;
|
||||
const string& getIndentedLineReturn(const string& newLine, const string& originalLine) const;
|
||||
string getIndentedSpaceEquivalent(const string& line_) const;
|
||||
string preLineWS(int lineIndentCount, int lineSpaceIndentCount) const;
|
||||
bool statementEndsWithComma(const std::string& line, int index) const;
|
||||
const std::string& getIndentedLineReturn(const std::string& newLine, const std::string& originalLine) const;
|
||||
std::string getIndentedSpaceEquivalent(const std::string& line_) const;
|
||||
std::string preLineWS(int lineIndentCount, int lineSpaceIndentCount) const;
|
||||
template<typename T> void deleteContainer(T& container);
|
||||
template<typename T> void initContainer(T& container, T value);
|
||||
vector<vector<const string*>*>* copyTempStacks(const ASBeautifier& other) const;
|
||||
pair<int, int> computePreprocessorIndent();
|
||||
std::vector<std::vector<const std::string*>*>* copyTempStacks(const ASBeautifier& other) const;
|
||||
std::pair<int, int> computePreprocessorIndent();
|
||||
|
||||
private: // variables
|
||||
int beautifierFileType;
|
||||
vector<const string*>* headers;
|
||||
vector<const string*>* nonParenHeaders;
|
||||
vector<const string*>* preBlockStatements;
|
||||
vector<const string*>* preCommandHeaders;
|
||||
vector<const string*>* assignmentOperators;
|
||||
vector<const string*>* nonAssignmentOperators;
|
||||
vector<const string*>* indentableHeaders;
|
||||
std::vector<const std::string*>* headers;
|
||||
std::vector<const std::string*>* nonParenHeaders;
|
||||
std::vector<const std::string*>* preBlockStatements;
|
||||
std::vector<const std::string*>* preCommandHeaders;
|
||||
std::vector<const std::string*>* assignmentOperators;
|
||||
std::vector<const std::string*>* nonAssignmentOperators;
|
||||
std::vector<const std::string*>* indentableHeaders;
|
||||
|
||||
vector<ASBeautifier*>* waitingBeautifierStack;
|
||||
vector<ASBeautifier*>* activeBeautifierStack;
|
||||
vector<size_t>* waitingBeautifierStackLengthStack;
|
||||
vector<size_t>* activeBeautifierStackLengthStack;
|
||||
vector<const string*>* headerStack;
|
||||
vector<vector<const string*>* >* tempStacks;
|
||||
vector<int>* parenDepthStack;
|
||||
vector<bool>* blockStatementStack;
|
||||
vector<bool>* parenStatementStack;
|
||||
vector<bool>* braceBlockStateStack;
|
||||
vector<int>* continuationIndentStack;
|
||||
vector<size_t>* continuationIndentStackSizeStack;
|
||||
vector<int>* parenIndentStack;
|
||||
vector<pair<int, int> >* preprocIndentStack;
|
||||
std::vector<ASBeautifier*>* waitingBeautifierStack;
|
||||
std::vector<ASBeautifier*>* activeBeautifierStack;
|
||||
std::vector<size_t>* waitingBeautifierStackLengthStack;
|
||||
std::vector<size_t>* activeBeautifierStackLengthStack;
|
||||
std::vector<const std::string*>* headerStack;
|
||||
std::vector<std::vector<const std::string*>* >* tempStacks;
|
||||
std::vector<int>* parenDepthStack;
|
||||
std::vector<bool>* blockStatementStack;
|
||||
std::vector<bool>* parenStatementStack;
|
||||
std::vector<bool>* braceBlockStateStack;
|
||||
std::vector<int>* continuationIndentStack;
|
||||
std::vector<size_t>* continuationIndentStackSizeStack;
|
||||
std::vector<int>* parenIndentStack;
|
||||
std::vector<std::pair<int, int> >* preprocIndentStack;
|
||||
std::vector<std::pair<size_t, size_t> > squeezeWSStack;
|
||||
|
||||
ASSourceIterator* sourceIterator;
|
||||
const string* currentHeader;
|
||||
const string* previousLastLineHeader;
|
||||
const string* probationHeader;
|
||||
const string* lastLineHeader;
|
||||
string indentString;
|
||||
string verbatimDelimiter;
|
||||
const std::string* currentHeader;
|
||||
const std::string* previousLastLineHeader;
|
||||
const std::string* probationHeader;
|
||||
const std::string* lastLineHeader;
|
||||
std::string indentString;
|
||||
std::string verbatimDelimiter;
|
||||
bool isInQuote;
|
||||
bool isInVerbatimQuote;
|
||||
bool haveLineContinuationChar;
|
||||
@@ -554,6 +554,8 @@ private: // variables
|
||||
bool foundPreCommandMacro;
|
||||
bool shouldAlignMethodColon;
|
||||
bool shouldIndentPreprocConditional;
|
||||
bool lambdaIndicator;
|
||||
bool squeezeWhitespace;
|
||||
int indentCount;
|
||||
int spaceIndentCount;
|
||||
int spaceIndentObjCMethodAlignment;
|
||||
@@ -593,20 +595,20 @@ class ASEnhancer : protected ASBase
|
||||
public: // functions
|
||||
ASEnhancer() = default;
|
||||
void init(int, int, int, bool, bool, bool, bool, bool, bool, bool,
|
||||
vector<const pair<const string, const string>* >*);
|
||||
void enhance(string& line, bool isInNamespace, bool isInPreprocessor, bool isInSQL);
|
||||
std::vector<const std::pair<const std::string, const std::string>* >*);
|
||||
void enhance(std::string& line, bool isInNamespace, bool isInPreprocessor, bool isInSQL);
|
||||
|
||||
private: // functions
|
||||
void convertForceTabIndentToSpaces(string& line) const;
|
||||
void convertSpaceIndentToForceTab(string& line) const;
|
||||
size_t findCaseColon(const string& line, size_t caseIndex) const;
|
||||
int indentLine(string& line, int indent) const;
|
||||
bool isBeginDeclareSectionSQL(const string& line, size_t index) const;
|
||||
bool isEndDeclareSectionSQL(const string& line, size_t index) const;
|
||||
bool isOneLineBlockReached(const string& line, int startChar) const;
|
||||
void parseCurrentLine(string& line, bool isInPreprocessor, bool isInSQL);
|
||||
size_t processSwitchBlock(string& line, size_t index);
|
||||
int unindentLine(string& line, int unindent) const;
|
||||
void convertForceTabIndentToSpaces(std::string& line) const;
|
||||
void convertSpaceIndentToForceTab(std::string& line) const;
|
||||
size_t findCaseColon(const std::string& line, size_t caseIndex) const;
|
||||
int indentLine(std::string& line, int indent) const;
|
||||
bool isBeginDeclareSectionSQL(const std::string& line, size_t index) const;
|
||||
bool isEndDeclareSectionSQL(const std::string& line, size_t index) const;
|
||||
bool isOneLineBlockReached(const std::string& line, int startChar) const;
|
||||
void parseCurrentLine(std::string& line, bool isInPreprocessor, bool isInSQL);
|
||||
size_t processSwitchBlock(std::string& line, size_t index);
|
||||
int unindentLine(std::string& line, int unindent) const;
|
||||
|
||||
private:
|
||||
// options from command line or options file
|
||||
@@ -645,12 +647,12 @@ private:
|
||||
};
|
||||
|
||||
SwitchVariables sw; // switch variables struct
|
||||
vector<SwitchVariables> switchStack; // stack vector of switch variables
|
||||
std::vector<SwitchVariables> switchStack; // stack std::vector of switch variables
|
||||
|
||||
// event table variables
|
||||
bool nextLineIsEventIndent; // begin event table indent is reached
|
||||
bool isInEventTable; // need to indent an event table
|
||||
vector<const pair<const string, const string>* >* indentableMacros;
|
||||
std::vector<const std::pair<const std::string, const std::string>* >* indentableMacros;
|
||||
|
||||
// SQL variables
|
||||
bool nextLineIsDeclareIndent; // begin declare section indent is reached
|
||||
@@ -674,7 +676,7 @@ public: // functions
|
||||
void init(ASSourceIterator* si) override;
|
||||
|
||||
bool hasMoreLines() const;
|
||||
string nextLine();
|
||||
std::string nextLine();
|
||||
LineEndFormat getLineEndFormat() const;
|
||||
bool getIsLineReady() const;
|
||||
void setFormattingStyle(FormatStyle style);
|
||||
@@ -734,7 +736,7 @@ public: // functions
|
||||
void setAddOneLineBracketsMode(bool state);
|
||||
void setRemoveBracketsMode(bool state);
|
||||
void setBreakClosingHeaderBracketsMode(bool state);
|
||||
|
||||
void setSqueezeEmptyLinesNumber(int);
|
||||
|
||||
private: // functions
|
||||
template<typename T> void deleteContainer(T& container);
|
||||
@@ -742,8 +744,8 @@ private: // functions
|
||||
char peekNextChar() const;
|
||||
BraceType getBraceType();
|
||||
bool adjustChecksumIn(int adjustment);
|
||||
bool computeChecksumIn(const string& currentLine_);
|
||||
bool computeChecksumOut(const string& beautifiedLine);
|
||||
bool computeChecksumIn(const std::string& currentLine_);
|
||||
bool computeChecksumOut(const std::string& beautifiedLine);
|
||||
bool addBracesToStatement();
|
||||
bool removeBracesFromStatement();
|
||||
bool commentAndHeaderFollows();
|
||||
@@ -756,25 +758,25 @@ private: // functions
|
||||
bool isBeforeMultipleLineEndComments(int startPos) const;
|
||||
bool isBraceType(BraceType a, BraceType b) const;
|
||||
bool isClassInitializer() const;
|
||||
bool isClosingHeader(const string* header) const;
|
||||
bool isClosingHeader(const std::string* header) const;
|
||||
bool isCurrentBraceBroken() const;
|
||||
bool isDereferenceOrAddressOf() const;
|
||||
bool isExecSQL(const string& line, size_t index) const;
|
||||
bool isEmptyLine(const string& line) const;
|
||||
bool isExecSQL(const std::string& line, size_t index) const;
|
||||
bool isEmptyLine(const std::string& line) const;
|
||||
bool isExternC() const;
|
||||
bool isMultiStatementLine() const;
|
||||
bool isNextWordSharpNonParenHeader(int startChar) const;
|
||||
bool isNonInStatementArrayBrace() const;
|
||||
bool isNumericVariable(const string& word) const;
|
||||
bool isNumericVariable(const std::string& word) const;
|
||||
bool isOkToSplitFormattedLine();
|
||||
bool isPointerOrReference() const;
|
||||
bool isPointerOrReferenceCentered() const;
|
||||
bool isPointerOrReferenceVariable(const string& word) const;
|
||||
bool isPointerToPointer(const string& line, int currPos) const;
|
||||
bool isSharpStyleWithParen(const string* header) const;
|
||||
bool isStructAccessModified(const string& firstLine, size_t index) const;
|
||||
bool isIndentablePreprocessorBlock(const string& firstLine, size_t index);
|
||||
bool isNDefPreprocStatement(const string& nextLine_, const string& preproc) const;
|
||||
bool isPointerOrReferenceVariable(const std::string& word) const;
|
||||
bool isPointerToPointer(const std::string& line, int currPos) const;
|
||||
bool isSharpStyleWithParen(const std::string* header) const;
|
||||
bool isStructAccessModified(const std::string& firstLine, size_t index) const;
|
||||
bool isIndentablePreprocessorBlock(const std::string& firstLine, size_t index);
|
||||
bool isNDefPreprocStatement(const std::string& nextLine_, const std::string& preproc) const;
|
||||
bool isUnaryOperator() const;
|
||||
bool isUniformInitializerBrace() const;
|
||||
bool isImmediatelyPostCast() const;
|
||||
@@ -787,24 +789,24 @@ private: // functions
|
||||
int findObjCColonAlignment() const;
|
||||
int getCurrentLineCommentAdjustment();
|
||||
int getNextLineCommentAdjustment();
|
||||
int isOneLineBlockReached(const string& line, int startChar) const;
|
||||
int isOneLineBlockReached(const std::string& line, int startChar) const;
|
||||
void adjustComments();
|
||||
void appendChar(char ch, bool canBreakLine);
|
||||
void appendCharInsideComments();
|
||||
void appendClosingHeader();
|
||||
void appendOperator(const string& sequence, bool canBreakLine = true);
|
||||
void appendSequence(const string& sequence, bool canBreakLine = true);
|
||||
void appendOperator(const std::string& sequence, bool canBreakLine = true);
|
||||
void appendSequence(const std::string& sequence, bool canBreakLine = true);
|
||||
void appendSpacePad();
|
||||
void appendSpaceAfter();
|
||||
void breakLine(bool isSplitLine = false);
|
||||
void buildLanguageVectors();
|
||||
void updateFormattedLineSplitPoints(char appendedChar);
|
||||
void updateFormattedLineSplitPointsOperator(const string& sequence);
|
||||
void updateFormattedLineSplitPointsOperator(const std::string& sequence);
|
||||
void checkIfTemplateOpener();
|
||||
void clearFormattedLineSplitPoints();
|
||||
void convertTabToSpaces();
|
||||
void deleteContainer(vector<BraceType>*& container);
|
||||
void findReturnTypeSplitPoint(const string& firstLine);
|
||||
void deleteContainer(std::vector<BraceType>*& container);
|
||||
void findReturnTypeSplitPoint(const std::string& firstLine);
|
||||
void formatArrayRunIn();
|
||||
void formatRunIn();
|
||||
void formatArrayBraces(BraceType braceType, bool isOpeningArrayBrace);
|
||||
@@ -825,13 +827,13 @@ private: // functions
|
||||
void fixOptionVariableConflicts();
|
||||
void goForward(int i);
|
||||
void isLineBreakBeforeClosingHeader();
|
||||
void initContainer(vector<BraceType>*& container, vector<BraceType>* value);
|
||||
void initContainer(std::vector<BraceType>*& container, std::vector<BraceType>* value);
|
||||
void initNewLine();
|
||||
void padObjCMethodColon();
|
||||
void padObjCMethodPrefix();
|
||||
void padObjCParamType();
|
||||
void padObjCReturnType();
|
||||
void padOperators(const string* newOperator);
|
||||
void padOperators(const std::string* newOperator);
|
||||
void padParens();
|
||||
void processPreprocessor();
|
||||
void resetEndOfStatement();
|
||||
@@ -841,45 +843,45 @@ private: // functions
|
||||
void trimContinuationLine();
|
||||
void updateFormattedLineSplitPointsPointerOrReference(size_t index);
|
||||
size_t findFormattedLineSplitPoint() const;
|
||||
size_t findNextChar(const string& line, char searchChar, int searchStart = 0) const;
|
||||
const string* checkForHeaderFollowingComment(const string& firstLine) const;
|
||||
const string* getFollowingOperator() const;
|
||||
string getPreviousWord(const string& line, int currPos) const;
|
||||
string peekNextText(const string& firstLine,
|
||||
size_t findNextChar(const std::string& line, char searchChar, int searchStart = 0) const;
|
||||
const std::string* checkForHeaderFollowingComment(const std::string& firstLine) const;
|
||||
const std::string* getFollowingOperator() const;
|
||||
std::string getPreviousWord(const std::string& line, int currPos) const;
|
||||
std::string peekNextText(const std::string& firstLine,
|
||||
bool endOnEmptyLine = false,
|
||||
const shared_ptr<ASPeekStream>& streamArg = nullptr) const;
|
||||
const std::shared_ptr<ASPeekStream>& streamArg = nullptr) const;
|
||||
|
||||
private: // variables
|
||||
int formatterFileType;
|
||||
vector<const string*>* headers;
|
||||
vector<const string*>* nonParenHeaders;
|
||||
vector<const string*>* preDefinitionHeaders;
|
||||
vector<const string*>* preCommandHeaders;
|
||||
vector<const string*>* operators;
|
||||
vector<const string*>* assignmentOperators;
|
||||
vector<const string*>* castOperators;
|
||||
vector<const pair<const string, const string>* >* indentableMacros; // for ASEnhancer
|
||||
std::vector<const std::string*>* headers;
|
||||
std::vector<const std::string*>* nonParenHeaders;
|
||||
std::vector<const std::string*>* preDefinitionHeaders;
|
||||
std::vector<const std::string*>* preCommandHeaders;
|
||||
std::vector<const std::string*>* operators;
|
||||
std::vector<const std::string*>* assignmentOperators;
|
||||
std::vector<const std::string*>* castOperators;
|
||||
std::vector<const std::pair<const std::string, const std::string>* >* indentableMacros; // for ASEnhancer
|
||||
|
||||
ASSourceIterator* sourceIterator;
|
||||
ASEnhancer* enhancer;
|
||||
|
||||
vector<const string*>* preBraceHeaderStack;
|
||||
vector<BraceType>* braceTypeStack;
|
||||
vector<int>* parenStack;
|
||||
vector<bool>* structStack;
|
||||
vector<bool>* questionMarkStack;
|
||||
std::vector<const std::string*>* preBraceHeaderStack;
|
||||
std::vector<BraceType>* braceTypeStack;
|
||||
std::vector<int>* parenStack;
|
||||
std::vector<bool>* structStack;
|
||||
std::vector<bool>* questionMarkStack;
|
||||
|
||||
string currentLine;
|
||||
string formattedLine;
|
||||
string readyFormattedLine;
|
||||
string verbatimDelimiter;
|
||||
const string* currentHeader;
|
||||
std::string currentLine;
|
||||
std::string formattedLine;
|
||||
std::string readyFormattedLine;
|
||||
std::string verbatimDelimiter;
|
||||
const std::string* currentHeader;
|
||||
char currentChar;
|
||||
char previousChar;
|
||||
char previousNonWSChar;
|
||||
char previousCommandChar;
|
||||
char quoteChar;
|
||||
streamoff preprocBlockEnd;
|
||||
std::streamoff preprocBlockEnd;
|
||||
int charNum;
|
||||
int runInIndentChars;
|
||||
int nextLineSpacePadNum;
|
||||
@@ -889,6 +891,9 @@ private: // variables
|
||||
int tabIncrementIn;
|
||||
int templateDepth;
|
||||
int squareBracketCount;
|
||||
int squeezeEmptyLineNum;
|
||||
int squeezeEmptyLineCount;
|
||||
|
||||
size_t checksumIn;
|
||||
size_t checksumOut;
|
||||
size_t currentLineFirstBraceNum; // first brace location on currentLine
|
||||
@@ -1078,11 +1083,11 @@ private: // inline functions
|
||||
{ return currentLine.compare(charNum, strlen(sequence), sequence) == 0; }
|
||||
|
||||
// call ASBase::findHeader for the current character
|
||||
const string* findHeader(const vector<const string*>* headers_)
|
||||
const std::string* findHeader(const std::vector<const std::string*>* headers_)
|
||||
{ return ASBase::findHeader(currentLine, charNum, headers_); }
|
||||
|
||||
// call ASBase::findOperator for the current character
|
||||
const string* findOperator(const vector<const string*>* operators_)
|
||||
const std::string* findOperator(const std::vector<const std::string*>* operators_)
|
||||
{ return ASBase::findOperator(currentLine, charNum, operators_); }
|
||||
}; // Class ASFormatter
|
||||
|
||||
@@ -1090,8 +1095,8 @@ private: // inline functions
|
||||
// astyle namespace global declarations
|
||||
//-----------------------------------------------------------------------------
|
||||
// sort comparison functions for ASResource
|
||||
bool sortOnLength(const string* a, const string* b);
|
||||
bool sortOnName(const string* a, const string* b);
|
||||
bool sortOnLength(const std::string* a, const std::string* b);
|
||||
bool sortOnName(const std::string* a, const std::string* b);
|
||||
|
||||
} // namespace astyle
|
||||
|
||||
|
||||
+774
-737
File diff suppressed because it is too large
Load Diff
+90
-90
@@ -110,29 +110,29 @@ public: // function declarations
|
||||
~ASStreamIterator() override;
|
||||
bool getLineEndChange(int lineEndFormat) const;
|
||||
int getStreamLength() const override;
|
||||
string nextLine(bool emptyLineWasDeleted) override;
|
||||
string peekNextLine() override;
|
||||
std::string nextLine(bool emptyLineWasDeleted) override;
|
||||
std::string peekNextLine() override;
|
||||
void peekReset() override;
|
||||
void saveLastInputLine();
|
||||
streamoff tellg() override;
|
||||
std::streamoff tellg() override;
|
||||
|
||||
private:
|
||||
T* inStream; // pointer to the input stream
|
||||
string buffer; // current input line
|
||||
string prevBuffer; // previous input line
|
||||
string outputEOL; // next output end of line char
|
||||
std::string buffer; // current input line
|
||||
std::string prevBuffer; // previous input line
|
||||
std::string outputEOL; // next output end of line char
|
||||
int eolWindows; // number of Windows line endings, CRLF
|
||||
int eolLinux; // number of Linux line endings, LF
|
||||
int eolMacOld; // number of old Mac line endings. CR
|
||||
streamoff streamLength; // length of the input file stream
|
||||
streamoff peekStart; // starting position for peekNextLine
|
||||
std::streamoff streamLength; // length of the input file stream
|
||||
std::streamoff peekStart; // starting position for peekNextLine
|
||||
bool prevLineDeleted; // the previous input line was deleted
|
||||
|
||||
public: // inline functions
|
||||
bool compareToInputBuffer(const string& nextLine_) const
|
||||
bool compareToInputBuffer(const std::string& nextLine_) const
|
||||
{ return (nextLine_ == prevBuffer); }
|
||||
const string& getOutputEOL() const { return outputEOL; }
|
||||
streamoff getPeekStart() const override { return peekStart; }
|
||||
const std::string& getOutputEOL() const { return outputEOL; }
|
||||
std::streamoff getPeekStart() const override { return peekStart; }
|
||||
bool hasMoreLines() const override { return !inStream->eof(); }
|
||||
};
|
||||
|
||||
@@ -179,28 +179,28 @@ public:
|
||||
#else
|
||||
ASOptions(ASFormatter& formatterArg, ASConsole& consoleArg);
|
||||
#endif
|
||||
string getOptionErrors() const;
|
||||
void importOptions(stringstream& in, vector<string>& optionsVector);
|
||||
bool parseOptions(vector<string>& optionsVector, const string& errorInfo);
|
||||
std::string getOptionErrors() const;
|
||||
void importOptions(std::stringstream& in, std::vector<std::string>& optionsVector);
|
||||
bool parseOptions(std::vector<std::string>& optionsVector, const std::string& errorInfo);
|
||||
|
||||
private:
|
||||
// variables
|
||||
ASFormatter& formatter;
|
||||
stringstream optionErrors; // option error messages
|
||||
std::stringstream optionErrors; // option error messages
|
||||
#ifndef ASTYLE_LIB
|
||||
ASConsole& console; // DO NOT USE for ASTYLE_LIB
|
||||
#endif
|
||||
|
||||
// functions
|
||||
string getParam(const string& arg, const char* op);
|
||||
string getParam(const string& arg, const char* op1, const char* op2);
|
||||
bool isOption(const string& arg, const char* op);
|
||||
bool isOption(const string& arg, const char* op1, const char* op2);
|
||||
void isOptionError(const string& arg, const string& errorInfo);
|
||||
bool isParamOption(const string& arg, const char* option);
|
||||
bool isParamOption(const string& arg, const char* option1, const char* option2);
|
||||
void parseOption(const string& arg, const string& errorInfo);
|
||||
bool parseOptionContinued(const string& arg, const string& errorInfo);
|
||||
std::string getParam(const std::string& arg, const char* op);
|
||||
std::string getParam(const std::string& arg, const char* op1, const char* op2);
|
||||
bool isOption(const std::string& arg, const char* op);
|
||||
bool isOption(const std::string& arg, const char* op1, const char* op2);
|
||||
void isOptionError(const std::string& arg, const std::string& errorInfo);
|
||||
bool isParamOption(const std::string& arg, const char* option);
|
||||
bool isParamOption(const std::string& arg, const char* option1, const char* option2);
|
||||
void parseOption(const std::string& arg, const std::string& errorInfo);
|
||||
bool parseOptionContinued(const std::string& arg, const std::string& errorInfo);
|
||||
};
|
||||
|
||||
#ifndef ASTYLE_LIB
|
||||
@@ -215,7 +215,7 @@ private: // variables
|
||||
ASFormatter& formatter; // reference to the ASFormatter object
|
||||
ASEncoding encode; // file encoding conversion
|
||||
ASLocalizer localizer; // language translation
|
||||
ostream* errorStream; // direct error messages to cerr or cout
|
||||
std::ostream* errorStream; // direct error messages to cerr or std::cout
|
||||
// command line options
|
||||
bool isRecursive; // recursive option
|
||||
bool isDryRun; // dry-run option
|
||||
@@ -237,38 +237,38 @@ private: // variables
|
||||
bool lineEndsMixed; // output has mixed line ends
|
||||
int linesOut; // number of output lines
|
||||
|
||||
string outputEOL; // current line end
|
||||
string prevEOL; // previous line end
|
||||
string astyleExePath; // absolute executable path and name from argv[0]
|
||||
string optionFileName; // file path and name of the options file
|
||||
string origSuffix; // suffix= option
|
||||
string projectOptionFileName; // file path and name of the project options file
|
||||
string stdPathIn; // path to input from stdin=
|
||||
string stdPathOut; // path to output from stdout=
|
||||
string targetDirectory; // path to the directory being processed
|
||||
string targetFilename; // file name being processed
|
||||
std::string outputEOL; // current line end
|
||||
std::string prevEOL; // previous line end
|
||||
std::string astyleExePath; // absolute executable path and name from argv[0]
|
||||
std::string optionFileName; // file path and name of the options file
|
||||
std::string origSuffix; // suffix= option
|
||||
std::string projectOptionFileName; // file path and name of the project options file
|
||||
std::string stdPathIn; // path to input from stdin=
|
||||
std::string stdPathOut; // path to output from stdout=
|
||||
std::string targetDirectory; // path to the directory being processed
|
||||
std::string targetFilename; // file name being processed
|
||||
|
||||
vector<string> excludeVector; // exclude from wildcard hits
|
||||
vector<bool> excludeHitsVector; // exclude flags for error reporting
|
||||
vector<string> fileNameVector; // file paths and names from the command line
|
||||
vector<string> optionsVector; // options from the command line
|
||||
vector<string> projectOptionsVector;// project options from the project options file
|
||||
vector<string> fileOptionsVector; // options from the options file
|
||||
vector<string> fileName; // files to be processed including path
|
||||
std::vector<std::string> excludeVector; // exclude from wildcard hits
|
||||
std::vector<bool> excludeHitsVector; // exclude flags for error reporting
|
||||
std::vector<std::string> fileNameVector; // file paths and names from the command line
|
||||
std::vector<std::string> optionsVector; // options from the command line
|
||||
std::vector<std::string> projectOptionsVector;// project options from the project options file
|
||||
std::vector<std::string> fileOptionsVector; // options from the options file
|
||||
std::vector<std::string> fileName; // files to be processed including path
|
||||
|
||||
public: // functions
|
||||
explicit ASConsole(ASFormatter& formatterArg);
|
||||
ASConsole(const ASConsole&) = delete;
|
||||
ASConsole& operator=(ASConsole const&) = delete;
|
||||
void convertLineEnds(ostringstream& out, int lineEnd);
|
||||
void convertLineEnds(std::ostringstream& out, int lineEnd);
|
||||
FileEncoding detectEncoding(const char* data, size_t dataSize) const;
|
||||
void error() const;
|
||||
void error(const char* why, const char* what) const;
|
||||
void formatCinToCout();
|
||||
vector<string> getArgvOptions(int argc, char** argv);
|
||||
std::vector<std::string> getArgvOptions(int argc, char** argv);
|
||||
bool fileExists(const char* file) const;
|
||||
bool fileNameVectorIsEmpty() const;
|
||||
ostream* getErrorStream() const;
|
||||
std::ostream* getErrorStream() const;
|
||||
bool getFilesAreIdentical() const;
|
||||
int getFilesFormatted() const;
|
||||
bool getIgnoreExcludeErrors() const;
|
||||
@@ -281,19 +281,19 @@ public: // functions
|
||||
bool getLineEndsMixed() const;
|
||||
bool getNoBackup() const;
|
||||
bool getPreserveDate() const;
|
||||
string getLanguageID() const;
|
||||
string getNumberFormat(int num, size_t lcid = 0) const;
|
||||
string getNumberFormat(int num, const char* groupingArg, const char* separator) const;
|
||||
string getOptionFileName() const;
|
||||
string getOrigSuffix() const;
|
||||
string getProjectOptionFileName() const;
|
||||
string getStdPathIn() const;
|
||||
string getStdPathOut() const;
|
||||
void getTargetFilenames(string& targetFilename_, vector<string>& targetFilenameVector) const;
|
||||
std::string getLanguageID() const;
|
||||
std::string getNumberFormat(int num, size_t lcid = 0) const;
|
||||
std::string getNumberFormat(int num, const char* groupingArg, const char* separator) const;
|
||||
std::string getOptionFileName() const;
|
||||
std::string getOrigSuffix() const;
|
||||
std::string getProjectOptionFileName() const;
|
||||
std::string getStdPathIn() const;
|
||||
std::string getStdPathOut() const;
|
||||
void getTargetFilenames(std::string& targetFilename_, std::vector<std::string>& targetFilenameVector) const;
|
||||
void processFiles();
|
||||
void processOptions(const vector<string>& argvOptions);
|
||||
void processOptions(const std::vector<std::string>& argvOptions);
|
||||
void setBypassBrowserOpen(bool state);
|
||||
void setErrorStream(ostream* errStreamPtr);
|
||||
void setErrorStream(std::ostream* errStreamPtr);
|
||||
void setIgnoreExcludeErrors(bool state);
|
||||
void setIgnoreExcludeErrorsAndDisplay(bool state);
|
||||
void setIsDryRun(bool state);
|
||||
@@ -302,54 +302,54 @@ public: // functions
|
||||
void setIsRecursive(bool state);
|
||||
void setIsVerbose(bool state);
|
||||
void setNoBackup(bool state);
|
||||
void setOptionFileName(const string& name);
|
||||
void setOrigSuffix(const string& suffix);
|
||||
void setOptionFileName(const std::string& name);
|
||||
void setOrigSuffix(const std::string& suffix);
|
||||
void setPreserveDate(bool state);
|
||||
void setProjectOptionFileName(const string& optfilepath);
|
||||
void setStdPathIn(const string& path);
|
||||
void setStdPathOut(const string& path);
|
||||
void standardizePath(string& path, bool removeBeginningSeparator = false) const;
|
||||
bool stringEndsWith(const string& str, const string& suffix) const;
|
||||
void updateExcludeVector(const string& suffixParam);
|
||||
vector<string> getExcludeVector() const;
|
||||
vector<bool> getExcludeHitsVector() const;
|
||||
vector<string> getFileNameVector() const;
|
||||
vector<string> getOptionsVector() const;
|
||||
vector<string> getProjectOptionsVector() const;
|
||||
vector<string> getFileOptionsVector() const;
|
||||
vector<string> getFileName() const;
|
||||
void setProjectOptionFileName(const std::string& optfilepath);
|
||||
void setStdPathIn(const std::string& path);
|
||||
void setStdPathOut(const std::string& path);
|
||||
void standardizePath(std::string& path, bool removeBeginningSeparator = false) const;
|
||||
bool stringEndsWith(const std::string& str, const std::string& suffix) const;
|
||||
void updateExcludeVector(const std::string& suffixParam);
|
||||
std::vector<std::string> getExcludeVector() const;
|
||||
std::vector<bool> getExcludeHitsVector() const;
|
||||
std::vector<std::string> getFileNameVector() const;
|
||||
std::vector<std::string> getOptionsVector() const;
|
||||
std::vector<std::string> getProjectOptionsVector() const;
|
||||
std::vector<std::string> getFileOptionsVector() const;
|
||||
std::vector<std::string> getFileName() const;
|
||||
|
||||
private: // functions
|
||||
void correctMixedLineEnds(ostringstream& out);
|
||||
void formatFile(const string& fileName_);
|
||||
string getParentDirectory(const string& absPath) const;
|
||||
string findProjectOptionFilePath(const string& fileName_) const;
|
||||
string getCurrentDirectory(const string& fileName_) const;
|
||||
void getFileNames(const string& directory, const vector<string>& wildcards);
|
||||
void getFilePaths(const string& filePath);
|
||||
string getFullPathName(const string& relativePath) const;
|
||||
string getHtmlInstallPrefix() const;
|
||||
string getParam(const string& arg, const char* op);
|
||||
bool isHomeOrInvalidAbsPath(const string& absPath) const;
|
||||
void correctMixedLineEnds(std::ostringstream& out);
|
||||
void formatFile(const std::string& fileName_);
|
||||
std::string getParentDirectory(const std::string& absPath) const;
|
||||
std::string findProjectOptionFilePath(const std::string& fileName_) const;
|
||||
std::string getCurrentDirectory(const std::string& fileName_) const;
|
||||
void getFileNames(const std::string& directory, const std::vector<std::string>& wildcards);
|
||||
void getFilePaths(const std::string& filePath);
|
||||
std::string getFullPathName(const std::string& relativePath) const;
|
||||
std::string getHtmlInstallPrefix() const;
|
||||
std::string getParam(const std::string& arg, const char* op);
|
||||
bool isHomeOrInvalidAbsPath(const std::string& absPath) const;
|
||||
void initializeOutputEOL(LineEndFormat lineEndFormat);
|
||||
bool isOption(const string& arg, const char* op);
|
||||
bool isOption(const string& arg, const char* a, const char* b);
|
||||
bool isParamOption(const string& arg, const char* option);
|
||||
bool isPathExclued(const string& subPath);
|
||||
bool isOption(const std::string& arg, const char* op);
|
||||
bool isOption(const std::string& arg, const char* a, const char* b);
|
||||
bool isParamOption(const std::string& arg, const char* option);
|
||||
bool isPathExclued(const std::string& subPath);
|
||||
void launchDefaultBrowser(const char* filePathIn = nullptr) const;
|
||||
void printHelp() const;
|
||||
void printMsg(const char* msg, const string& data) const;
|
||||
void printMsg(const char* msg, const std::string& data) const;
|
||||
void printSeparatingLine() const;
|
||||
void printVerboseHeader() const;
|
||||
void printVerboseStats(clock_t startTime) const;
|
||||
FileEncoding readFile(const string& fileName_, stringstream& in) const;
|
||||
FileEncoding readFile(const std::string& fileName_, std::stringstream& in) const;
|
||||
void removeFile(const char* fileName_, const char* errMsg) const;
|
||||
void renameFile(const char* oldFileName, const char* newFileName, const char* errMsg) const;
|
||||
void setOutputEOL(LineEndFormat lineEndFormat, const string& currentEOL);
|
||||
void setOutputEOL(LineEndFormat lineEndFormat, const std::string& currentEOL);
|
||||
void sleep(int seconds) const;
|
||||
int waitForRemove(const char* newFileName) const;
|
||||
int wildcmp(const char* wild, const char* data) const;
|
||||
void writeFile(const string& fileName_, FileEncoding encoding, ostringstream& out) const;
|
||||
void writeFile(const std::string& fileName_, FileEncoding encoding, std::ostringstream& out) const;
|
||||
#ifdef _WIN32
|
||||
void displayLastError();
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user