Salome HOME
0fe6b2f5ae080056ee526b8089bd66e3fd7d03a1
[modules/shaper.git] / src / XGUI / XGUI_Tools.h
1
2 #ifndef XGUI_Tools_H
3 #define XGUI_Tools_H
4
5 #include <QString>
6
7 /*!
8   \brief Convert the given parameter to the platform-specific library name.
9
10   The function appends platform-specific prefix (lib) and suffix (.dll/.so)
11   to the library file name.
12   For example, if \a str = "mylib", "libmylib.so" is returned for Linux and
13   mylib.dll for Windows.
14
15   \param str short library name
16   \return full library name
17 */
18 QString library( const QString& str );
19
20 /*!
21   \brief Return directory part of the file path.
22
23   If the file path does not include directory part (the file is in the
24   current directory), null string is returned.
25
26   \param path file path
27   \param abs if true (default) \a path parameter is treated as absolute file path
28   \return directory part of the file path
29 */
30 QString dir( const QString& path, bool isAbs = true);
31
32
33 /*!
34   \brief Return file name part of the file path.
35
36   \param path file path
37   \param withExt if true (default) complete file name (with all
38          extension except the last) is returned, otherwise only base name
39          is returned
40   \return file name part of the file path
41 */
42 QString file( const QString& path, bool withExt = true );
43
44 /*!
45   \brief Return extension part of the file path.
46
47   \param path file path
48   \param full if true complete extension (all extensions, dot separated)
49          is returned, otherwise (default) only last extension is returned
50   \return extension part of the file path
51 */
52 QString extension( const QString& path, bool full = false );
53
54
55 /*!
56   \brief Add a slash (platform-specific) to the end of \a path
57          if it is not already there.
58   \param path directory path
59   \return modified path (with slash added to the end)
60 */
61 QString addSlash( const QString& path );
62
63 #endif