1*22e87013SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*22e87013SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*22e87013SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*22e87013SAndrew Rist * distributed with this work for additional information 6*22e87013SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*22e87013SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*22e87013SAndrew Rist * "License"); you may not use this file except in compliance 9*22e87013SAndrew Rist * with the License. You may obtain a copy of the License at 10*22e87013SAndrew Rist * 11*22e87013SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*22e87013SAndrew Rist * 13*22e87013SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*22e87013SAndrew Rist * software distributed under the License is distributed on an 15*22e87013SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*22e87013SAndrew Rist * KIND, either express or implied. See the License for the 17*22e87013SAndrew Rist * specific language governing permissions and limitations 18*22e87013SAndrew Rist * under the License. 19*22e87013SAndrew Rist * 20*22e87013SAndrew Rist *************************************************************/ 21*22e87013SAndrew Rist 22*22e87013SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir #ifndef _FILTER_CONFIG_QUERYTOKENIZER_HXX_ 25cdf0e10cSrcweir #define _FILTER_CONFIG_QUERYTOKENIZER_HXX_ 26cdf0e10cSrcweir 27cdf0e10cSrcweir //_______________________________________________ 28cdf0e10cSrcweir // includes 29cdf0e10cSrcweir 30cdf0e10cSrcweir #include <hash_map> 31cdf0e10cSrcweir #include <rtl/ustring.hxx> 32cdf0e10cSrcweir 33cdf0e10cSrcweir //_______________________________________________ 34cdf0e10cSrcweir // namespace 35cdf0e10cSrcweir 36cdf0e10cSrcweir namespace filter{ 37cdf0e10cSrcweir namespace config{ 38cdf0e10cSrcweir 39cdf0e10cSrcweir //_______________________________________________ 40cdf0e10cSrcweir // definitions 41cdf0e10cSrcweir 42cdf0e10cSrcweir /** @short It can be used to split any query string (which can be used at the 43cdf0e10cSrcweir related interface <type scope="com::sun::star::container">XContainerQuery</type>) 44cdf0e10cSrcweir into its different tokens using a fix schema. 45cdf0e10cSrcweir 46cdf0e10cSrcweir @descr All queries implemented of the services 47cdf0e10cSrcweir <ul> 48cdf0e10cSrcweir <li><type scope="com::sun::star::document">TypeDetection</type></li> 49cdf0e10cSrcweir <li><type scope="com::sun::star::document">FilterFactory</type></li> 50cdf0e10cSrcweir <li><type scope="com::sun::star::document">ExtendedTypeDetectionFactory</type></li> 51cdf0e10cSrcweir <li><type scope="com::sun::star::frame">FrameLoaderFactory</type></li> 52cdf0e10cSrcweir <li><type scope="com::sun::star::frame">ContentHandlerFactory</type></li> 53cdf0e10cSrcweir </ul> 54cdf0e10cSrcweir uses this schema. 55cdf0e10cSrcweir 56cdf0e10cSrcweir @attention This class is not threadsafe implemented. Because its not neccessary. 57cdf0e10cSrcweir But you have to make shure, that ist not used as such :-) 58cdf0e10cSrcweir */ 59cdf0e10cSrcweir class QueryTokenizer : public ::std::hash_map< ::rtl::OUString , 60cdf0e10cSrcweir ::rtl::OUString , 61cdf0e10cSrcweir ::rtl::OUStringHash , 62cdf0e10cSrcweir ::std::equal_to< ::rtl::OUString > > 63cdf0e10cSrcweir { 64cdf0e10cSrcweir //------------------------------------------- 65cdf0e10cSrcweir // member 66cdf0e10cSrcweir 67cdf0e10cSrcweir private: 68cdf0e10cSrcweir 69cdf0e10cSrcweir /** @short Because the given query can contain errors, 70cdf0e10cSrcweir it should be checked outside. 71cdf0e10cSrcweir 72cdf0e10cSrcweir TODO May its a good idea to describe the real problem 73cdf0e10cSrcweir more detailed ... 74cdf0e10cSrcweir */ 75cdf0e10cSrcweir sal_Bool m_bValid; 76cdf0e10cSrcweir 77cdf0e10cSrcweir //------------------------------------------- 78cdf0e10cSrcweir // interface 79cdf0e10cSrcweir 80cdf0e10cSrcweir public: 81cdf0e10cSrcweir 82cdf0e10cSrcweir /** @short create a new tokenizer instance with a 83cdf0e10cSrcweir a new query. 84cdf0e10cSrcweir 85cdf0e10cSrcweir @descr The given query is immidiatly analyzed 86cdf0e10cSrcweir and seperated into its token, which can 87cdf0e10cSrcweir be access by some specialized method later. 88cdf0e10cSrcweir 89cdf0e10cSrcweir @param sQuery 90cdf0e10cSrcweir the query string. 91cdf0e10cSrcweir */ 92cdf0e10cSrcweir QueryTokenizer(const ::rtl::OUString& sQuery); 93cdf0e10cSrcweir 94cdf0e10cSrcweir //--------------------------------------- 95cdf0e10cSrcweir 96cdf0e10cSrcweir /** @short destruct an instance of this class. 97cdf0e10cSrcweir */ 98cdf0e10cSrcweir virtual ~QueryTokenizer(); 99cdf0e10cSrcweir 100cdf0e10cSrcweir //--------------------------------------- 101cdf0e10cSrcweir 102cdf0e10cSrcweir /** @short can be used to check if analyzing of given query 103cdf0e10cSrcweir was successfully or not. 104cdf0e10cSrcweir */ 105cdf0e10cSrcweir virtual sal_Bool valid() const; 106cdf0e10cSrcweir }; 107cdf0e10cSrcweir 108cdf0e10cSrcweir } // namespace config 109cdf0e10cSrcweir } // namespace filter 110cdf0e10cSrcweir 111cdf0e10cSrcweir #endif // _FILTER_CONFIG_QUERYTOKENIZER_HXX_ 112