X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FCore%2FCommandsOverloader.hxx;fp=src%2FCore%2FCommandsOverloader.hxx;h=ca1cf768a93ba43057a5bd66bf09f6473a2172ab;hb=4f7c694f721ba36a0db480ffad86877783a27c1b;hp=0000000000000000000000000000000000000000;hpb=7ac6ac615df3d7b90dbf9c8c8fd8e5259a320a69;p=tools%2Flibbatch.git diff --git a/src/Core/CommandsOverloader.hxx b/src/Core/CommandsOverloader.hxx new file mode 100644 index 0000000..ca1cf76 --- /dev/null +++ b/src/Core/CommandsOverloader.hxx @@ -0,0 +1,80 @@ +// Copyright (C) 2007-2021 CEA/DEN, EDF R&D, OPEN CASCADE +// +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// +/* + * CommandsOverloader.hxx : + * + * Author : Margarita KARPUNINA - OCC + * Date : October 2022 + * + */ + +#ifndef _COMMANDSOVERLOADER_H_ +#define _COMMANDSOVERLOADER_H_ + +#include "Defines.hxx" + +#include +#include + +namespace Batch { + + /*! + * This class is used to parametrize commands in LIBBATCH. + * It's a singleton that can be get only through the static method getInstance(). + */ + class BATCH_EXPORT CommandsOverloader + { + public: + static CommandsOverloader& getInstance(); + + std::string RM_Command(); + std::string SH_Command(); + std::string CP_Command(); + std::string MKDIR_Command(); + std::string RSH_Command(); + std::string RCP_Command(); + std::string SSH_Command(); + std::string SCP_Command(); + std::string RSYNC_Command(); + + protected: + CommandsOverloader(); + virtual ~CommandsOverloader(); + + void parse(const std::string & theFilename); + std::string trim(const std::string & theStr) const noexcept; + + std::string CMD_Command(const std::string & theKey); + + bool hasKey(const std::string & theKey) const; + + std::map _cmdmap; + + private: + // Forbid the use of copy constructor and assignment operator + CommandsOverloader(const CommandsOverloader &) {} + void operator=(const CommandsOverloader &) {} + }; + +} + +#endif