Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
[modules/shaper.git] / src / XGUI / XGUI_Tools.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 #ifndef XGUI_Tools_H
4 #define XGUI_Tools_H
5
6 #include "XGUI.h"
7 #include <QString>
8 #include <QRect>
9
10 #include <ModelAPI_Feature.h>
11 #include <ModuleBase_Definitions.h>
12
13 #include <memory>
14
15 /*!
16  \ingroup GUI
17  \brief Return directory part of the file path.
18
19  If the file path does not include directory part (the file is in the
20  current directory), null string is returned.
21
22  \param path file path
23  \param abs if true (default) \a path parameter is treated as absolute file path
24  \return directory part of the file path
25  */
26 namespace XGUI_Tools {
27
28 /**
29 * Returns directory name from name of file
30 * \param path a path to a file
31 * \param isAbs is absolute or relative path
32 */
33 QString XGUI_EXPORT dir(const QString& path, bool isAbs = true);
34
35 /*!
36  \brief Return file name part of the file path.
37
38  \param path file path
39  \param withExt if true (default) complete file name (with all
40  extension except the last) is returned, otherwise only base name
41  is returned
42  \return file name part of the file path
43  */
44 QString XGUI_EXPORT file(const QString& path, bool withExt = true);
45
46 /*!
47  \brief Add a slash (platform-specific) to the end of \a path
48  if it is not already there.
49  \param path directory path
50  \return modified path (with slash added to the end)
51  */
52 QString XGUI_EXPORT addSlash(const QString& path);
53
54 /// The model concerning tools
55
56 /*!
57  Returns true if the feature is a model object
58  \param theFeature a feature
59  */
60 bool XGUI_EXPORT isModelObject(FeaturePtr theFeature);
61
62 /*!
63  Returns the string presentation of the given feature
64  \param theFeature a feature
65  */
66 std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
67
68
69 /*!
70 Check types of objects which are in the given list
71 \param theObjects the list of objects
72 \param hasResult will be set to true if list contains Result objects
73 \param hasFeature will be set to true if list contains Feature objects
74 \param hasParameter will be set to true if list contains Parameter objects
75 */
76 void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter);
77
78 };
79
80 #endif