00001 //------------------------------------------------------------------------------ 00002 // This file is part of the OpenStructure project <www.openstructure.org> 00003 // 00004 // Copyright (C) 2008-2011 by the OpenStructure authors 00005 // 00006 // This library is free software; you can redistribute it and/or modify it under 00007 // the terms of the GNU Lesser General Public License as published by the Free 00008 // Software Foundation; either version 3.0 of the License, or (at your option) 00009 // any later version. 00010 // This library is distributed in the hope that it will be useful, but WITHOUT 00011 // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 00012 // FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00013 // details. 00014 // 00015 // You should have received a copy of the GNU Lesser General Public License 00016 // along with this library; if not, write to the Free Software Foundation, Inc., 00017 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00018 //------------------------------------------------------------------------------ 00019 #ifndef OST_QUERY_HF 00020 #define OST_QUERY_HF 00021 00022 /* 00023 Author: Marco Biasini 00024 */ 00025 00026 #include <string> 00027 #include <vector> 00028 #include <set> 00029 00030 #include <boost/variant.hpp> 00031 #include <boost/logic/tribool.hpp> 00032 00033 #include <ost/range.hh> 00034 00035 #include <ost/mol/module_config.hh> 00036 #include <ost/mol/impl/query_impl_fw.hh> 00037 #include <ost/mol/query_error.hh> 00038 #include <ost/mol/atom_handle.hh> 00039 #include <ost/mol/query_state.hh> 00040 00041 namespace ost { namespace mol { 00042 00061 struct DLLEXPORT_OST_MOL QueryFlag { 00062 typedef enum { 00063 EXCLUSIVE_BONDS=1, 00064 NO_BONDS=2, 00065 MATCH_RESIDUES=4 00066 } Flag; 00067 }; 00068 00069 typedef uint QueryFlags; 00070 00074 class DLLEXPORT_OST_MOL Query { 00075 public: 00077 Query(const String& query_string=""); 00078 00080 Query(const impl::QueryImplP& impl); 00081 00083 bool IsAtomSelected(const AtomHandle& ah) const; 00084 00089 bool IsChainSelected(const ChainHandle& chain) const; 00090 00095 bool IsResidueSelected(const ResidueHandle& residue) const; 00096 00098 const String& GetQueryString() const; 00099 00100 const QueryErrorDesc& GetErrorDescription() const; 00101 00103 QueryState CreateQueryState(const EntityView& view) const; 00104 00106 QueryState CreateQueryState(const EntityHandle& view) const; 00107 00108 // only valid if parsed without error 00109 bool IsValid() const; 00110 // an empty query String defaults to matching everything 00111 bool MatchAll() const; 00112 00113 // for internal use only 00114 impl::QueryImplP Impl(); 00115 const impl::QueryImplP& Impl() const; 00116 private: 00117 impl::QueryImplP impl_; 00118 }; 00119 00120 }} // ns 00121 00122 #endif 00123