/* * Project: MoleCuilder * Description: creates and alters molecular systems * Copyright (C) 2012 University of Bonn. All rights reserved. * Please see the LICENSE file or "Copyright notice" in builder.cpp for details. */ /* * FormulaValidator.cpp * * Created on: May 14, 2012 * Author: ankele */ // include config.h #ifdef HAVE_CONFIG_H #include #endif #include "CodePatterns/MemDebug.hpp" #include "FormulaValidator.hpp" #include "Formula.hpp" bool FormulaValidator::isValid(const std::string & _value) const { try{ Formula f(_value); }catch(FormulaException *e){ return false; } return true; } bool FormulaValidator::operator==(const Validator &_instance) const { const FormulaValidator *inst = dynamic_cast(&_instance); if (inst) return true; else return false; } Validator< std::string >* FormulaValidator::clone() const { Validator< std::string > *inst = new FormulaValidator(); return inst; }