mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-19 13:40:49 +03:00
Coding - Apply .clang-format formatting #286
Update empty method guards to new style with regex (see PR). Used clang-format 18.1.8. New actions to validate code formatting is added. Update .clang-format with disabling of include sorting. It is temporary changes, then include will be sorted. Apply formatting for /src and /tools folder. The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
// distribution for complete text of the license and disclaimer of any warranty.
|
||||
//
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
#include <inspector/TInspector_Preferences.hxx>
|
||||
|
||||
@@ -28,15 +28,15 @@
|
||||
// function : GetPreferences
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::GetPreferences (const TCollection_AsciiString& thePluginName,
|
||||
TInspectorAPI_PreferencesDataMap& theItem)
|
||||
void TInspector_Preferences::GetPreferences(const TCollection_AsciiString& thePluginName,
|
||||
TInspectorAPI_PreferencesDataMap& theItem)
|
||||
{
|
||||
if (!myIsLoadedPreferences)
|
||||
{
|
||||
loadPreferences();
|
||||
myIsLoadedPreferences = Standard_True;
|
||||
}
|
||||
myLoadedPreferences.Find (thePluginName, theItem);
|
||||
myLoadedPreferences.Find(thePluginName, theItem);
|
||||
}
|
||||
|
||||
// =======================================================================
|
||||
@@ -48,37 +48,46 @@ void TInspector_Preferences::StorePreferences()
|
||||
if (myLoadedPreferences.IsEmpty())
|
||||
return;
|
||||
|
||||
QString aFileName = QString (GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QString aFileName =
|
||||
QString(GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QFile aFile(aFileName);
|
||||
if (!aFile.open (QFile::WriteOnly))
|
||||
if (!aFile.open(QFile::WriteOnly))
|
||||
return;
|
||||
|
||||
QDomDocument aDomDocument (documentKey());
|
||||
QDomComment aComment = aDomDocument.createComment("\nThis file is automatically created by TInspector application.\nChanges made in this file can be lost.\n");
|
||||
aDomDocument.appendChild (aComment);
|
||||
QDomElement aRootElement = aDomDocument.createElement (documentKey());
|
||||
aDomDocument.appendChild (aRootElement);
|
||||
QDomDocument aDomDocument(documentKey());
|
||||
QDomComment aComment =
|
||||
aDomDocument.createComment("\nThis file is automatically created by TInspector "
|
||||
"application.\nChanges made in this file can be lost.\n");
|
||||
aDomDocument.appendChild(aComment);
|
||||
QDomElement aRootElement = aDomDocument.createElement(documentKey());
|
||||
aDomDocument.appendChild(aRootElement);
|
||||
|
||||
for (NCollection_DataMap<TCollection_AsciiString, TInspectorAPI_PreferencesDataMap>::Iterator aPrefsIt (myLoadedPreferences);
|
||||
aPrefsIt.More(); aPrefsIt.Next())
|
||||
for (NCollection_DataMap<TCollection_AsciiString, TInspectorAPI_PreferencesDataMap>::Iterator
|
||||
aPrefsIt(myLoadedPreferences);
|
||||
aPrefsIt.More();
|
||||
aPrefsIt.Next())
|
||||
{
|
||||
QDomElement aPluginElement = aDomDocument.createElement (pluginKey());
|
||||
aPluginElement.setAttribute (nameKey(), aPrefsIt.Key().ToCString());
|
||||
aRootElement.appendChild (aPluginElement);
|
||||
QDomElement aPluginElement = aDomDocument.createElement(pluginKey());
|
||||
aPluginElement.setAttribute(nameKey(), aPrefsIt.Key().ToCString());
|
||||
aRootElement.appendChild(aPluginElement);
|
||||
|
||||
const TInspectorAPI_PreferencesDataMap& aPluginMap = aPrefsIt.Value();
|
||||
for (TInspectorAPI_IteratorOfPreferencesDataMap aPluginPrefsIt (aPluginMap); aPluginPrefsIt.More(); aPluginPrefsIt.Next())
|
||||
for (TInspectorAPI_IteratorOfPreferencesDataMap aPluginPrefsIt(aPluginMap);
|
||||
aPluginPrefsIt.More();
|
||||
aPluginPrefsIt.Next())
|
||||
{
|
||||
QDomElement aParameterElement = aDomDocument.createElement (parameterKey());
|
||||
aParameterElement.setAttribute (nameKey(), aPluginPrefsIt.Key().ToCString());
|
||||
aParameterElement.setAttribute (valueKey(), aPluginPrefsIt.Value().ToCString());
|
||||
aPluginElement.appendChild (aParameterElement);
|
||||
QDomElement aParameterElement = aDomDocument.createElement(parameterKey());
|
||||
aParameterElement.setAttribute(nameKey(), aPluginPrefsIt.Key().ToCString());
|
||||
aParameterElement.setAttribute(valueKey(), aPluginPrefsIt.Value().ToCString());
|
||||
aPluginElement.appendChild(aParameterElement);
|
||||
}
|
||||
}
|
||||
|
||||
QTextStream aTextStream (&aFile);
|
||||
QStringList aDocumentStr = aDomDocument.toString().split ("\n");
|
||||
for (QStringList::ConstIterator aContentIt = aDocumentStr.begin(); aContentIt != aDocumentStr.end(); ++aContentIt)
|
||||
QTextStream aTextStream(&aFile);
|
||||
QStringList aDocumentStr = aDomDocument.toString().split("\n");
|
||||
for (QStringList::ConstIterator aContentIt = aDocumentStr.begin();
|
||||
aContentIt != aDocumentStr.end();
|
||||
++aContentIt)
|
||||
{
|
||||
aTextStream << *aContentIt << '\n';
|
||||
}
|
||||
@@ -91,10 +100,11 @@ void TInspector_Preferences::StorePreferences()
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::RemovePreferences()
|
||||
{
|
||||
QString aFileName = QString (GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QDir aDir (GetDirectory().ToCString());
|
||||
if (aDir.exists (aFileName))
|
||||
aDir.remove (aFileName);
|
||||
QString aFileName =
|
||||
QString(GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QDir aDir(GetDirectory().ToCString());
|
||||
if (aDir.exists(aFileName))
|
||||
aDir.remove(aFileName);
|
||||
reset();
|
||||
}
|
||||
|
||||
@@ -104,13 +114,14 @@ void TInspector_Preferences::RemovePreferences()
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::loadPreferences()
|
||||
{
|
||||
QString aFileName = QString (GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QFile aFile (aFileName);
|
||||
if (!aFile.open (QFile::ReadOnly))
|
||||
QString aFileName =
|
||||
QString(GetDirectory().ToCString()) + QDir::separator() + PreferencesFileName();
|
||||
QFile aFile(aFileName);
|
||||
if (!aFile.open(QFile::ReadOnly))
|
||||
return;
|
||||
|
||||
QDomDocument aDomDocument;
|
||||
bool aResult = aDomDocument.setContent (&aFile);
|
||||
bool aResult = aDomDocument.setContent(&aFile);
|
||||
aFile.close();
|
||||
if (!aResult)
|
||||
return;
|
||||
@@ -125,11 +136,11 @@ void TInspector_Preferences::loadPreferences()
|
||||
if (aPluginNode.isElement())
|
||||
{
|
||||
QDomElement aPluginElement = aPluginNode.toElement();
|
||||
if (aPluginElement.tagName() == pluginKey() && aPluginElement.hasAttribute (nameKey()))
|
||||
if (aPluginElement.tagName() == pluginKey() && aPluginElement.hasAttribute(nameKey()))
|
||||
{
|
||||
TInspectorAPI_PreferencesDataMap anItem;
|
||||
readPluginItem (aPluginElement, anItem);
|
||||
myLoadedPreferences.Bind (aPluginElement.attribute (nameKey()).toStdString().c_str(), anItem);
|
||||
readPluginItem(aPluginElement, anItem);
|
||||
myLoadedPreferences.Bind(aPluginElement.attribute(nameKey()).toStdString().c_str(), anItem);
|
||||
}
|
||||
}
|
||||
aPluginNode = aPluginNode.nextSibling();
|
||||
@@ -140,7 +151,8 @@ void TInspector_Preferences::loadPreferences()
|
||||
// function : readPluginItem
|
||||
// purpose :
|
||||
// =======================================================================
|
||||
void TInspector_Preferences::readPluginItem (const QDomElement thePluginElement, TInspectorAPI_PreferencesDataMap& theItem)
|
||||
void TInspector_Preferences::readPluginItem(const QDomElement thePluginElement,
|
||||
TInspectorAPI_PreferencesDataMap& theItem)
|
||||
{
|
||||
QDomNode aParameterNode = thePluginElement.firstChild();
|
||||
while (!aParameterNode.isNull())
|
||||
@@ -148,11 +160,11 @@ void TInspector_Preferences::readPluginItem (const QDomElement thePluginElement,
|
||||
if (aParameterNode.isElement())
|
||||
{
|
||||
QDomElement aParameterElement = aParameterNode.toElement();
|
||||
if (aParameterElement.tagName() == parameterKey() &&
|
||||
aParameterElement.hasAttribute (nameKey()) && aParameterElement.hasAttribute (valueKey()))
|
||||
if (aParameterElement.tagName() == parameterKey() && aParameterElement.hasAttribute(nameKey())
|
||||
&& aParameterElement.hasAttribute(valueKey()))
|
||||
{
|
||||
theItem.Bind (aParameterElement.attribute (nameKey()).toStdString().c_str(),
|
||||
aParameterElement.attribute (valueKey()).toStdString().c_str());
|
||||
theItem.Bind(aParameterElement.attribute(nameKey()).toStdString().c_str(),
|
||||
aParameterElement.attribute(valueKey()).toStdString().c_str());
|
||||
}
|
||||
}
|
||||
aParameterNode = aParameterNode.nextSibling();
|
||||
|
Reference in New Issue
Block a user