1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-04 13:13:25 +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:
dpasukhi
2025-01-25 20:15:22 +00:00
parent dbba6f1289
commit a5a7b3185b
14005 changed files with 1273539 additions and 1195567 deletions

View File

@@ -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/TInspectorAPI_Communicator.hxx>
@@ -20,9 +20,9 @@
#include <iostream>
#ifdef _WIN32
#include <windows.h>
#include <windows.h>
#else
#include <dlfcn.h>
#include <dlfcn.h>
#endif
#define LIB_HANDLE HINSTANCE
@@ -31,8 +31,8 @@
// function : LoadPluginLibrary
// purpose :
// =======================================================================
TInspectorAPI_Communicator* TInspectorAPI_Communicator::LoadPluginLibrary
(const TCollection_AsciiString& thePluginName)
TInspectorAPI_Communicator* TInspectorAPI_Communicator::LoadPluginLibrary(
const TCollection_AsciiString& thePluginName)
{
if (thePluginName.IsEmpty())
std::cout << thePluginName.ToCString() << "%s plugin could not be loaded." << std::endl;
@@ -40,10 +40,10 @@ TInspectorAPI_Communicator* TInspectorAPI_Communicator::LoadPluginLibrary
#ifdef _WIN32
aPluginLibraryName += ".dll";
#elif __APPLE__
aPluginLibraryName.Prepend ("lib");
aPluginLibraryName += ".dylib";
aPluginLibraryName.Prepend("lib");
aPluginLibraryName += ".dylib";
#else
aPluginLibraryName.Prepend ("lib");
aPluginLibraryName.Prepend("lib");
aPluginLibraryName += ".so";
#endif
@@ -64,7 +64,8 @@ TInspectorAPI_Communicator* TInspectorAPI_Communicator::LoadPluginLibrary
crtInst = (COMMUNICATOR_INSTANCE)dlsym(modLib, CREATE_COMMUNICATOR_FUNCTION_NAME);
#endif
if (!crtInst)
std::cout << "Failed to find " << CREATE_COMMUNICATOR_FUNCTION_NAME << " function." << std::endl;
std::cout << "Failed to find " << CREATE_COMMUNICATOR_FUNCTION_NAME << " function."
<< std::endl;
}
TInspectorAPI_Communicator* aModule = crtInst ? crtInst() : 0;
return aModule;

View File

