1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 #ifndef _TOOLS_RESARY_HXX 24 #define _TOOLS_RESARY_HXX 25 26 #include "tools/toolsdllapi.h" 27 #include <tools/resid.hxx> 28 #include <tools/rc.hxx> 29 30 // --------------------- 31 // - ImplResStringItem - 32 // --------------------- 33 34 struct ImplResStringItem 35 { 36 XubString maStr; 37 long mnValue; 38 39 //#if 0 // _SOLAR__PRIVATE 40 #ifdef _TOOLS_RESARY_CXX ImplResStringItemImplResStringItem41 ImplResStringItem( const XubString& rStr ) : 42 maStr( rStr ) {} 43 #endif 44 //#endif 45 }; 46 47 // ------------------ 48 // - ResStringArray - 49 // ------------------ 50 51 #define RESARRAY_INDEX_NOTFOUND (0xffffffff) 52 53 class TOOLS_DLLPUBLIC ResStringArray 54 { 55 private: 56 // --------------------- 57 // - ImplResStringItem - 58 // --------------------- 59 struct ImplResStringItem 60 { 61 XubString m_aStr; 62 long m_nValue; 63 ImplResStringItemResStringArray::ImplResStringItem64 ImplResStringItem( const XubString& rStr, long nValue = 0 ) : 65 m_aStr( rStr ), 66 m_nValue( nValue ) 67 {} 68 }; 69 70 std::vector< ImplResStringItem > m_aStrings; 71 72 public: 73 ResStringArray( const ResId& rResId ); 74 ~ResStringArray(); 75 GetString(sal_uInt32 nIndex) const76 const XubString& GetString( sal_uInt32 nIndex ) const 77 { return (nIndex < m_aStrings.size()) ? m_aStrings[nIndex].m_aStr : String::EmptyString(); } GetValue(sal_uInt32 nIndex) const78 long GetValue( sal_uInt32 nIndex ) const 79 { return (nIndex < m_aStrings.size()) ? m_aStrings[nIndex].m_nValue : -1; } Count() const80 sal_uInt32 Count() const { return sal_uInt32(m_aStrings.size()); } 81 82 sal_uInt32 FindIndex( long nValue ) const; 83 84 private: 85 ResStringArray( const ResStringArray& ); 86 ResStringArray& operator=( const ResStringArray& ); 87 }; 88 89 #endif // _TOOLS_RESARY_HXX 90