1 ///###//////////////////////////////////////////////////////////////////////// 2 // 3 // Burton Computer Corporation 4 // http://www.burton-computer.com 5 // http://www.cooldevtools.com 6 // $Id: HdlStandardStatementConstraint.h 272 2007-01-06 19:37:27Z brian $ 7 // 8 // Copyright (C) 2007 Burton Computer Corporation 9 // ALL RIGHTS RESERVED 10 // 11 // This program is open source software; you can redistribute it 12 // and/or modify it under the terms of the Q Public License (QPL) 13 // version 1.0. Use of this software in whole or in part, including 14 // linking it (modified or unmodified) into other programs is 15 // subject to the terms of the QPL. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // Q Public License for more details. 21 // 22 // You should have received a copy of the Q Public License 23 // along with this program; see the file LICENSE.txt. If not, visit 24 // the Burton Computer Corporation or CoolDevTools web site 25 // QPL pages at: 26 // 27 // http://www.burton-computer.com/qpl.html 28 // http://www.cooldevtools.com/qpl.html 29 // 30 31 #ifndef _HdlStandardStatementConstraint_h 32 #define _HdlStandardStatementConstraint_h 33 34 #include "HdlStatementConstraint.h" 35 36 class HdlArgumentConstraint; 37 38 class HdlStandardStatementConstraint : public HdlStatementConstraint 39 { 40 public: HdlStandardStatementConstraint(const string & name,bool is_block)41 HdlStandardStatementConstraint(const string &name, 42 bool is_block) 43 : HdlStatementConstraint(name), 44 m_isBlock(is_block), 45 m_minArgCount(0), 46 m_maxArgCount(0) 47 { 48 } 49 ~HdlStandardStatementConstraint()50 virtual ~HdlStandardStatementConstraint() 51 { 52 } 53 54 virtual void validateStatement(const HdlStatement *stmt) const; 55 addArgument(const Ref<HdlArgumentConstraint> & arg)56 void addArgument(const Ref<HdlArgumentConstraint> &arg) 57 { 58 m_arguments.push_back(arg); 59 } 60 addChild(const Ref<HdlStatementConstraint> & child)61 void addChild(const Ref<HdlStatementConstraint> &child) 62 { 63 m_children.push_back(child); 64 } 65 setArgCounts(int min_args,int max_args)66 void setArgCounts(int min_args, 67 int max_args) 68 { 69 m_minArgCount = min_args; 70 m_maxArgCount = max_args; 71 } 72 73 private: 74 const CRef<HdlStatementConstraint> childConstraint(const string &id) const; 75 void throwInvalidStatement(const CRef<HdlToken> &token) const; 76 77 private: 78 /// Not implemented. 79 HdlStandardStatementConstraint(const HdlStandardStatementConstraint &); 80 81 /// Not implemented. 82 HdlStandardStatementConstraint& operator=(const HdlStandardStatementConstraint &); 83 84 private: 85 typedef vector<Ref<HdlArgumentConstraint> > ArgVector; 86 typedef vector<Ref<HdlStatementConstraint> > ChildVector; 87 88 bool m_isBlock; 89 int m_minArgCount; 90 int m_maxArgCount; 91 ArgVector m_arguments; 92 ChildVector m_children; 93 }; 94 95 #endif // _HdlStandardStandardStatementConstraint_h 96