00001 /* 00002 * wsdlpull - A C++ parser for WSDL (Web services description language) 00003 * Copyright (C) 2005-2007 Vivek Krishna 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Library General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Library General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Library General Public 00016 * License along with this library; if not, write to the Free 00017 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00018 * 00019 */ 00020 00021 #ifndef CONSTRAINT_H 00022 #define CONSTRAINT_H 00023 // ********************************************************************* 00024 // Include files: 00025 // ********************************************************************* 00026 #include <string> 00027 #include <list> 00028 #include "xmlpull/wsdlpull_export.h" 00029 #include "schemaparser/Schema.h" 00030 #include "schemaparser/Annotation.h" // Proposed upgrade 00031 00032 namespace Schema { 00033 class WSDLPULL_EXPORT Constraint 00034 { 00035 public: 00036 Constraint(Schema::ConstraintType c); 00037 00038 std::string getName()const; 00039 void setName(const std::string & n); 00040 virtual Schema::ConstraintType getConstraintType(); 00041 void setSelector(const std::string & xpath); 00042 void addField(const std::string &xpath); 00043 std::string selector()const; 00044 const std::list<std::string>& fields(); 00045 virtual ~Constraint(); 00046 void setAnnotation(const std::string & s); 00047 00048 private: 00049 Schema::ConstraintType m_constraints; 00050 std::string m_name,m_annotation; 00051 std::string m_selector; 00052 std::list<std::string> m_fields; 00053 }; 00054 00055 inline 00056 Constraint::Constraint(Schema::ConstraintType c) 00057 :m_constraints(c) 00058 { 00059 m_fields.clear(); 00060 } 00061 00062 inline 00063 void 00064 Constraint::setSelector(const std::string & xpath) 00065 { 00066 m_selector=xpath; 00067 } 00068 00069 inline 00070 std::string 00071 Constraint::selector()const 00072 { 00073 return m_selector; 00074 } 00075 00076 inline 00077 const std::list<std::string>& 00078 Constraint::fields() 00079 { 00080 return m_fields; 00081 } 00082 00083 inline 00084 void 00085 Constraint::addField(const std::string & xpath) 00086 { 00087 m_fields.push_back(xpath); 00088 } 00089 00090 inline 00091 std::string 00092 Constraint::getName()const 00093 { 00094 return m_name; 00095 } 00096 00097 inline 00098 void 00099 Constraint::setName(const std::string &n) 00100 { 00101 m_name=n; 00102 } 00103 00104 inline 00105 void 00106 Constraint::setAnnotation(const std::string &s) 00107 { 00108 m_annotation=s; 00109 } 00110 00111 inline 00112 Constraint::~Constraint() 00113 { 00114 } 00115 00116 inline 00117 Schema::ConstraintType 00118 Constraint::getConstraintType() 00119 { 00120 return Schema::NoConstraint; 00121 } 00122 00123 } 00124 #endif // GROUP_H