|
Code Fragment Collection
|
#include <apl/file.cxx>
using namespace apl ;
{
ADir<> dir ;
ADir<>::file_list_type files ;
dir.open(dirname) ;
dir.read(filemask,files) ;
for ( ADir<>::file_list_type::iterator f = files.begin(), f_end = files.end() ; f != f_end ; ++f ) {
// process the file
std::cout << f->name << std::endl ;
}
}#include <apl/http.cxx>
{
ASocket<> sock ;
AHttpClient<ASocket<> > http(sock) ;
http.get("http://www.example.com/") ;
std::cout << http.response.body << std::endl ;
}#include <apl/file.cxx>
using namespace apl ;
{
AFileSystem<> fs ;
fs.mkdir(dirname,fs.mkdir_parents) ;
}#include <apl/file.cxx>
{
std::string content ;
apl::AFile<> file ;
file.load("file.dat",content) ;
}#include <apl/typemap.cxx>
class Key1{} ;
class Key2{} ;
class Key3{} ;
class Value1{} ;
class Value2{} ;
class Value3{} ;
{
using namespace apl ;
typedef typemap::insert<Key1,Value1>::X Map2 ;
typedef typemap::insert<Key2,Value2,Map2>::X Map3 ;
typedef typemap::insert<Key3,Value3,Map3>::X Map4 ;
std::cout << typeid(typemap::find<Key2,Map4>::X::Value).name() << std::endl ;
} |