blob: 7797ef3aef457632f7d6b4c43e0a965a9e906031 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _SAX_ATTRIBUTEMAP_HXX_
#define _SAX_ATTRIBUTEMAP_HXX_
#include <map>
#include "sax/tools/tokenmap.hxx"
namespace sax
{
class SaxTokenMap;
typedef std::map< sal_uInt32, rtl::OString > AttributeMapBase;
/** a map for a set of xml attributes, identified with integer tokens.
Attribute values are stored in utf-8 encoding. */
class SAX_DLLPUBLIC AttributeMap : public AttributeMapBase
{
public:
AttributeMap( const SaxTokenMap& rTokenMap );
~AttributeMap();
/** returns a unicode string, if the token does not exists the string is empty */
::rtl::OUString getString( SaxToken nToken ) const;
/** returns true if the attribute with the token nToken is part of this map */
bool has( SaxToken nToken ) const;
/** converts the attribute with the token nToken to sal_Int32 or returns
nDefault if this attribute does not exists */
sal_Int32 getInt32( SaxToken nToken, sal_Int32 nDefault = 0 ) const;
/** converts the attribute with the token nToken to a token or returns
nDefault if this attribute does not exists */
sal_uInt32 getToken( SaxToken nToken, SaxToken nDefault ) const;
private:
const SaxTokenMap& mrTokenMap;
};
}
#endif // _SAX_ATTRIBUTEMAP_HXX_
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|