⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 environment_variable_traits.hpp

📁 新版本TR1的stl
💻 HPP
📖 第 1 页 / 共 2 页
字号:
/* /////////////////////////////////////////////////////////////////////////
 * File:        platformstl/system/environment_variable_traits.hpp
 *
 * Purpose:     Definition of the environment_variable_traits class.
 *
 * Created:     9th December 2005
 * Updated:     12th March 2007
 *
 * Home:        http://stlsoft.org/
 *
 * Copyright (c) 2005-2007, Matthew Wilson and Synesis Software
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * - Redistributions of source code must retain the above copyright notice, this
 *   list of conditions and the following disclaimer.
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of
 *   any contributors may be used to endorse or promote products derived from
 *   this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 *
 * ////////////////////////////////////////////////////////////////////// */


/** \file platformstl/system/environment_variable_traits.hpp
 *
 * \brief [C++ only] Definition of the platformstl::environment_variable_traits
 *  traits class
 *   (\ref group__library__system "System" Library).
 */

#ifndef PLATFORMSTL_INCL_PLATFORMSTL_SYSTEM_HPP_ENVIRONMENT_TRAITS
#define PLATFORMSTL_INCL_PLATFORMSTL_SYSTEM_HPP_ENVIRONMENT_TRAITS

/* File version */
#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION
# define PLATFORMSTL_VER_PLATFORMSTL_SYSTEM_HPP_ENVIRONMENT_TRAITS_MAJOR    2
# define PLATFORMSTL_VER_PLATFORMSTL_SYSTEM_HPP_ENVIRONMENT_TRAITS_MINOR    1
# define PLATFORMSTL_VER_PLATFORMSTL_SYSTEM_HPP_ENVIRONMENT_TRAITS_REVISION 1
# define PLATFORMSTL_VER_PLATFORMSTL_SYSTEM_HPP_ENVIRONMENT_TRAITS_EDIT     17
#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */

/* /////////////////////////////////////////////////////////////////////////
 * Auto-generation and compatibility
 */

/*
[<[STLSOFT-AUTO:NO-UNITTEST]>]
*/

/* /////////////////////////////////////////////////////////////////////////
 * Includes
 */

#ifndef PLATFORMSTL_INCL_PLATFORMSTL_HPP_PLATFORMSTL
# include <platformstl/platformstl.hpp>
#endif /* !PLATFORMSTL_INCL_PLATFORMSTL_HPP_PLATFORMSTL */

#if defined(PLATFORMSTL_OS_IS_UNIX)
#elif defined(PLATFORMSTL_OS_IS_WIN32)
#else /* ? operating system */
# error Operating system not discriminated
#endif /* operating system */

#ifndef STLSOFT_INCL_STLSOFT_MEMORY_HPP_AUTO_BUFFER
# include <stlsoft/memory/auto_buffer.hpp>
#endif /* !STLSOFT_INCL_STLSOFT_MEMORY_HPP_AUTO_BUFFER */
#ifndef STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING
# include <stlsoft/shims/access/string.hpp>
#endif /* !STLSOFT_INCL_STLSOFT_SHIMS_ACCESS_HPP_STRING */
#include <errno.h>
#include <stdlib.h> // for environ, getenv(), etc.
#if defined(STLSOFT_COMPILER_IS_MWERKS)
# include <crtl.h>  // for _environ
#endif /* compiler */

/* /////////////////////////////////////////////////////////////////////////
 * Feature discrimination
 *
 * Advanced Prorgramming in the UNIX Environment, Stevens, gives the following:
 *
 *  Function        Standards                         Implementations
 *
 *              ANSI C     POSIX.1    XPG3        SVR4         4.3+BSD
 *   getenv        *          *         *           *              *
 *   putenv        -          ?         *           *              *
 *   setenv        -          -         -           -              *
 *   unsetenv      -          -         -           -              *
 */

/* set by: putenv / setenv / <not supported> */

#ifdef PLATFORMSTL_ENVVAR_SET_BY_PUTENV
# undef PLATFORMSTL_ENVVAR_SET_BY_PUTENV
#endif /* PLATFORMSTL_ENVVAR_SET_BY_PUTENV */

#ifdef PLATFORMSTL_ENVVAR_SET_BY_SETENV
# undef PLATFORMSTL_ENVVAR_SET_BY_SETENV
#endif /* PLATFORMSTL_ENVVAR_SET_BY_SETENV */

#ifdef PLATFORMSTL_ENVVAR_SET_SUPPORTED
# undef PLATFORMSTL_ENVVAR_SET_SUPPORTED
#endif /* PLATFORMSTL_ENVVAR_SET_SUPPORTED */


/* erase by: putenv / putenv (with equals) / unsetenv / <not supported> */

#ifdef PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV
# undef PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV
#endif /* PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV */

#ifdef PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV_EQUALS
# undef PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV_EQUALS
#endif /* PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV_EQUALS */

