Skip to content

Instantly share code, notes, and snippets.

@almet
Created December 8, 2010 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save almet/733485 to your computer and use it in GitHub Desktop.
Save almet/733485 to your computer and use it in GitHub Desktop.
// that's the condition interface; A condtion have just to be met
class Condition {
public:
virtual bool isMet(File&) const = 0;
};
class FilenameEquals : public Condition
{
FilenameEquals(string);
bool isMet(File&) const;
};
class FilenameContains : public Condition
{
FilenameContains(string);
bool isMet(File&) const;
};
vector<Condition>::const_iterator iterator;
for(iterator = this->_conditions.begin();
iterator != this->_conditions.end(); ++iterator ){
if (!iterator->isMet(file)){
return; // exists if one condition is not met
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment