Skip to content

Commit

Permalink
Applied patch to improve code formatter to its latest version (it's s…
Browse files Browse the repository at this point in the history
…upport some c++11 features like range-based for).

Also code formatter dialog changed - settings separeted into different tabs - by NilC

git-svn-id: https://codelite.svn.sourceforge.net/svnroot/codelite/trunk@5819 9da81c78-c036-0410-9e1f-a2b0375e4b5a
  • Loading branch information
eranif committed Sep 14, 2012
1 parent 07dec9c commit 736204b
Show file tree
Hide file tree
Showing 18 changed files with 22,974 additions and 21,238 deletions.
5,600 changes: 2,870 additions & 2,730 deletions CodeFormatter/ASBeautifier.cpp

Large diffs are not rendered by default.

1,416 changes: 737 additions & 679 deletions CodeFormatter/ASEnhancer.cpp

Large diffs are not rendered by default.

10,374 changes: 5,539 additions & 4,835 deletions CodeFormatter/ASFormatter.cpp

Large diffs are not rendered by default.

1,361 changes: 841 additions & 520 deletions CodeFormatter/ASLocalizer.cpp

Large diffs are not rendered by default.

358 changes: 211 additions & 147 deletions CodeFormatter/ASLocalizer.h
Original file line number Diff line number Diff line change
@@ -1,147 +1,211 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ASLocalizer.h
*
* Copyright (C) 2006-2011 by Jim Pattee <jimp03@email.com>
* Copyright (C) 1998-2002 by Tal Davidson
* <http://www.gnu.org/licenses/lgpl-3.0.html>
*
* This file is a part of Artistic Style - an indentation and
* reformatting tool for C, C++, C# and Java source files.
* <http://astyle.sourceforge.net>
*
* Artistic Style is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Artistic Style is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Artistic Style. If not, see <http://www.gnu.org/licenses/>.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/

#ifndef ASLOCALIZER_H
#define ASLOCALIZER_H

namespace astyle
{

#ifndef ASTYLE_LIB

//-----------------------------------------------------------------------------
// ASLocalizer class for console build.
// This class encapsulates all language-dependent settings and is a
// generalization of the C locale concept.
//-----------------------------------------------------------------------------
class Translation;

class ASLocalizer
{
public: // functions
ASLocalizer();
virtual ~ASLocalizer();
string getLanguageID() const;
const Translation* getTranslationClass() const;
#ifdef _WIN32
void setLanguageFromLCID(size_t lcid);
#endif
void setLanguageFromName(const char* langID);
const char* settext(const char* textIn) const;

private: // functions
void setTranslationClass();

private: // variables
Translation* m_translation; // pointer to a polymorphic Translation class
string m_langID; // language identifier from the locale
string m_subLangID; // sub language identifier, if needed
string m_localeName; // name of the current locale (Linux only)
size_t m_lcid; // LCID of the user locale (Windows only)
};

//----------------------------------------------------------------------------
// Translation base class.
//----------------------------------------------------------------------------

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.
// NOTE: this class must have virtual methods for typeid() to work.
{
public:
Translation() {};
string convertToMultiByte(const wstring& wideStr) const;
size_t getTranslationVectorSize() const;
bool getWideTranslation(const string& stringIn, wstring& wideOut) const;
string& translate(const string& stringIn) const;

protected:
void addPair(const string& english, const wstring& translated);
// variables
vector<pair<string, wstring> > m_translation; // translation vector

private:
// unused method so the class will be identified as polymorphic
virtual void virtualClass() {}
};

//----------------------------------------------------------------------------
// Translation classes
// One class for each language.
// These classes have only a constructor which builds the language vector.
//----------------------------------------------------------------------------

class ChineseSimplified : public Translation
{
public:
ChineseSimplified();
};

class ChineseTraditional : public Translation
{
public:
ChineseTraditional();
};

class English : public Translation
{
public:
English();
};

class French : public Translation
{
public:
French();
};

class German : public Translation
{
public:
German();
};

class Hindi : public Translation
{
public:
Hindi();
};

class Spanish : public Translation
{
public:
Spanish();
};

#endif // ASTYLE_LIB

} // namespace astyle

