#include "header.h"
#include <stdio.h>
#include "Neutral.h"
#include "Shell.h"
#include "Wildcard.h"
Functions | |
int | simpleWildcardFind (const string &path, vector< ObjId > &ret) |
int | wildcardFind (const string &path, vector< ObjId > &ret) |
int | singleLevelWildcard (ObjId start, const string &path, vector< ObjId > &ret) |
bool | alignedSingleWildcardMatch (const string &name, const string &wild) |
unsigned int | findWithSingleCharWildcard (const string &name, unsigned int start, const string &wild) |
int | allChildren (ObjId start, unsigned int index, const string &insideBrace, vector< ObjId > &ret) |
void | wildcardTestFunc (ObjId *elist, unsigned int ne, const string &path) |
void | testWildcard () |
bool alignedSingleWildcardMatch | ( | const string & | name, | |
const string & | wild | |||
) |
Returns true if the name matches the wildcard string. Doesn't care about following characters in 'name'. Single character wildcards are indicated with '?'
Referenced by findWithSingleCharWildcard(), and testWildcard().
int allChildren | ( | ObjId | start, | |
unsigned int | index, | |||
const string & | insideBrace, | |||
vector< ObjId > & | ret | |||
) |
Recursive function to compare all descendants and cram matches into ret. Returns number of matches.
References ALLDATA, Neutral::children(), ObjId::dataIndex, and ObjId::eref().
Referenced by moose::CompartmentBase::setGeomAndElec(), and singleLevelWildcard().
unsigned int findWithSingleCharWildcard | ( | const string & | name, | |
unsigned int | start, | |||
const string & | wild | |||
) |
Returns start index for match between string and wildcard using '?' to indicate single character matches. Scans forward along 'name' until it finds a match, or gives up. The entire wildcard must be matched, otherwise returns ~0U findWithSingleCharWildcard( "abc", 0, "a?c" ): return 0; findWithSingleCharWildcard( "xyzabc", 1, "a?c" ): return 3; findWithSingleCharWildcard( "xyzabb", 1, "a?c" ): return ~0U;
References alignedSingleWildcardMatch().
Referenced by testWildcard().
int simpleWildcardFind | ( | const string & | path, | |
vector< ObjId > & | ret | |||
) |
This is the basic wildcardFind function, working on a single tree. It adds entries into the vector 'ret' with Ids found according to the path string. It preserves the order of the returned Ids as the order of elements traversed in the search. It does NOT eliminate duplicates. This is a depth-first search. Note that it does the dumb but backward compatible thing with Ids of arrays: it lists every entry.
It returns the number of Ids found here.
References Shell::chopString().
Referenced by testWildcard(), wildcardFind(), and wildcardTestFunc().
singleLevelWildcard parses a single level of the path and returns all ids that match it. If there is a suitable doublehash, it will recurse into child elements. Returns # of ids found.
References allChildren(), ALLDATA, Neutral::children(), ObjId::dataIndex, and ObjId::eref().
void testWildcard | ( | ) |
References alignedSingleWildcardMatch(), ALLDATA, Shell::doCreate(), Shell::doDelete(), findWithSingleCharWildcard(), Field< A >::set(), simpleWildcardFind(), wildcardTestFunc(), and y.
Referenced by testMpiShell(), and testShell().
int wildcardFind | ( | const string & | path, | |
vector< ObjId > & | ret | |||
) |
References simpleWildcardFind().
Referenced by writeGroup(), and writeKkit().
void wildcardTestFunc | ( | ObjId * | elist, | |
unsigned int | ne, | |||
const string & | path | |||
) |
References ObjId::element(), Element::getName(), and simpleWildcardFind().
Referenced by testWildcard().