Main Page   Modules   Data Structures   File List   Data Fields   Globals  

mask.cpp

Go to the documentation of this file.
00001 /*
00002  * mask.cpp
00003  * Created on 25 Feb 2005
00004  * Authors:
00005  *    Wesley Leggette <wleggette@kaylix.net>
00006  * 
00007  * 
00008  * 
00009  * libdarc
00010  * 
00011  * 
00012  * This program is free software; you can redistribute it and/or modify
00013  * it under the terms of the GNU General Public License as published by
00014  * the Free Software Foundation; either version 2 of the License, or
00015  * (at your option) any later version.
00016  *
00017  * This program is distributed in the hope that it will be useful,
00018  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00019  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020  * GNU General Public License for more details.
00021  *
00022  * You should have received a copy of the GNU General Public License
00023  * along with this program; if not, write to the Free Software
00024  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00025  * 
00026  * $Id: mask_8cpp-source.html 708 2005-03-21 12:30:37Z leggwes $
00027  */
00028 
00035 #include "mask.h"
00036 #if LIBDARC_HAVE_LIBDAR_HPP
00037 #include <dar/libdar.hpp>
00038 #endif
00039 
00040 NAMESPACE_LIBDAR_START
00041 
00042 
00043 
00044 extern "C" dar_mask *dar_mask_create_same_path( char* path, bool case_sensit )
00045 {
00046     std::string p = path;
00047     same_path_mask* mask = new same_path_mask( p, case_sensit );
00048     return (dar_mask*)mask;
00049 }
00050 
00051 
00052 
00053 extern "C" dar_mask *dar_mask_create_bool( bool always )
00054 {
00055     bool_mask* mask = new bool_mask( always );
00056     return (dar_mask*)mask;
00057 }
00058 
00059 extern "C" dar_mask *dar_mask_create_and( )
00060 {
00061     return (dar_mask*)(new et_mask());
00062 }
00063 
00064 extern "C" dar_mask *dar_mask_create_or( )
00065 {
00066     return (dar_mask*)(new ou_mask());
00067 }
00068 
00069 extern "C" dar_mask *dar_mask_create_exclude_dir( char* path, bool case_sensit )
00070 {
00071     std::string p = path;
00072     exclude_dir_mask* mask = new exclude_dir_mask( p, case_sensit );
00073     return (dar_mask*)mask;
00074 }
00075 
00076 extern "C" dar_mask *dar_mask_create_not( dar_mask* mask )
00077 {
00078     libdar::mask* m = (libdar::mask*)mask;
00079     not_mask* ret = new not_mask( *m );
00080     return (dar_mask*)ret;
00081 }
00082 
00083 extern "C" dar_mask *dar_mask_create_regular( char* expr, bool case_sensit )
00084 {
00085     std::string e = expr;
00086     regular_mask* mask = new regular_mask( e, case_sensit );
00087     return (dar_mask*)mask;
00088 }
00089 
00090 extern "C" dar_mask *dar_mask_create_simple( char* expr, bool case_sensit )
00091 {
00092     std::string e = expr;
00093     simple_mask* mask = new simple_mask( e, case_sensit );
00094     return (dar_mask*)mask;
00095 }
00096 
00097 extern "C" dar_mask *dar_mask_create_simple_path( char* path, bool case_sensit )
00098 {
00099     std::string p = path;
00100     simple_path_mask* mask = new simple_path_mask( p, case_sensit );
00101     return (dar_mask*)mask;
00102 }
00103  
00104 extern "C" void dar_mask_destroy( dar_mask* mask )
00105 {
00106     libdar::mask* m = (libdar::mask*)mask;
00107     delete m;
00108     return;
00109 }
00110 
00111 extern "C" void dar_mask_and_add(dar_mask* ref, dar_mask* new_mask)
00112 {
00113     et_mask* r = (et_mask*)ref;
00114     libdar::mask* m = (libdar::mask*)new_mask;
00115     r->add_mask( *m );
00116     return;
00117 }
00118 
00119 extern "C" void dar_mask_and_clear( dar_mask* ref )
00120 {
00121     et_mask* r = (et_mask*)ref;
00122     r->clear();
00123     return;
00124 }
00125 
00126 extern "C" U_I dar_mask_and_size( dar_mask* ref )
00127 {
00128     et_mask* r = (et_mask*)ref;
00129     return r->size();
00130 }
00131 
00132 extern "C" void dar_mask_or_add(dar_mask *ref, dar_mask* new_mask)
00133 {
00134     ou_mask* r = (ou_mask*)ref;
00135     libdar::mask* m = (libdar::mask*)new_mask;
00136     r->add_mask( *m );  
00137     return;
00138 }
00139 
00140 extern "C" void dar_mask_or_clear( dar_mask* ref )
00141 {
00142     ou_mask* r  = (ou_mask*)ref;
00143     r->clear();
00144     return;
00145 }
00146 
00147 extern "C" U_I dar_mask_or_size( dar_mask* ref )
00148 {
00149     ou_mask* r = (ou_mask*)ref;
00150     return r->size();
00151 }
00152 
00153 
00154 
00155 NAMESPACE_LIBDAR_END
00156