122e87013SAndrew Rist /************************************************************** 2*227e95afSMatthias Seidel * 322e87013SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 422e87013SAndrew Rist * or more contributor license agreements. See the NOTICE file 522e87013SAndrew Rist * distributed with this work for additional information 622e87013SAndrew Rist * regarding copyright ownership. The ASF licenses this file 722e87013SAndrew Rist * to you under the Apache License, Version 2.0 (the 822e87013SAndrew Rist * "License"); you may not use this file except in compliance 922e87013SAndrew Rist * with the License. You may obtain a copy of the License at 10*227e95afSMatthias Seidel * 1122e87013SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*227e95afSMatthias Seidel * 1322e87013SAndrew Rist * Unless required by applicable law or agreed to in writing, 1422e87013SAndrew Rist * software distributed under the License is distributed on an 1522e87013SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1622e87013SAndrew Rist * KIND, either express or implied. See the License for the 1722e87013SAndrew Rist * specific language governing permissions and limitations 1822e87013SAndrew Rist * under the License. 19*227e95afSMatthias Seidel * 2022e87013SAndrew Rist *************************************************************/ 2122e87013SAndrew Rist 2222e87013SAndrew 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 56*227e95afSMatthias Seidel @attention This class is not threadsafe implemented. Because it's not necessary. 57*227e95afSMatthias Seidel But you have to make sure, that it's 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 72*227e95afSMatthias Seidel TODO Maybe it's 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 85*227e95afSMatthias Seidel @descr The given query is immediately analyzed 8607a3d7f1SPedro Giffuni and separated into its token, which can 87*227e95afSMatthias Seidel be accessed 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