• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            Jiwu Bu

              C++博客 :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
              32 隨筆 :: 0 文章 :: 25 評論 :: 0 Trackbacks
            為了方便日常使用boost::filestream組件,將boost::filestream組件的基本封裝。

            /*
             * @file FileSystem.h
             * @brief Operation file or diretory
             * @author Jiwu Bu
             * @version 1.0.0
             * @date 2009-11-23
             
            */
            #ifndef FILESYSTEM_H_H
            #define FILESYSTEM_H_H

            #include 
            <iostream>
            #include 
            <vector>

            using namespace std;

            class CFileSystem
            {
            public:
                
            /*
                 * @brief Gets an array of dirctories from current direcoty,
                 *        using Recur value to determine whether to search 
                 *        subdirectories.
                 * @param SubDirVec Ouput parameter, return the search result
                 * @param DirPath
                 * @param Recur  Whether search subdirectories.
                 * 
                 * @return 
                 
            */
                
            static bool GetDirectories(vector<string>& SubDirVec, 
                    
            const string& DirPath, bool Recur = false);

                
            /*
                 * @brief Get the names of files in the specified directory that 
                 *        match the specified extensive name, using a value to 
                 *        determine whether to search subdirectories.
                 * 
                 * @param FileVec Ouput parameter, return the search result
                 * @param DirPath
                 * @param ExeName Extensive name, if ExeName equal  "*.*"  search all file
                 * @param Recur   Whether search subdirectories
                 * 
                 * @return 
                 
            */
                
            static bool GetFiles(vector<string>& FileVec, const string& DirPath, 
                    
            const string& ExeName, bool Recur = false);

                
            /*
                 * @brief Create a new directory.
                 * 
                 * @param Dir  New directory path. Example:/home/bujiwu/test
                 * 
                 * @return  true, if success
                 *          false, if failed
                 
            */
                
            static bool CreateDirectory(const string & Dir);

                
            /*
                 * @brief Judge whether this file or diretory exists.
                 * 
                 * @param Path
                 * 
                 * @return  true, if exists
                 *          false, if not exists
                 
            */
                
            static bool Exists(const string& Path);

                
            /*
                 * @brief Delete this file or directory
                 * 
                 * @param Path
                 
            */
                
            static void Delete(const string& Path);

                
            /*
                 * @brief Move file or directory from FromPath to ToPath.
                 * 
                 * @param FromPath
                 * @param ToPath
                 
            */
                
            static void Move(const string& FromPath, const string& ToPath);

                
            /*
                 * @brief Copy file or directory from FromPath to ToPath.
                 * 
                 * @param FromPath
                 * @param ToPath
                 
            */
                
            static void Copy(const string& FromPath, const string& ToPath);

                
            /*
                 * @brief Get file size
                 * 
                 * @param FilePath
                 * 
                 * @return 
                 
            */
                
            static unsigned long GetFileSize(const string& FilePath);
            };

            #endif

            測試用例:
            #include "../FileSystem/FileSystem.h"
            #include 
            <algorithm>
            #include 
            <iterator>
            #include 
            <string>

            using namespace std;

            int main(int argc, char* argv[])
            {
                vector
            <string> MyVec;

                
            string Path = "/home/bujiwu/EncapDirectory";
                
                CFileSystem::Copy(
            "/home/bujiwu/epoll", Path);

                CFileSystem::GetFiles(MyVec, Path, 
            "*.*"true);

                copy(MyVec.begin(), MyVec.end(), ostream_iterator
            <string>(cout , "\n") );

                
            return 0;
            }

            http://www.shnenglu.com/Files/bujiwu/FileSystem.rar

            posted on 2009-11-23 13:44 bujiwu 閱讀(824) 評論(0)  編輯 收藏 引用 所屬分類: Boost
            中文字幕无码久久人妻| 日本亚洲色大成网站WWW久久| 一本色道久久HEZYO无码| 国产精品一久久香蕉国产线看观看| 久久精品国产一区| 伊人色综合九久久天天蜜桃| 久久成人国产精品二三区| 亚洲精品乱码久久久久久蜜桃| A狠狠久久蜜臀婷色中文网| 伊人久久成人成综合网222| 久久99国产精品尤物| 久久这里的只有是精品23| 色综合久久中文综合网| 丁香色欲久久久久久综合网| 久久天堂AV综合合色蜜桃网| 久久久久亚洲AV无码专区桃色 | 97久久精品无码一区二区天美| 99久久精品免费看国产一区二区三区| 欧美激情精品久久久久久久九九九| 成人国内精品久久久久影院| 无码人妻精品一区二区三区久久久 | 久久亚洲高清观看| 久久亚洲私人国产精品| 久久人与动人物a级毛片| 久久丝袜精品中文字幕| 国产无套内射久久久国产| 久久久久综合网久久| 久久精品国产精品青草| 久久免费视频网站| 91精品国产91久久久久久| 一级做a爱片久久毛片| 99re这里只有精品热久久 | 久久性生大片免费观看性| 久久精品国产一区二区三区| 久久久综合香蕉尹人综合网| 久久五月精品中文字幕| 婷婷久久五月天| 人妻少妇久久中文字幕| 韩国三级大全久久网站| 99久久精品免费看国产一区二区三区 | 狠狠色丁香婷婷久久综合 |