1*f7c60c9cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*f7c60c9cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*f7c60c9cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*f7c60c9cSAndrew Rist * distributed with this work for additional information 6*f7c60c9cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*f7c60c9cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*f7c60c9cSAndrew Rist * "License"); you may not use this file except in compliance 9*f7c60c9cSAndrew Rist * with the License. You may obtain a copy of the License at 10*f7c60c9cSAndrew Rist * 11*f7c60c9cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12*f7c60c9cSAndrew Rist * 13*f7c60c9cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*f7c60c9cSAndrew Rist * software distributed under the License is distributed on an 15*f7c60c9cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*f7c60c9cSAndrew Rist * KIND, either express or implied. See the License for the 17*f7c60c9cSAndrew Rist * specific language governing permissions and limitations 18*f7c60c9cSAndrew Rist * under the License. 19*f7c60c9cSAndrew Rist * 20*f7c60c9cSAndrew Rist *************************************************************/ 21*f7c60c9cSAndrew Rist 22*f7c60c9cSAndrew Rist 23cdf0e10cSrcweir #ifndef _RSCHASH_HXX 24cdf0e10cSrcweir #define _RSCHASH_HXX 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <sal/types.h> 27cdf0e10cSrcweir #include <rtl/string.hxx> 28cdf0e10cSrcweir #include <hash_map> 29cdf0e10cSrcweir 30cdf0e10cSrcweir typedef sal_uInt32 Atom; 31cdf0e10cSrcweir 32cdf0e10cSrcweir #define InvalidAtom Atom( ~0 ) 33cdf0e10cSrcweir 34cdf0e10cSrcweir class AtomContainer 35cdf0e10cSrcweir { 36cdf0e10cSrcweir Atom m_nNextID; 37cdf0e10cSrcweir std::hash_map< rtl::OString, Atom, rtl::OStringHash > m_aStringToID; 38cdf0e10cSrcweir std::hash_map< Atom, rtl::OString > m_aIDToString; 39cdf0e10cSrcweir 40cdf0e10cSrcweir public: 41cdf0e10cSrcweir AtomContainer(); 42cdf0e10cSrcweir ~AtomContainer(); 43cdf0e10cSrcweir 44cdf0e10cSrcweir Atom getID( const rtl::OString& rStr, bool bOnlyIfExists = false ); 45cdf0e10cSrcweir const rtl::OString& getString( Atom nAtom ); 46cdf0e10cSrcweir 47cdf0e10cSrcweir }; 48cdf0e10cSrcweir 49cdf0e10cSrcweir #endif // _RSCHASH_HXX 50cdf0e10cSrcweir 51