Salome HOME
Merge branch 'Dev_0.7.1' of newgeom:newgeom.git into Dev_0.7.1
[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
12 #include <memory>
13
14 /*!
15  \ingroup GUI
16  \brief Return directory part of the file path.
17
18  If the file path does not include directory part (the file is in the
19  current directory), null string is returned.
20
21  \param path file path
22  \param abs if true (default) \a path parameter is treated as absolute file path
23  \return directory part of the file path
24  */
25 namespace XGUI_Tools {
26
27 /**
28 * Returns directory name from name of file
29 * \param path a path to a file
30 * \param isAbs is absolute or relative path
31 */
32 QString XGUI_EXPORT dir(const QString& path, bool isAbs = true);
33
34 /*!
35  \brief Return file name part of the file path.
36
37  \param path file path
38  \param withExt if true (default) complete file name (with all
39  extension except the last) is returned, otherwise only base name
40  is returned
41  \return file name part of the file path
42  */
43 QString XGUI_EXPORT file(const QString& path, bool withExt = true);
44
45 /*!
46  \brief Add a slash (platform-specific) to the end of \a path
47  if it is not already there.
48  \param path directory path
49  \return modified path (with slash added to the end)
50  */
51 QString XGUI_EXPORT addSlash(const QString& path);
52
53 /// The model concerning tools
54
55 /*!
56  Returns true if the feature is a model object
57  \param theFeature a feature
58  */
59 bool XGUI_EXPORT isModelObject(FeaturePtr theFeature);
60
61 /*!
62  Returns the string presentation of the given feature
63  \param theFeature a feature
64  */
65 std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
66 }
67
68 #endif