@@ -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.
#ifndef TInspectorAPI_Communicator_H
#define TInspectorAPI_Communicator_H
@@ -25,37 +25,40 @@
//! It will be placed in layout of the given parent. After the plugin is created, it is possible to
//! set container of parameters into plugin to provide the plugin's initialization by some external
//! objects(e.g. Interactive Context or OCAF Application). If the parameters are changed, it may be
//! applied in UpdateContent function. The communicator can change parameters in the following cases:
//! applied in UpdateContent function. The communicator can change parameters in the following
//! cases:
//! - the plugin removes own processed parameters (e.g. file names, that was opened by the plugin)
//! - the plugin sends some parameters to another plugin(by name) (e.g. shape to be analyzed)
//! (at the same time we should be careful here to do not change essential parameters of other plugins)
//! (at the same time we should be careful here to do not change essential parameters of other
//! plugins)
class TInspectorAPI_Communicator
{
public:
//! Loads the plugin library
//! \param thePluginName the name of the library
//! \return an instance of the communicator or NULL
static Standard_EXPORT TInspectorAPI_Communicator* LoadPluginLibrary (const TCollection_AsciiString& thePluginName);
static Standard_EXPORT TInspectorAPI_Communicator* LoadPluginLibrary(
const TCollection_AsciiString& thePluginName);
//! Sets parameters container, it should be used when the plugin is initialized or in update content
//! \param theParameters a parameters container
Standard_EXPORT virtual void SetParameters (const Handle(TInspectorAPI_PluginParameters)& theParameters) = 0;
//! Sets parameters container, it should be used when the plugin is initialized or in update
//! content \param theParameters a parameters container
Standard_EXPORT virtual void SetParameters(
const Handle(TInspectorAPI_PluginParameters)& theParameters) = 0;
//! Provides the container with a parent where this container should be inserted.
//! If Qt implementation, it should be QWidget with QLayout set inside
//! \param theParent a parent class
Standard_EXPORT virtual void SetParent (void* theParent) = 0;
Standard_EXPORT virtual void SetParent(void* theParent) = 0;
//! Provides container for actions available in inspector on general level
//! \param theMenu if Qt implementation, it is QMenu object
virtual void FillActionsMenu (void* theMenu) { (void)theMenu; }
virtual void FillActionsMenu(void* theMenu) { (void)theMenu; }
//! Returns plugin preferences, empty implementation by default
virtual void GetPreferences (TInspectorAPI_PreferencesDataMap&) {}
virtual void GetPreferences(TInspectorAPI_PreferencesDataMap&) {}
//! Applies plugin preferences, empty implementation by default
virtual void SetPreferences (const TInspectorAPI_PreferencesDataMap&) {}
virtual void SetPreferences(const TInspectorAPI_PreferencesDataMap&) {}
//! Calls update of the plugin's content
Standard_EXPORT virtual void UpdateContent() = 0;

View File

@@ -11,40 +11,41 @@
// 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/TInspectorAPI_PluginParameters.hxx>
IMPLEMENT_STANDARD_RTTIEXT (TInspectorAPI_PluginParameters, Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(TInspectorAPI_PluginParameters, Standard_Transient)
// =======================================================================
// function : SetParameters
// purpose :
// =======================================================================
void TInspectorAPI_PluginParameters::SetParameters (const TCollection_AsciiString& thePluginName,
const NCollection_List<Handle(Standard_Transient)>& theParameters,
const Standard_Boolean&)
void TInspectorAPI_PluginParameters::SetParameters(
const TCollection_AsciiString& thePluginName,
const NCollection_List<Handle(Standard_Transient)>& theParameters,
const Standard_Boolean&)
{
if (theParameters.Size() > 0)
myParameters.Bind (thePluginName, theParameters);
myParameters.Bind(thePluginName, theParameters);
else
myParameters.UnBind (thePluginName);
myParameters.UnBind(thePluginName);
}
// =======================================================================
// function : AddFileName
// purpose :
// =======================================================================
void TInspectorAPI_PluginParameters::AddFileName (const TCollection_AsciiString& thePluginName,
const TCollection_AsciiString& theFileName)
void TInspectorAPI_PluginParameters::AddFileName(const TCollection_AsciiString& thePluginName,
const TCollection_AsciiString& theFileName)
{
if (myFileNames.IsBound (thePluginName))
myFileNames.ChangeFind (thePluginName).Append (theFileName);
if (myFileNames.IsBound(thePluginName))
myFileNames.ChangeFind(thePluginName).Append(theFileName);
else
{
NCollection_List<TCollection_AsciiString> aNames;
aNames.Append (theFileName);
myFileNames.Bind (thePluginName, aNames);
aNames.Append(theFileName);
myFileNames.Bind(thePluginName, aNames);
}
}
@@ -52,122 +53,126 @@ void TInspectorAPI_PluginParameters::AddFileName (const TCollection_AsciiString&
// function : SetFileNames
// purpose :
// =======================================================================
void TInspectorAPI_PluginParameters::SetFileNames (const TCollection_AsciiString& thePluginName,
const NCollection_List<TCollection_AsciiString>& theFileNames)
void TInspectorAPI_PluginParameters::SetFileNames(
const TCollection_AsciiString& thePluginName,
const NCollection_List<TCollection_AsciiString>& theFileNames)
{
if (theFileNames.Size() > 0)
myFileNames.Bind (thePluginName, theFileNames);
myFileNames.Bind(thePluginName, theFileNames);
else
myFileNames.UnBind (thePluginName);
myFileNames.UnBind(thePluginName);
}
// =======================================================================
// function : SetSelectedNames
// purpose :
// =======================================================================
void TInspectorAPI_PluginParameters::SetSelectedNames (const TCollection_AsciiString& thePluginName,
const NCollection_List<TCollection_AsciiString>& theItemNames)
void TInspectorAPI_PluginParameters::SetSelectedNames(
const TCollection_AsciiString& thePluginName,
const NCollection_List<TCollection_AsciiString>& theItemNames)
{
mySelectedItemNames.Bind (thePluginName, theItemNames);
mySelectedItemNames.Bind(thePluginName, theItemNames);
}
// =======================================================================
// function : SetSelected
// purpose :
// =======================================================================
void TInspectorAPI_PluginParameters::SetSelected (const TCollection_AsciiString& thePluginName,
const NCollection_List<Handle(Standard_Transient)>& theObjects)
void TInspectorAPI_PluginParameters::SetSelected(
const TCollection_AsciiString& thePluginName,
const NCollection_List<Handle(Standard_Transient)>& theObjects)
{
if (theObjects.Size() > 0)
mySelectedObjects.Bind (thePluginName, theObjects);
mySelectedObjects.Bind(thePluginName, theObjects);
else
mySelectedObjects.UnBind (thePluginName);
mySelectedObjects.UnBind(thePluginName);
}
// =======================================================================
// function : FindParameters
// purpose :
// =======================================================================
bool TInspectorAPI_PluginParameters::FindParameters (const TCollection_AsciiString& thePluginName)
bool TInspectorAPI_PluginParameters::FindParameters(const TCollection_AsciiString& thePluginName)
{
return myParameters.IsBound (thePluginName);
return myParameters.IsBound(thePluginName);
}
// =======================================================================
// function : Parameters
// purpose :
// =======================================================================
const NCollection_List<Handle(Standard_Transient)>& TInspectorAPI_PluginParameters::Parameters
(const TCollection_AsciiString& thePluginName)
const NCollection_List<Handle(Standard_Transient)>& TInspectorAPI_PluginParameters::Parameters(
const TCollection_AsciiString& thePluginName)
{
return myParameters.Find (thePluginName);
return myParameters.Find(thePluginName);
}
// =======================================================================
// function : FindFileNames
// purpose :
// =======================================================================
bool TInspectorAPI_PluginParameters::FindFileNames (const TCollection_AsciiString& thePluginName)
bool TInspectorAPI_PluginParameters::FindFileNames(const TCollection_AsciiString& thePluginName)
{
return myFileNames.IsBound (thePluginName);
return myFileNames.IsBound(thePluginName);
}
// =======================================================================
// function : FileNames
// purpose :
// =======================================================================
const NCollection_List<TCollection_AsciiString>& TInspectorAPI_PluginParameters::FileNames
(const TCollection_AsciiString& thePluginName)
const NCollection_List<TCollection_AsciiString>& TInspectorAPI_PluginParameters::FileNames(
const TCollection_AsciiString& thePluginName)
{
return myFileNames.Find (thePluginName);
return myFileNames.Find(thePluginName);
}
// =======================================================================
// function : FindSelectedNames
// purpose :
// =======================================================================
bool TInspectorAPI_PluginParameters::FindSelectedNames (const TCollection_AsciiString& thePluginName)
bool TInspectorAPI_PluginParameters::FindSelectedNames(const TCollection_AsciiString& thePluginName)
{
return mySelectedItemNames.IsBound (thePluginName);
return mySelectedItemNames.IsBound(thePluginName);
}
// =======================================================================
// function : GetSelectedNames
// purpose :
// =======================================================================
const NCollection_List<TCollection_AsciiString>& TInspectorAPI_PluginParameters::GetSelectedNames
(const TCollection_AsciiString& thePluginName)
const NCollection_List<TCollection_AsciiString>& TInspectorAPI_PluginParameters::GetSelectedNames(
const TCollection_AsciiString& thePluginName)
{
return mySelectedItemNames.Find (thePluginName);
return mySelectedItemNames.Find(thePluginName);
}
// =======================================================================
// function : GetSelectedObjects
// purpose :
// =======================================================================
Standard_Boolean TInspectorAPI_PluginParameters::GetSelectedObjects (const TCollection_AsciiString& thePluginName,
NCollection_List<Handle(Standard_Transient)>& theObjects)
Standard_Boolean TInspectorAPI_PluginParameters::GetSelectedObjects(
const TCollection_AsciiString& thePluginName,
NCollection_List<Handle(Standard_Transient)>& theObjects)
{
return mySelectedObjects.Find (thePluginName, theObjects);
return mySelectedObjects.Find(thePluginName, theObjects);
}
// =======================================================================
// function : toString
// purpose :
// =======================================================================
TCollection_AsciiString toString (const TopLoc_Location& theLocation)
TCollection_AsciiString toString(const TopLoc_Location& theLocation)
{
TCollection_AsciiString anInfo;
gp_Trsf aTrsf = theLocation.Transformation();
gp_Trsf aTrsf = theLocation.Transformation();
for (int aRowId = 1; aRowId <= 3; aRowId++)
{
if (!anInfo.IsEmpty())
anInfo += " ";
anInfo += " ";
for (int aColumnId = 1; aColumnId <= 4; aColumnId++)
{
if (aColumnId > 1)
anInfo += ",";
anInfo += TCollection_AsciiString (aTrsf.Value (aRowId, aColumnId));
anInfo += TCollection_AsciiString(aTrsf.Value(aRowId, aColumnId));
}
}
return anInfo;
@@ -177,104 +182,114 @@ TCollection_AsciiString toString (const TopLoc_Location& theLocation)
// function : ParametersToString
// purpose :
// =======================================================================
TCollection_AsciiString TInspectorAPI_PluginParameters::ParametersToString (const TopoDS_Shape& theShape)
TCollection_AsciiString TInspectorAPI_PluginParameters::ParametersToString(
const TopoDS_Shape& theShape)
{
const TopLoc_Location& aLocation = theShape.Location();
TCollection_AsciiString aLocationStr = toString (aLocation);
const TopLoc_Location& aLocation = theShape.Location();
TCollection_AsciiString aLocationStr = toString(aLocation);
TopAbs_Orientation anOrientation = theShape.Orientation();
Standard_SStream aSStream;
TopAbs::Print (anOrientation, aSStream);
return TCollection_AsciiString (aSStream.str().c_str()) + ":" + aLocationStr;
Standard_SStream aSStream;
TopAbs::Print(anOrientation, aSStream);
return TCollection_AsciiString(aSStream.str().c_str()) + ":" + aLocationStr;
}
// =======================================================================
// function : fromString
// purpose :
// =======================================================================
TopLoc_Location fromString (const TCollection_AsciiString& theValue)
TopLoc_Location fromString(const TCollection_AsciiString& theValue)
{
NCollection_Mat4<Standard_Real> aValues;
TCollection_AsciiString aCurrentString = theValue;
Standard_Integer aPosition = aCurrentString.Search (" ");
Standard_Integer aPosition = aCurrentString.Search(" ");
if (aPosition < 0)
return TopLoc_Location();
TCollection_AsciiString aTailString = aCurrentString.Split (aPosition);
Standard_Integer aRow = 0;
TCollection_AsciiString aTailString = aCurrentString.Split(aPosition);
Standard_Integer aRow = 0;
while (!aCurrentString.IsEmpty())
{
TCollection_AsciiString aValueString = aCurrentString;
aPosition = aValueString.Search (",");
if (aPosition < 0 )
aPosition = aValueString.Search(",");
if (aPosition < 0)
break;
aCurrentString = aValueString.Split (aPosition);
aCurrentString = aValueString.Split(aPosition);
Standard_Integer aColumn = 0;
while (!aValueString.IsEmpty())
{
aPosition = aCurrentString.Search (" ");
aPosition = aCurrentString.Search(" ");
if (aPosition > 0)
aValueString.Split (aValueString.Length() - 1);
aValueString.Split(aValueString.Length() - 1);
aValues.SetValue (aRow, aColumn, aValueString.RealValue());
aValues.SetValue(aRow, aColumn, aValueString.RealValue());
aColumn++;
if (aCurrentString.IsEmpty())
break;
aValueString = aCurrentString;
aPosition = aValueString.Search (",");
if (aPosition < 0 )
aPosition = aValueString.Search(",");
if (aPosition < 0)
{
aValueString = aCurrentString;
aValueString = aCurrentString;
aCurrentString = TCollection_AsciiString();
}
else
aCurrentString = aValueString.Split (aPosition);
aCurrentString = aValueString.Split(aPosition);
}
if (aTailString.IsEmpty())
break;
aCurrentString = aTailString;
aPosition = aCurrentString.Search (" ");
if (aPosition < 0 )
aPosition = aCurrentString.Search(" ");
if (aPosition < 0)
{
aCurrentString = aTailString;
aTailString = TCollection_AsciiString();
aTailString = TCollection_AsciiString();
}
else
aTailString = aCurrentString.Split (aPosition);
aTailString = aCurrentString.Split(aPosition);
aRow++;
}
//if (aValues.Rows() != 3 || aValues.Cols() != 4)
// return TopLoc_Location();
// if (aValues.Rows() != 3 || aValues.Cols() != 4)
// return TopLoc_Location();
gp_Trsf aTrsf;
aTrsf.SetValues (aValues.GetValue (0, 0), aValues.GetValue (0, 1), aValues.GetValue (0, 2), aValues.GetValue (0, 3),
aValues.GetValue (1, 0), aValues.GetValue (1, 1), aValues.GetValue (1, 2), aValues.GetValue (1, 3),
aValues.GetValue (2, 0), aValues.GetValue (2, 1), aValues.GetValue (2, 2), aValues.GetValue (2, 3));
return TopLoc_Location (aTrsf);
aTrsf.SetValues(aValues.GetValue(0, 0),
aValues.GetValue(0, 1),
aValues.GetValue(0, 2),
aValues.GetValue(0, 3),
aValues.GetValue(1, 0),
aValues.GetValue(1, 1),
aValues.GetValue(1, 2),
aValues.GetValue(1, 3),
aValues.GetValue(2, 0),
aValues.GetValue(2, 1),
aValues.GetValue(2, 2),
aValues.GetValue(2, 3));
return TopLoc_Location(aTrsf);
}
// =======================================================================
// function : ParametersToShape
// purpose :
// =======================================================================
void TInspectorAPI_PluginParameters::ParametersToShape (const TCollection_AsciiString& theValue,
TopoDS_Shape& theShape)
void TInspectorAPI_PluginParameters::ParametersToShape(const TCollection_AsciiString& theValue,
TopoDS_Shape& theShape)
{
int aSeparatorPos = theValue.Search (":");
int aSeparatorPos = theValue.Search(":");
TCollection_AsciiString anOrientationStr = theValue;
TCollection_AsciiString aLocationStr = anOrientationStr.Split (aSeparatorPos);
TCollection_AsciiString aLocationStr = anOrientationStr.Split(aSeparatorPos);
// orientation
if (anOrientationStr.Length() < 2)
return;
anOrientationStr.Split (anOrientationStr.Length() - 1);
anOrientationStr.Split(anOrientationStr.Length() - 1);
TopAbs_Orientation anOrientation;
if (!TopAbs::ShapeOrientationFromString (anOrientationStr.ToCString(), anOrientation))
if (!TopAbs::ShapeOrientationFromString(anOrientationStr.ToCString(), anOrientation))
return;
// location
TopLoc_Location aLocation = fromString (aLocationStr);
TopLoc_Location aLocation = fromString(aLocationStr);
theShape.Location (aLocation);
theShape.Orientation (anOrientation);
theShape.Location(aLocation);
theShape.Orientation(anOrientation);
}

View File

@@ -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.
#ifndef TInspectorAPI_PluginParameters_H
#define TInspectorAPI_PluginParameters_H
@@ -24,15 +24,14 @@
#include <inspector/TInspectorAPI_PreferencesDataMap.hxx>
//! The container of parameters for all possible plugins. It stores list of parameters for each plugin, even
//! it was not be loaded yet. There is a map of plugin name into plugin parameters.
//! The parameters may be:
//! The container of parameters for all possible plugins. It stores list of parameters for each
//! plugin, even it was not be loaded yet. There is a map of plugin name into plugin parameters. The
//! parameters may be:
//! - child of Standard_Transient
//! - file name to be opened by the plugin
class TInspectorAPI_PluginParameters : public Standard_Transient
{
public:
//! Constructs the container.
Standard_EXPORT TInspectorAPI_PluginParameters() {}
@@ -42,75 +41,84 @@ public:
//! Stores the parameters for plugin
//! \param thePluginName a plugin name
//! \param theParameters a list of parameters
//! \param theToActivatePlugin a state whether the plugin should be immediately activated, to be used in a heir
Standard_EXPORT virtual void SetParameters (const TCollection_AsciiString& thePluginName,
const NCollection_List<Handle(Standard_Transient)>& theParameters,
const Standard_Boolean& theToActivatePlugin = Standard_False);
//! \param theToActivatePlugin a state whether the plugin should be immediately activated, to be
//! used in a heir
Standard_EXPORT virtual void SetParameters(
const TCollection_AsciiString& thePluginName,
const NCollection_List<Handle(Standard_Transient)>& theParameters,
const Standard_Boolean& theToActivatePlugin = Standard_False);
//! Adds a file name for the plugin
//! \param thePluginName a plugin name
//! \param theFileName a name
Standard_EXPORT void AddFileName (const TCollection_AsciiString& thePluginName,
const TCollection_AsciiString& theFileName);
Standard_EXPORT void AddFileName(const TCollection_AsciiString& thePluginName,
const TCollection_AsciiString& theFileName);
//! Sets file names for the plugin
//! \param thePluginName a plugin name
//! \param theFileNames container of names
Standard_EXPORT void SetFileNames (const TCollection_AsciiString& thePluginName,
const NCollection_List<TCollection_AsciiString>& theFileNames);
Standard_EXPORT void SetFileNames(const TCollection_AsciiString& thePluginName,
const NCollection_List<TCollection_AsciiString>& theFileNames);
//! Sets a name of item to be selected in the plugin
//! \param thePluginName a plugin name
//! \param theItemNames a container of names to be selected
Standard_EXPORT void SetSelectedNames (const TCollection_AsciiString& thePluginName,
const NCollection_List<TCollection_AsciiString>& theItemNames);
Standard_EXPORT void SetSelectedNames(
const TCollection_AsciiString& thePluginName,
const NCollection_List<TCollection_AsciiString>& theItemNames);
//! Sets objects to be selected in the plugin
//! \param thePluginName a plugin name
//! \param theObjects an objects
Standard_EXPORT void SetSelected (const TCollection_AsciiString& thePluginName,
const NCollection_List<Handle(Standard_Transient)>& theObjects);
Standard_EXPORT void SetSelected(const TCollection_AsciiString& thePluginName,
const NCollection_List<Handle(Standard_Transient)>& theObjects);
//! Returns true if there are parameters set for the given plugin
//! \param thePluginName a plugin name
//! \return boolean result
Standard_EXPORT bool FindParameters (const TCollection_AsciiString& thePluginName);
Standard_EXPORT bool FindParameters(const TCollection_AsciiString& thePluginName);
//! Returns parameters set for the given plugin
//! \param thePluginName a plugin name
//! \return container of objects
Standard_EXPORT const NCollection_List<Handle(Standard_Transient)>& Parameters (const TCollection_AsciiString& thePluginName);
Standard_EXPORT const NCollection_List<Handle(Standard_Transient)>& Parameters(
const TCollection_AsciiString& thePluginName);
//! Returns true if there are file names set for the given plugin
//! \param thePluginName a plugin name
//! \return boolean result
Standard_EXPORT bool FindFileNames (const TCollection_AsciiString& thePluginName);
Standard_EXPORT bool FindFileNames(const TCollection_AsciiString& thePluginName);
//! Returns file names set for the given plugin
//! \param thePluginName a plugin name
//! \return container of names
Standard_EXPORT const NCollection_List<TCollection_AsciiString>& FileNames (const TCollection_AsciiString& thePluginName);
Standard_EXPORT const NCollection_List<TCollection_AsciiString>& FileNames(
const TCollection_AsciiString& thePluginName);
//! Returns true if there are file names set for the given plugin
//! \param thePluginName a plugin name
//! \return boolean result
Standard_EXPORT bool FindSelectedNames (const TCollection_AsciiString& thePluginName);
Standard_EXPORT bool FindSelectedNames(const TCollection_AsciiString& thePluginName);
//! Returns name to be selected in the plugin
//! \param thePluginName a plugin name
//! \return container of names
Standard_EXPORT const NCollection_List<TCollection_AsciiString>& GetSelectedNames (
const TCollection_AsciiString& thePluginName);
Standard_EXPORT const NCollection_List<TCollection_AsciiString>& GetSelectedNames(
const TCollection_AsciiString& thePluginName);
//! Returns objects set for the given plugin
//! \param thePluginName a plugin name
//! \return container of objects
Standard_EXPORT Standard_Boolean GetSelectedObjects (const TCollection_AsciiString& thePluginName,
NCollection_List<Handle(Standard_Transient)>& theObjects);
Standard_EXPORT Standard_Boolean
GetSelectedObjects(const TCollection_AsciiString& thePluginName,
NCollection_List<Handle(Standard_Transient)>& theObjects);
//! Sets path to a directory for temporary plugin files
//! \param thePath a path
virtual void SetTemporaryDirectory (const TCollection_AsciiString& thePath) { myTemporaryDirectory = thePath; }
virtual void SetTemporaryDirectory(const TCollection_AsciiString& thePath)
{
myTemporaryDirectory = thePath;
}
//! Returns path to a directory for temporary plugin files
//! \return path
@@ -118,39 +126,43 @@ public:
//! Returns plugin preferences
//! \param thePluginName a plugin name
Standard_EXPORT virtual void GetPreferences (const TCollection_AsciiString& thePluginName,
TInspectorAPI_PreferencesDataMap& theItem) = 0;
Standard_EXPORT virtual void GetPreferences(const TCollection_AsciiString& thePluginName,
TInspectorAPI_PreferencesDataMap& theItem) = 0;
//! Stores plugin preferences
//! \param thePluginName a plugin name
//! \theItem container of plugin preferences values in form: <name, value>
Standard_EXPORT virtual void SetPreferences (const TCollection_AsciiString& thePluginName,
const TInspectorAPI_PreferencesDataMap& theItem) = 0;
Standard_EXPORT virtual void SetPreferences(const TCollection_AsciiString& thePluginName,
const TInspectorAPI_PreferencesDataMap& theItem) = 0;
//! Stores plugin preferences into a preferences file
Standard_EXPORT virtual void StorePreferences() = 0;
//! Converts a Shape parameters excepting TShape into a string value
//! \param theShape processed shape
//! \param theShape processed shape
//! \return string instance
Standard_EXPORT static TCollection_AsciiString ParametersToString (const TopoDS_Shape& theShape);
Standard_EXPORT static TCollection_AsciiString ParametersToString(const TopoDS_Shape& theShape);
//! Converts a Shape parameters excepting TShape into a string value
//! \param theValue parameters string value (without TShape information)
//! \param theShape processed shape
Standard_EXPORT static void ParametersToShape (const TCollection_AsciiString& theValue, TopoDS_Shape& theShape);
//! \param theShape processed shape
Standard_EXPORT static void ParametersToShape(const TCollection_AsciiString& theValue,
TopoDS_Shape& theShape);
DEFINE_STANDARD_RTTIEXT (TInspectorAPI_PluginParameters, Standard_Transient)
DEFINE_STANDARD_RTTIEXT(TInspectorAPI_PluginParameters, Standard_Transient)
private:
//! container of parameters
NCollection_DataMap<TCollection_AsciiString, NCollection_List<Handle(Standard_Transient)> > myParameters;
NCollection_DataMap<TCollection_AsciiString, NCollection_List<Handle(Standard_Transient)>>
myParameters;
//! container of names
NCollection_DataMap<TCollection_AsciiString, NCollection_List<TCollection_AsciiString> > myFileNames;
NCollection_DataMap<TCollection_AsciiString, NCollection_List<TCollection_AsciiString>>
myFileNames;
//! container of select item names
NCollection_DataMap<TCollection_AsciiString, NCollection_List<TCollection_AsciiString> > mySelectedItemNames;
NCollection_DataMap<TCollection_AsciiString, NCollection_List<TCollection_AsciiString>>
mySelectedItemNames;
//! container of select objects
NCollection_DataMap<TCollection_AsciiString, NCollection_List<Handle(Standard_Transient)> > mySelectedObjects;
NCollection_DataMap<TCollection_AsciiString, NCollection_List<Handle(Standard_Transient)>>
mySelectedObjects;
//! temporary directory for saving plugin preferences
TCollection_AsciiString myTemporaryDirectory;
};

View File

@@ -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.
#ifndef TInspectorAPI_PreferencesDataMap_H
#define TInspectorAPI_PreferencesDataMap_H
@@ -19,7 +19,9 @@
#include <NCollection_DataMap.hxx>
#include <TCollection_AsciiString.hxx>
typedef NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString> TInspectorAPI_PreferencesDataMap;
typedef NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>::Iterator TInspectorAPI_IteratorOfPreferencesDataMap;
typedef NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>
TInspectorAPI_PreferencesDataMap;
typedef NCollection_DataMap<TCollection_AsciiString, TCollection_AsciiString>::Iterator
TInspectorAPI_IteratorOfPreferencesDataMap;
#endif