update credits
[LibreOffice.git] / include / tools / rc.hxx
bloba043db47d4d533a2f5688c07ca9df63206f26e97
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 #ifndef _TOOLS_RC_HXX
20 #define _TOOLS_RC_HXX
22 #include "tools/toolsdllapi.h"
23 #include <i18nlangtag/lang.h>
24 #include <tools/string.hxx>
25 #include <tools/resmgr.hxx>
27 class TOOLS_DLLPUBLIC Resource
29 protected:
30 ResMgr* m_pResMgr;
32 // check availability of Resource
33 sal_Bool IsAvailableRes( const ResId& rId ) const
34 { return m_pResMgr->IsAvailable( rId, this ); }
36 // Load a Resource
37 void GetRes( const ResId& rResId );
39 // check Resource state
40 void TestRes();
42 // Get a pointer to the Resource's data
43 void* GetClassRes()
44 { return m_pResMgr->GetClass(); }
46 // increase the memory pointer gotten by GetClassRes()
47 void* IncrementRes( sal_uInt32 nBytes )
48 { return m_pResMgr->Increment( nBytes ); }
50 // return the memory size of a Resource data block
51 static sal_uInt32 GetObjSizeRes( RSHEADER_TYPE * pHT )
52 { return ResMgr::GetObjSize( pHT ); }
54 // return the remaining size of this Resource's data
55 sal_uInt32 GetRemainSizeRes()
56 { return m_pResMgr->GetRemainSize(); }
58 // get a 32bit value from Resource data
59 static sal_Int32 GetLongRes( void * pLong )
60 { return ResMgr::GetLong( pLong ); }
61 // get a 16bit value from Resource data
62 static sal_Int16 GetShortRes( void * pShort )
63 { return ResMgr::GetShort( pShort ); }
65 // read a 32bit value from resource data and increment pointer
66 sal_Int32 ReadLongRes()
67 { return m_pResMgr->ReadLong(); }
68 // read a 16bit value from resource data and increment pointer
69 sal_Int16 ReadShortRes()
70 { return m_pResMgr->ReadShort(); }
71 // read a string from resource data and increment pointer
72 OUString ReadStringRes()
73 { return m_pResMgr->ReadString(); }
74 // read a byte string from resource data and increment pointer
75 OString ReadByteStringRes()
76 { return m_pResMgr->ReadByteString(); }
78 // free the resource from m_pResMgr's stack (pass this ptr for validation)
79 void FreeResource()
80 { m_pResMgr->PopContext( this ); }
82 // constructors
83 Resource() : m_pResMgr( NULL ) {}
84 Resource( const ResId& rResId );
86 public:
87 #ifdef DBG_UTIL
88 ~Resource() { TestRes(); }
89 #else
90 ~Resource() {}
91 #endif
94 #endif
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */