Beispiel #1
0
DECLARE_EXPORT SetupMatrix::Rule* SetupMatrix::calculateSetup
(const string oldsetup, const string newsetup) const
{
  // No need to look
  if (oldsetup == newsetup) return NULL;

  // Loop through all rules
  for (Rule *curRule = firstRule; curRule; curRule = curRule->nextRule)
  {
    // Need a match on the fromsetup
    if (!curRule->getFromSetup().empty()
        && !matchWildcard(curRule->getFromSetup().c_str(), oldsetup.c_str()))
      continue;
    // Need a match on the tosetup
    if (!curRule->getToSetup().empty()
        && !matchWildcard(curRule->getToSetup().c_str(), newsetup.c_str()))
      continue;
    // Found a match
    return curRule;
  }

  // No matching rule was found
  logger << "Warning: Conversion from '" << oldsetup << "' to '" << newsetup
      << "' undefined in setup matrix '" << getName() << endl;
  return NULL;
}
MojErr MojDbQuotaEngine::quotaForKind(const MojDbKind* kind, MojRefCountedPtr<Quota>& quotaOut)
{
	// prefer to use super's quota
	const MojDbKind::KindVec& supers = kind->supers();
	for (MojDbKind::KindVec::ConstIterator i = supers.begin(); i != supers.end(); ++i) {
		// don't want to inherit admin quota, so don't check root kind
		if ((*i)->id() != MojDbKindEngine::RootKindId) {
			MojErr err = quotaForKind(*i, quotaOut);
			MojErrCheck(err);
			if (quotaOut.get())
				return MojErrNone;
		}
	}
	// check for quota that matches owner of this kindS
	const MojString& owner = kind->owner();
	QuotaMap::ConstIterator iter = m_quotas.find(owner);
	if (iter == m_quotas.end()) {
		for (iter = m_quotas.begin(); iter != m_quotas.end(); ++iter) {
			if (matchWildcard(iter.key(), owner, owner.length()))
				break;
		}
	}
	if (iter != m_quotas.end()) {
		quotaOut = *iter;
	}
	return MojErrNone;
}
WebPathSegment * WebPathSegment::recursiveMatch(vector<string> &segList)
{
  string name = segList.at(0);
  segList.erase(segList.begin());
  
  bool segmentFound = hasSegment(name);
  if (segmentFound && segList.size() != 0) return _segmentList[name]->recursiveMatch(segList);
  
  /* We have matching sibling! No need to continue recursion.  */
  
  if (segmentFound && segList.size() == 0)
    {
      return _segmentList[name].get();
    }
  return matchWildcard();
}
Beispiel #4
0
Bool fontCmp(void* entry, void* fontWildCard) {
    return matchWildcard(fontWildCard, ((FontCacheEntry*) entry)->XLFName);
}
bool WildcardFileFilter::isDirectorySuitable (const File& file) const
{
    return matchWildcard (file, directoryWildcards);
}
bool WildcardFileFilter::isFileSuitable (const File& file) const
{
    return matchWildcard (file, fileWildcards);
}