#ifdef PLATFORMSTL_ENVVAR_ERASE_BY_UNSETENV
# undef PLATFORMSTL_ENVVAR_ERASE_BY_UNSETENV
#endif /* PLATFORMSTL_ENVVAR_ERASE_BY_UNSETENV */

#ifdef PLATFORMSTL_ENVVAR_ERASE_SUPPORTED
# undef PLATFORMSTL_ENVVAR_ERASE_SUPPORTED
#endif /* PLATFORMSTL_ENVVAR_ERASE_SUPPORTED */


/* environ / _environ / <no environ> */

#ifdef PLATFORMSTL_ENVVAR_HAS_ENVIRON
# undef PLATFORMSTL_ENVVAR_HAS_ENVIRON
#endif /* PLATFORMSTL_ENVVAR_HAS_ENVIRON */

#ifdef PLATFORMSTL_ENVVAR_ENVIRON_HAS_UNDERSCORE
# undef PLATFORMSTL_ENVVAR_ENVIRON_HAS_UNDERSCORE
#endif /* PLATFORMSTL_ENVVAR_ENVIRON_HAS_UNDERSCORE */


/* putenv has _underscore */

#ifdef PLATFORMSTL_ENVVAR_PUTENV_HAS_UNDERSCORE
# undef PLATFORMSTL_ENVVAR_PUTENV_HAS_UNDERSCORE
#endif /* PLATFORMSTL_ENVVAR_PUTENV_HAS_UNDERSCORE */


#if defined(PLATFORMSTL_ENVVAR_STDC_ONLY)

#elif defined(PLATFORMSTL_OS_IS_UNIX)

extern char **environ;

# if defined(UNIXSTL_OS_IS_LINUX)
#  define PLATFORMSTL_ENVVAR_HAS_ENVIRON
#  define PLATFORMSTL_ENVVAR_SET_BY_SETENV
#  define PLATFORMSTL_ENVVAR_ERASE_BY_UNSETENV
# elif defined(UNIXSTL_OS_IS_MACOSX)
#  define PLATFORMSTL_ENVVAR_HAS_ENVIRON
#  define PLATFORMSTL_ENVVAR_SET_BY_SETENV
#  define PLATFORMSTL_ENVVAR_ERASE_BY_UNSETENV
# elif defined(UNIXSTL_OSFAMILY_IS_BSD)
#  define PLATFORMSTL_ENVVAR_HAS_ENVIRON
#  define PLATFORMSTL_ENVVAR_SET_BY_SETENV
#  define PLATFORMSTL_ENVVAR_ERASE_BY_UNSETENV
# elif defined(UNIXSTL_OSFAMILY_IS_SVR4)
#  define PLATFORMSTL_ENVVAR_HAS_ENVIRON
#  define PLATFORMSTL_ENVVAR_SET_BY_PUTENV
#  define PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV
# else /* ? UNIX OS family */
#  error UNIX family flavours other than BSD and SVR4 are not currently supported.
# endif /* UNIX OS family */
#elif defined(PLATFORMSTL_OS_IS_WIN32)
# define PLATFORMSTL_ENVVAR_SET_BY_PUTENV
# define PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV_EQUALS
# define PLATFORMSTL_ENVVAR_HAS_ENVIRON
# define PLATFORMSTL_ENVVAR_ENVIRON_HAS_UNDERSCORE
# if defined(STLSOFT_COMPILER_IS_BORLAND)
   /* putenv() */
# elif defined(STLSOFT_COMPILER_IS_DMC) || \
       defined(STLSOFT_COMPILER_IS_GCC) || \
       defined(STLSOFT_COMPILER_IS_INTEL) || \
       defined(STLSOFT_COMPILER_IS_MSVC) || \
       defined(STLSOFT_COMPILER_IS_MWERKS)
#  define PLATFORMSTL_ENVVAR_PUTENV_HAS_UNDERSCORE
# else /* ? compiler */
# endif /* compiler */
#else /* ? operating system */
# error Operating systems other than UNIX and Win32 are not currently supported.
#endif /* operating system */


#if defined(PLATFORMSTL_ENVVAR_SET_BY_PUTENV) || \
    defined(PLATFORMSTL_ENVVAR_SET_BY_SETENV)
# define PLATFORMSTL_ENVVAR_SET_SUPPORTED
#endif /* set ? */

#if defined(PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV) || \
    defined(PLATFORMSTL_ENVVAR_ERASE_BY_PUTENV_EQUALS) || \
    defined(PLATFORMSTL_ENVVAR_ERASE_BY_UNSETENV)
# define PLATFORMSTL_ENVVAR_ERASE_SUPPORTED
#endif /* set ? */

/* /////////////////////////////////////////////////////////////////////////
 * Namespace
 */

#if defined(_STLSOFT_NO_NAMESPACE) || \
    defined(STLSOFT_DOCUMENTATION_SKIP_SECTION)
/* There is no stlsoft namespace, so must define ::platformstl */
namespace platformstl
{
#else
/* Define stlsoft::platformstl_project */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -