X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcreaDevManagerLib%2FCDMUtilities.h;fp=lib%2FcreaDevManagerLib%2FCDMUtilities.h;h=4b18fcb2ec6e26e30e510bdc528fc3e5f3051aee;hb=c1c0272929da71783e2d520a24acfb23fe8e24a5;hp=21f66d8d32ef1b7f5f88d9c9d2e4bd07495d5aaf;hpb=2fb5dd9262993efaf56bfc731f4297fdb96bf63e;p=crea.git diff --git a/lib/creaDevManagerLib/CDMUtilities.h b/lib/creaDevManagerLib/CDMUtilities.h index 21f66d8..4b18fcb 100644 --- a/lib/creaDevManagerLib/CDMUtilities.h +++ b/lib/creaDevManagerLib/CDMUtilities.h @@ -40,7 +40,9 @@ namespace CDMUtilities { - //path slash + /** + * Path slash + */ #ifdef _WIN32 // ------ Windows static std::string SLASH = "\\"; @@ -51,7 +53,9 @@ namespace CDMUtilities static std::string SLASH = "/"; #endif - //text editor program + /** + * Text editor program + */ #ifdef _WIN32 // ------ Windows //TODO: implementation for windows @@ -62,7 +66,9 @@ namespace CDMUtilities static std::string TEXT_EDITOR = "gedit"; #endif - //file explorer program + /** + * File explorer program + */ #ifdef _WIN32 // ------ Windows //TODO: implementation for windows @@ -73,7 +79,9 @@ namespace CDMUtilities static std::string FILE_EXPLORER = "nautilus"; #endif - //terminal program + /** + * Terminal program + */ #ifdef _WIN32 // ------ Windows //TODO: implementation for windows @@ -85,9 +93,24 @@ namespace CDMUtilities #endif + /** + * Structure that handles the split method for c++ + * It calls the split method to split a string given certain delimiters. + */ struct splitter { + /** + * Enum to allow or not empty resulting strings after performing splits. + */ enum empties_t { empties_ok, no_empties }; + /** + * Method to split a string given a set of delimiter characters. + * @param result Resulting container. + * @param s String to be splitted. + * @param delimiters Delimiter characters to split the string. + * @param empties Either allow or not empty resulting strings after performing split. + * @return Resulting container. + */ template static Container& split ( @@ -98,14 +121,54 @@ namespace CDMUtilities ); }; + /** + * Fixes a given path to avoid double slash directories + * @param path Unfixed path. + * @return Fixed path. + */ const std::string fixPath(const std::string& path); + /** + * Opens the default text editor. If a file is given, then it tries to open the given file. + * @param file Full path to the file. + * @return True if there was an error on the execution of the operation. + */ int openTextEditor(const std::string& file = ""); + /** + * Opens the system file explorer on the given file path + * @param file Path of the desired folder to open. + * @return True if there was an error on the execution of the operation. + */ int openFileExplorer(const std::string& file = ""); + /** + * Opens a file with a given command. + * @param file Full path of the file to open. + * @param command Command to execute the file with. + * @return True if there was an error on the execution of the operation. + */ int openFileWithCommand(const std::string& file, const std::string& command); + /** + * Opens the BBTK Graphical Editor + * @return True if there was an error on the execution of the operation. + */ int openBBEditor(); + /** + * Opens the minitools or the creaTools + * @return True if there was an error on the execution of the operation. + */ int openCreaToolsTools(); + /** + * Open a command line interpreter and executes the given command if any. + * @param command Command to execute. + * @return True if there was an error on the execution of the operation. + */ int openTerminal(const std::string& command = ""); + /** + * Creates a blank class(.h and .cpp files). + * @param name Name of the new class. + * @param path Path where the class is to be created. + * @return True if the class was successfully created. + */ bool createEmptyClass(const std::string& name, const std::string& path); };