Tulip  4.2.0
Better Visualization Through Research
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Groups Pages
TlpTools.h
1 /*
2  *
3  * This file is part of Tulip (www.tulip-software.org)
4  *
5  * Authors: David Auber and the Tulip development Team
6  * from LaBRI, University of Bordeaux 1 and Inria Bordeaux - Sud Ouest
7  *
8  * Tulip is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU Lesser General Public License
10  * as published by the Free Software Foundation, either version 3
11  * of the License, or (at your option) any later version.
12  *
13  * Tulip is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16  * See the GNU General Public License for more details.
17  *
18  */
19 
20 #ifndef _TLPTOOLS_H
21 #define _TLPTOOLS_H
22 
23 #include <iostream>
24 #include <tulip/tulipconf.h>
25 
26 namespace tlp {
27 extern TLP_SCOPE const char PATH_DELIMITER;
28 extern TLP_SCOPE std::string TulipLibDir;
29 extern TLP_SCOPE std::string TulipPluginsPath;
30 extern TLP_SCOPE std::string TulipDocProfile;
31 extern TLP_SCOPE std::string TulipUserHandBookIndex;
32 extern TLP_SCOPE std::string TulipBitmapDir;
33 extern TLP_SCOPE std::string TulipShareDir;
34 
35 /**
36  * @ingroup Plugins
37  *
38  * @brief Initializes the Tulip library.
39  * Looks for the Tulip plug-ins directory, and loads the plug-ins from it.
40  * The plug-ins directory can be defined in different ways, given by order of prevalence :
41  * 1. the TLP_DIR environment variable, if it has a value
42  * 2. the appDirPath parameter, if it is not NULL
43  * 3. at that point, the Tulip paths will be retrieved from the path of the loaded Tulip shared library
44  * (you must dispose of a standard Tulip installation for that feature to work).
45  * 4. a fallback value of 'C:/Tulip/lib/' on windows, or '/usr/local/lib/' on Unix.
46  */
47 extern TLP_SCOPE void initTulipLib(const char* appDirPath = NULL);
48 
49 /**
50  * @ingroup Plugins
51  *
52  * @brief Demangles the name of a C++ class defined in the tlp namespace.
53  * Simply removes the 'tlp::' prefix from the class name.
54  * @return string The demangled name of a Tulip C++ class.
55  */
56 TLP_SCOPE std::string demangleTlpClassName(const char *className);
57 
58 /**
59  * @brief Returns an istream to read from a gzipped file (uses gzstream lib).
60  * The stream has to be deleted after use.
61  * @param name The name of the file to read from.
62  * @param open_mode The mode to open the file with. Defaults to std::ios::in.
63  * @return istream gzipped input stream from a file.
64  */
65 TLP_SCOPE std::istream *getIgzstream(const char *name, int open_mode = std::ios::in);
66 
67 /**
68  * @brief Returns an ostream to write to a gzipped file (uses gzstream lib).
69  * The stream has to be deleted after use.
70  * @warning Don't forget to check the stream with ios::bad()!
71  * @param name The name of the file to write to.
72  * @param open_mode The mode to open the file with. Defaults to std::ios::out.
73  * @return ostream gzipped output stream to a file.
74  */
75 TLP_SCOPE std::ostream *getOgzstream(const char *name, int open_mode = std::ios::out);
76 
77 }
78 
79 #endif