Welcome to Windows Vision Library: Samples |
这里将展示一些关于WVL的示例.
1, How can I display the files and directories which are in a specified directory
#include<vector>
#include<wvl/components/file_iterator.h>
int main()
{
using namespace std;
using namespace wvl;
file_iterator
begin("c:\\");
file_iterator end; //you can create a END
iterator with its default constructor
for(;begin != end; ++begin)
{
if(begin -> is_dir())
cout<<" * "; else cout<<" ";
cout<<begin->file_name()<<endl;
}
}
2, How can I create a thread on a member function of a class with the WVL
#include<string>
#include<wvl/components/thread.h>
#include<iostream>
class foo
{
public:
foo(const char* str)
:data_(str)
{}
void start()
{
thread_.start(this,
&foo::thread_fun); //set the thread and start it
thread_.wait(); //wait for the thread until
its finish
}
private:
void thread_fun() //it is a member function which i
wanna create a thread on it
{
std::cout<<data_<<std::endl;
}
private:
wvl::thread thread_;
std::string
data_;
};
int main()
{
foo x("Hello, World!");
x.start();
}
3, A larger sample--FreeME
Click here to get more information