Salome HOME
Functionality for dynamic libraries loading is assigned to Config_ModuleReader
[modules/shaper.git] / src / XGUI / XGUI_Tools.h
1 #ifndef XGUI_Tools_H
2 #define XGUI_Tools_H
3
4 #include "XGUI.h"
5 #include <QString>
6 #include <QRect>
7
8 /*!
9  \brief Return directory part of the file path.
10
11  If the file path does not include directory part (the file is in the
12  current directory), null string is returned.
13
14  \param path file path
15  \param abs if true (default) \a path parameter is treated as absolute file path
16  \return directory part of the file path
17  */
18 QString XGUI_EXPORT dir(const QString& path, bool isAbs = true);
19
20 /*!
21  \brief Return file name part of the file path.
22
23  \param path file path
24  \param withExt if true (default) complete file name (with all
25  extension except the last) is returned, otherwise only base name
26  is returned
27  \return file name part of the file path
28  */
29 QString XGUI_EXPORT file(const QString& path, bool withExt = true);
30
31 /*!
32  \brief Return extension part of the file path.
33
34  \param path file path
35  \param full if true complete extension (all extensions, dot separated)
36  is returned, otherwise (default) only last extension is returned
37  \return extension part of the file path 
38  */
39 QString XGUI_EXPORT extension(const QString& path, bool full = false);
40
41 /*!
42  \brief Add a slash (platform-specific) to the end of \a path
43  if it is not already there.
44  \param path directory path
45  \return modified path (with slash added to the end)
46  */
47 QString XGUI_EXPORT addSlash(const QString& path);
48
49 /*! 
50  Creates a rect with TopLeft = ( min(x1,x2), min(y1,y2) )
51  and BottomRight = ( TopLeft + (x2-x1)(y2-y1) )    
52  */
53 QRect XGUI_EXPORT makeRect(const int x1, const int y1, const int x2, const int y2);
54
55 #endif