思緒遨遊
Tuesday, August 30, 2005
 
Map rule

determine 最適合的map
  1. 最少 (fail panel 數量百分比) 為最適合
  2. panel 總數量最多的 為最適合
  3. large size (即 panel 面積最大的) 為最適合
 
 
About File Find in win32 (iterator)
Introduction

Several times I worked with file names, I usually used Win32 API
such as ::FindFirstFile.. But it turns out that it's so boring work.
Finally, I realized I can use STL's great feature, iterator, to handle
file name iteration. That's why I made a simple STL iterator class for
file name iteration.

Usage
win32_file_iterator itBegin("c:\\*.*"), itEnd;
std::copy(itBegin, itEnd, ostream_iterator(cout, "\n"));
The code above shows the simplest way to use the class. Actually, you
can use almost all of STL algorithm, I think..
win32_file_iterator itBegin("c:\\*.*"), itEnd;
std::vector vec(itBegin, itEnd);
You also can fill the STL container by using the constructor that takes
begin iterator and end iterator.
Actually, win32_file_iterator class' constructor takes three parameters.
The first one is the filter string that is for calling ::FindFirstFile
function. Second one is the flag that specifies whether dereferenced path
is full path or not. For example, if it's true, the returned path string
is c:\test\aa.txt,otherwise it'll be aa.txt only. The last parameter is
the other flags which specify file attribute. For simplicity, I used Win32
API's FILE_ATTRIBUTE_XXX flags..
If you want to get only directory names, and which is full path, the code
will look like this:
win32_file_iterator itBegin("c:\\*", true, FILE_ATTRIBUTE_DIRECTORY);
So easy, huh?
 

ARCHIVES
August 2005 / September 2005 / October 2006 / November 2006 / March 2007 / May 2007 /


Powered by Blogger