Funciones para correspondecia de padrones: Pds::Ra::FnMatch(), etc. Más...
Namespaces | |
namespace | Pds |
Nombre de espacio para Pds (Procesamiento Digital de Senales) | |
namespace | Pds::Ra |
Nombre de espacio para RA (Real Arrays) | |
Funciones | |
int | Pds::Ra::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.h 1.7). Más... | |
Variables | |
const unsigned int | Pds::Ra::FNM_NOMATCH =1 |
const unsigned int | Pds::Ra::FNM_NOESCAPE =0x01 |
const unsigned int | Pds::Ra::FNM_PATHNAME =0x02 |
const unsigned int | Pds::Ra::FNM_PERIOD =0x04 |
const unsigned int | Pds::Ra::FNM_LEADING_DIR =0x08 |
const unsigned int | Pds::Ra::FNM_CASEFOLD =0x10 |
const unsigned int | Pds::Ra::FNM_PREFIX_DIRS =0x20 |
Funciones para correspondecia de padrones: Pds::Ra::FnMatch(), etc.
int Pds::Ra::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.h 1.7).
std::cout<<"Found a*f in : abcdef ? ";
std::cout<<Pds::Ra::FnMatch("a*f","abcdef",Pds::Ra::FNM_CASEFOLD);
std::cout<<std::endl;
std::cout<<"Found a*f in : abcdee ? ";
std::cout<<Pds::Ra::FnMatch("a*f","abcdee",Pds::Ra::FNM_CASEFOLD);
std::cout<<std::endl;
std::cout<<"Found [a-z]xx in : qxx ? ";
std::cout<<Pds::Ra::FnMatch("[a-z]xx","qxx",Pds::Ra::FNM_CASEFOLD);
std::cout<<std::endl;
std::cout<<"Found [a-z]xx in : dqxx ? ";
std::cout<<Pds::Ra::FnMatch("[a-z]xx","dqxx",Pds::Ra::FNM_CASEFOLD);
std::cout<<std::endl;
std::cout<<"Found a?? in : abc ? ";
std::cout<<Pds::Ra::FnMatch("a??","abc",Pds::Ra::FNM_CASEFOLD);
std::cout<<std::endl;
std::cout<<"Found a?? in : abcd ? ";
std::cout<<Pds::Ra::FnMatch("a??","abcd",Pds::Ra::FNM_CASEFOLD);
std::cout<<std::endl;
La salida sería:
Found a*f in : abcdef ? 0 Found a*f in : abcdee ? 1 Found [a-z]xx in : qxx ? 0 Found [a-z]xx in : dqxx ? 1 Found a?? in : abc ? 0 Found a?? in : abcd ? 1
The fnmatch() function checks whether the string argument matches the pattern argument, which is a shell wildcard pattern. The flags argument modifies the behavior; it is the bitwise OR of zero or more of the following flags:
Pds::Ra::FNM_NOESCAPE | If this flag is set, treat backslash as an ordinary character, instead of an escape character. |
---|---|
Pds::Ra::FNM_PATHNAME | If this flag is set, match a slash in string only with a slash in pattern and not by an asterisk (*) or a question mark (?) metacharacter, nor by a bracket expression ([]) containing a slash. |
Pds::Ra::FNM_PERIOD | If this flag is set, a leading period in string has to be matched exactly by a period in pattern. A period is considered to be leading if it is the first character in string, or if both FNM_PATHNAME is set and the period immediately follows a slash. |
Pds::Ra::FNM_LEADING_DIR | If this flag (a GNU extension) is set, the pattern is considered to be matched if it matches an initial segment of string which is followed by a slash. This flag is mainly for the internal use of glibc and is implemented only in certain cases. |
Pds::Ra::FNM_CASEFOLD | If this flag (a GNU extension) is set, the pattern is matched case-insensitively. |
[in] | pattern | Patron de busqueda. |
[in] | string | Cadena en analisis. |
[in] | flags | Flags de busqueda. |
const unsigned int Pds::Ra::FNM_NOMATCH =1 |
Match failed.
Definición en la línea 71 del archivo RaMatch.hpp.
const unsigned int Pds::Ra::FNM_NOESCAPE =0x01 |
Disable backslash escaping.
Definición en la línea 77 del archivo RaMatch.hpp.
const unsigned int Pds::Ra::FNM_PATHNAME =0x02 |
Slash must be matched by slash.
Definición en la línea 83 del archivo RaMatch.hpp.
const unsigned int Pds::Ra::FNM_PERIOD =0x04 |
Period must be matched by period.
Definición en la línea 89 del archivo RaMatch.hpp.
const unsigned int Pds::Ra::FNM_LEADING_DIR =0x08 |
Ignore tail after Imatch.
Definición en la línea 95 del archivo RaMatch.hpp.
const unsigned int Pds::Ra::FNM_CASEFOLD =0x10 |
Case insensitive search.
Definición en la línea 101 del archivo RaMatch.hpp.
const unsigned int Pds::Ra::FNM_PREFIX_DIRS =0x20 |
Directory prefixes of pattern match too.
Definición en la línea 107 del archivo RaMatch.hpp.