Home | Develop | Download | Contact
example_ra_match.cpp

Programa para el testeo de las funciones.Para compilar o código example_ra_match.cpp:

g++ -static -o example_ra_match example_ra_match.cpp -lpdsramm

Para executar o programa:

./example_ra_match

Retornando por consola:

    Found "a*f" in : "abcdef"

Not found "a*f" in : "abcdee"

    Found "[a-z]xx" in : "qxx"

Not found "[a-z]xx" in : "dqxx"

    Found "a??" in : "abc"

Not found "a??" in : "abcd"

Código example_ra_match.cpp:

#include <Pds/Ra>
int main(void)
{
int id;
std::string str;
std::string pat;
// Test1
std::cout<<std::endl;
str="abcdef";
pat="a*f";
if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
// Test2
std::cout<<std::endl;
str="abcdee";
pat="a*f";
if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
// Test3
std::cout<<std::endl;
str="qxx";
pat="[a-z]xx";
if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
// Test4
std::cout<<std::endl;
str="dqxx";
pat="[a-z]xx";
if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
// Test5
std::cout<<std::endl;
str="abc";
pat="a??";
if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
// Test6
std::cout<<std::endl;
str= "abcd";
pat="a??";
if(id==0) std::cout<<" Found \""<<pat<<"\" in : \""<<str<<"\"\n";
else std::cout<<"Not found \""<<pat<<"\" in : \""<<str<<"\"\n";
return 0;
}
int FnMatch(const std::string &pattern, const std::string &string, int flags)
función similar a fnmatch(), creada para tener compatibilidad en MinGw (code From FreeBSD fnmatch....
const unsigned int FNM_CASEFOLD
Definition: RaMatch.hpp:101

Enlaces de interés

HomePage Bazaar Download Bug report Ayuda Developer Feed