]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_Tools.h
Salome HOME
f45575eea6b241782a7f79b464c8e6bbb6ef0e0d
[modules/shaper.git] / src / XGUI / XGUI_Tools.h
1
2 #ifndef XGUI_Tools_H
3 #define XGUI_Tools_H
4
5 #include <QString>
6 #include <QRect>
7
8 /*!
9   \brief Convert the given parameter to the platform-specific library name.
10
11   The function appends platform-specific prefix (lib) and suffix (.dll/.so)
12   to the library file name.
13   For example, if \a str = "mylib", "libmylib.so" is returned for Linux and
14   mylib.dll for Windows.
15
16   \param str short library name
17   \return full library name
18 */
19 QString library( const QString& str );
20
21 /*!
22   \brief Return directory part of the file path.
23
24   If the file path does not include directory part (the file is in the
25   current directory), null string is returned.
26
27   \param path file path
28   \param abs if true (default) \a path parameter is treated as absolute file path
29   \return directory part of the file path
30 */
31 QString dir( const QString& path, bool isAbs = true);
32
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 file( const QString& path, bool withExt = true );
44
45 /*!
46   \brief Return extension part of the file path.
47
48   \param path file path
49   \param full if true complete extension (all extensions, dot separated)
50          is returned, otherwise (default) only last extension is returned
51   \return extension part of the file path 
52 */
53 QString extension( const QString& path, bool full = false );
54
55
56 /*!
57   \brief Add a slash (platform-specific) to the end of \a path
58          if it is not already there.
59   \param path directory path
60   \return modified path (with slash added to the end)
61 */
62 QString addSlash( const QString& path );
63
64 /*! 
65     Creates a rect with TopLeft = ( min(x1,x2), min(y1,y2) )
66     and BottomRight = ( TopLeft + (x2-x1)(y2-y1) )    
67 */      
68 QRect makeRect( const int x1, const int y1, const int x2, const int y2 ); 
69
70
71 #endif