ffsco.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. //#include "ffsco.h"
  2. //////////////////////////////////////////////////////////////////////
  3. // ffsco.h: interface for the helper_coffs::ffsco class.
  4. //
  5. //////////////////////////////////////////////////////////////////////
  6. /*
  7. * Copyright 2004, ??? (www.???.com). All rights reserved.
  8. * Copyright 1990-2004, ???.
  9. *
  10. * See the COPYING file for the terms of usage and distribution.
  11. */
  12. //////////////////////////////////////////////////////////////////////
  13. // ...
  14. // create@2004-03-17
  15. // by ???
  16. //////////////////////////////////////////////////////////////////////
  17. #ifndef __FFSCO__
  18. //#if !defined(__FFSCO__)
  19. #define __FFSCO__
  20. #ifndef WIN32
  21. #error now only for WIN32(platform).
  22. #endif
  23. //#include <iostream>
  24. //#include <algorithm>
  25. #include <string>
  26. #include <vector>
  27. #include <sstream>
  28. using namespace std;
  29. #pragma warning(disable:4786)
  30. namespace helper_coffs {
  31. const int max_limit = 0x100000; //--1048576
  32. const int def_limit = 0x10000; //--65536
  33. const char c_pathSeparator = '\\';
  34. const string s_pathSeparator = "\\";
  35. //--find files collection
  36. class ffsco
  37. {
  38. public:
  39. typedef vector<string> typeT;
  40. virtual int match(string fext_, string file_); //--文件匹配检测
  41. public:
  42. void test(); //--example
  43. int find(string path_, string fext_ = "");
  44. public:
  45. string get(int i = 0) { return _co.at(i); }
  46. int count() { return _co_dir.size() + _co_file.size(); }
  47. //int count() { return _co.size(); }
  48. typeT co() { return _co; }
  49. typeT co_dir() { return _co_dir; }
  50. typeT co_file() { return _co_file; }
  51. public:
  52. int limit() { return _limit; }
  53. void limit(int limit_); //--设置结果文件数目上限
  54. public:
  55. int dirs() { return _dirs; } //get
  56. void dirs(int dirs) { _dirs = dirs; } //--set
  57. int dir(string s); //--判断s是否为目录
  58. private:
  59. int _limit; //--limit
  60. int _dirs; //--dirs-是否查找子目录(默认0-不查找)
  61. typeT _co_file;
  62. typeT _co_dir;
  63. typeT _co;
  64. public:
  65. ffsco();
  66. virtual ~ffsco();
  67. private:
  68. inline int checkcount() {return 0;}//{ return count() == limit(); } //--limit test
  69. inline string _uppercase_(string s); //--转换s到大写字母
  70. };
  71. }; //--namespace helper_coffs
  72. #endif //--__FFSCO__