ctEnv.h 3.28 KB
/*
 ctEnv.h - Provides a mechanism to manage environment variables.

 Author: Francisco J. Santana Jorge
         <francisco dot santana102 arroba estudiantes dot ulpgc dot es>, 2011

 Inst. Universitario de Sistemas Inteligentes y Aplicaciones Numéricas
 Universidad de Las Palmas de Gran Canaria

 Copyright (C) 2003,2007,2009,2010
    Universidad de Las Palmas de Gran Canaria (ULPGC) (<http://www.ulpgc.es>)

    This software is a collective project which has been designed, developed and
    written, and is maintained by members, students and collaborators of the División
    de Inteligencia Artificial y Sistemas (DIAS) at the Instituto Universitario de
    Sistemas Inteligentes y Aplicaciones Numéricas en Ingeniería (SIANI)
    (<http://www.siani.es/>), and also of the Departamento de Informática y Sistemas
    (DIS) (<http://www.dis.ulpgc.es>) both at ULPGC. The AUTHOR file lists all
    developers and contributors.The particular authors of each file are explicitly
    specified on each one of them.

 This file is part of the CoolBOT Project.
 The CoolBOT Project is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or any
 later version.

 The CoolBOT Project 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 General Public License for more details.

 You should have received a copy (COPYING file) of the GNU General Public License
 along with the CoolBOT Project . If not, see <http://www.gnu.org/licenses/>.

 In addition to the GNU General Public License, the CoolBOT Project Compiler License
 Exception is applicable to the C++ skeletons generated by the CoolBOT Compiler
 (coolbot-c). The purpose of this Exception is to allow distribution of  CoolBOT
 Compiler's (coolbot-c) typical output under terms of the recipient's choice
 (including proprietary). You should have received a copy of the CoolBOT Project
 Compiler License Exception (COPYING.EXCEPTION file) along with the CoolBOT Project.
 If not see <http://www.coolbotproject.org>.
*/

#ifndef __ctEnv_h
#define __ctEnv_h

#include <string>

/**
 ** The ctEnv class provides a mechanism to manage environment variables.
 **/
class ctEnv
{
public:

  /**
   ** Dump the value of an environment variable to a string. If you can not read
   ** the variable, returns the empty string.
   ** @param VariableName environment variable name to read
   ** @return Returns a string with the variable or empty.
   **/
  static std::string GetVar(const std::string& VariableName);

  /**
   ** Creates or updates an environment variable not persistently(overwrite an existing value).
   ** Only for current process.
   ** @param Variable variable name
   ** @param Value    variable value
   ** @return Returns true if the process is performed correctly..
   **/
  static bool SetVar(const std::string& Variable,const std::string& Value);

  /**
   ** Deletes the variable name from the environment.
   ** @param Variable variable name
   ** @return Returns true if the process is performed correctly.
   **/
  static bool UnSetVar(const std::string& Variable);

}; /// The ctEnv class

#endif ///__ctEnv_h