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

📄 wartmpfilename.h

📁 ftpserver very good sample
💻 H
字号:
/** */#ifndef WAR_TMP_FILE_NAME_H#define WAR_TMP_FILE_NAME_H/* SYSTEM INCLUDES */#if defined(WIN32) || defined(HAVE_PROCESS_H)#   if !defined(WAR_PROCESS_H_INCLUDED)#       define WAR_PROCESS_H_INCLUDED#       include <process.h>#   endif#endif#ifdef WIN32#   define WAR_TCHAR_H_INCLUDED#   include <tchar.h>#endif/* PROJECT INCLUDES */#ifndef WAR_INCREMENT_COUNTER_H#   include "WarIncrementCounter.h"#endif#ifndef WAR_PATH_H#   include "WarPath.h"#endif/* LOCAL INCLUDES *//* FORWARD REFERENCES */#ifdef __cplusplusextern "C" {#endif/****************** BEGIN OLD STYLE C spesific ********//****************** END OLD STYLE C spesific **********/#ifdef __cplusplus }#endif/****************** BEGIN C++ spesific ****************/#ifdef __cplusplustemplate <class charT>class WarTmpFileName {public:    typedef WarPath<charT> path_t;    typedef const charT * ccstr_t;    // LIFECYCLE        /**    * Default constructor.    */    WarTmpFileName()    {    }        ~WarTmpFileName()    {    }        /**    * Destructor.    */        // OPERATORS    // OPERATIONS    path_t GetTmpName(ccstr_t tmpPath = NULL,         ccstr_t preFix = NULL)    {        path_t my_path;        if (tmpPath)            my_path << tmpPath;        if (my_path.IsEmpty())            my_path << ::getenv("TEMP");        if (my_path.IsEmpty())            my_path << ::getenv("TMP");#ifdef WIN32        if (my_path.IsEmpty())        {            TCHAR buf[MAX_PATH];            buf[0] = 0;            if (::GetTempPath(MAX_PATH, buf))                my_path << buf;        }#endif        if (my_path.IsEmpty())        {#ifdef WIN32            my_path << "\\~TEMP";            war_syspath_t sys_path;            sys_path << my_path.GetPath();            ::CreateDirectory(sys_path.GetPath(), NULL);            if (::GetFileAttributes(sys_path.GetPath()) == 0xffffffff)            {                   my_path = "";                my_path << WAR_SYSSLASH;            }#else // UNIX            my_path << "/tmp";#endif        }        static const charT default_prefix[] = {'~', 'w', 'f', 'd', 'e', 0};        std::string numbuf;        WarItoa(numbuf, ::getpid(), 16);        my_path << WAR_SYSSLASH             << (preFix ? preFix : default_prefix)            << '_'            << numbuf            << '_'            << mCounter.GetNextAsStr()             << ".tmp";        my_path.Normalize();        return my_path;    }    // CALLBACK    // ACCESS    // INQUIRY    protected:private:    WarIncrementCounter<war_uint32_t> mCounter;};/* INLINE METHODS *//* EXTERNAL REFERENCES */#endif /* __cplusplus *//****************** END C++ spesific ******************/#endif  /* WAR_TMP_FILE_NAME_H_ */

⌨️ 快捷键说明

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