File: TInspectorAPI_PluginParameters.hxx

package info (click to toggle)
opencascade 7.9.2%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 301,924 kB
  • sloc: cpp: 1,523,264; tcl: 10,159; cs: 5,173; java: 1,554; sh: 1,342; ansic: 827; xml: 699; makefile: 30; javascript: 22
file content (170 lines) | stat: -rw-r--r-- 7,576 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// Created on: 2017-06-16
// Created by: Natalia ERMOLAEVA
// Copyright (c) 2017 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// 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.

#ifndef TInspectorAPI_PluginParameters_H
#define TInspectorAPI_PluginParameters_H

#include <NCollection_DataMap.hxx>
#include <NCollection_List.hxx>
#include <Standard_Transient.hxx>
#include <TCollection_AsciiString.hxx>
#include <TopoDS_Shape.hxx>

#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:
//! - 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() {}

  //! Destructor
  Standard_EXPORT virtual ~TInspectorAPI_PluginParameters() {}

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! 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);

  //! Sets path to a directory for temporary plugin files
  //! \param thePath a path
  virtual void SetTemporaryDirectory(const TCollection_AsciiString& thePath)
  {
    myTemporaryDirectory = thePath;
  }

  //! Returns path to a directory for temporary plugin files
  //! \return path
  TCollection_AsciiString GetTemporaryDirectory() const { return myTemporaryDirectory; }

  //! Returns plugin preferences
  //! \param thePluginName a plugin name
  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;

  //! 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
  //! \return string instance
  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);

  DEFINE_STANDARD_RTTIEXT(TInspectorAPI_PluginParameters, Standard_Transient)
private:
  //! container of parameters
  NCollection_DataMap<TCollection_AsciiString, NCollection_List<Handle(Standard_Transient)>>
    myParameters;
  //! container of names
  NCollection_DataMap<TCollection_AsciiString, NCollection_List<TCollection_AsciiString>>
    myFileNames;
  //! container of select item names
  NCollection_DataMap<TCollection_AsciiString, NCollection_List<TCollection_AsciiString>>
    mySelectedItemNames;
  //! container of select objects
  NCollection_DataMap<TCollection_AsciiString, NCollection_List<Handle(Standard_Transient)>>
    mySelectedObjects;
  //! temporary directory for saving plugin preferences
  TCollection_AsciiString myTemporaryDirectory;
};

#endif