#endif // ASLOCALIZER_H
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* ASLocalizer.h
*
* Copyright (C) 2006-2011 by Jim Pattee <jimp03@email.com>
* Copyright (C) 1998-2002 by Tal Davidson
* <http://www.gnu.org/licenses/lgpl-3.0.html>
*
* This file is a part of Artistic Style - an indentation and
* reformatting tool for C, C++, C# and Java source files.
* <http://astyle.sourceforge.net>
*
* Artistic Style is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Artistic Style is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Artistic Style. If not, see <http://www.gnu.org/licenses/>.
*
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*/

#ifndef ASLOCALIZER_H
#define ASLOCALIZER_H

#include <string>
#include <vector>

using namespace std;

namespace astyle
{

#ifndef ASTYLE_LIB

//-----------------------------------------------------------------------------
// ASLocalizer class for console build.
// This class encapsulates all language-dependent settings and is a
// generalization of the C locale concept.
//-----------------------------------------------------------------------------
class Translation;

class ASLocalizer
{
public: // functions
ASLocalizer();
virtual ~ASLocalizer();
string getLanguageID() const;
const Translation* getTranslationClass() const;
#ifdef _WIN32
void setLanguageFromLCID(size_t lcid);
#endif
void setLanguageFromName(const char* langID);
const char* settext(const char* textIn) const;

private: // functions
void setTranslationClass();

private: // variables
Translation* m_translation; // pointer to a polymorphic Translation class
string m_langID; // language identifier from the locale
string m_subLangID; // sub language identifier, if needed
string m_localeName; // name of the current locale (Linux only)
size_t m_lcid; // LCID of the user locale (Windows only)
};

//----------------------------------------------------------------------------
// Translation base class.
//----------------------------------------------------------------------------

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.
// NOTE: This class must have virtual methods for typeid() to work.
// typeid() is used by AStyleTestI18n_Localizer.cpp.
{
public:
Translation() {}
virtual ~Translation() {}
string convertToMultiByte(const wstring &wideStr) const;
size_t getTranslationVectorSize() const;
bool getWideTranslation(const string &stringIn, wstring &wideOut) const;
string &translate(const string &stringIn) const;

protected:
void addPair(const string &english, const wstring &translated);
// variables
vector<pair<string, wstring> > m_translation; // translation vector
};

//----------------------------------------------------------------------------
// Translation classes
// One class for each language.
// These classes have only a constructor which builds the language vector.
//----------------------------------------------------------------------------

class ChineseSimplified : public Translation
{
public:
ChineseSimplified();
};

class ChineseTraditional : public Translation
{
public:
ChineseTraditional();
};

class Dutch : public Translation
{
public:
Dutch();
};

class English : public Translation
{
public:
English();
};

class Finnish : public Translation
{
public:
Finnish();
};

class French : public Translation
{
public:
French();
};

class German : public Translation
{
public:
German();
};

class Hindi : public Translation
{
public:
Hindi();
};

class Italian : public Translation
{
public:
Italian();
};

class Japanese : public Translation
{
public:
Japanese();
};

class Korean : public Translation
{
public:
Korean();
};

class Polish : public Translation
{
public:
Polish();
};

class Portuguese : public Translation
{
public:
Portuguese();
};

class Russian : public Translation
{
public:
Russian();
};

class Spanish : public Translation
{
public:
Spanish();
};

class Swedish : public Translation
{
public:
Swedish();
};

class Ukrainian : public Translation
{
public:
Ukrainian();
};


#endif // ASTYLE_LIB

} // namespace astyle

#endif // ASLOCALIZER_H
Loading

0 comments on commit 736204b

Please sign in to comment.