Debian Codegraph @

xmloff/source/transform/TransformerActions.cxx

raw
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20 #include "TransformerActions.hxx"
21
22 #include <osl/diagnose.h>
23
24
25 using namespace ::xmloff::token;
26
27 XMLTransformerActions::XMLTransformerActions( XMLTransformerActionInit const *pInit )
28 {
29 if( !pInit )
30 return;
31
32 XMLTransformerActions::key_type aKey;
33 XMLTransformerActions::mapped_type aData;
34 while( pInit->m_nActionType != XML_TACTION_EOT )
35 {
36 aKey.m_nPrefix = pInit->m_nPrefix;
37 aKey.SetLocalName( pInit->m_eLocalName );
38
39 OSL_ENSURE( find( aKey ) == end(), "duplicate action map entry" );
40
41 aData.m_nActionType = pInit->m_nActionType;
42 aData.m_nParam1 = pInit->m_nParam1;
43 aData.m_nParam2 = pInit->m_nParam2;
44 aData.m_nParam3 = pInit->m_nParam3;
45 XMLTransformerActions::value_type aVal( aKey, aData );
46
47 insert( aVal );
48 ++pInit;
49 }
50 }
51
52 XMLTransformerActions::~XMLTransformerActions()
53 {
54 }
55
56 void XMLTransformerActions::Add( XMLTransformerActionInit const *pInit )
57 {
58 if( !pInit )
59 return;
60
61 XMLTransformerActions::key_type aKey;
62 XMLTransformerActions::mapped_type aData;
63 while( pInit->m_nActionType != XML_TACTION_EOT )
64 {
65 aKey.m_nPrefix = pInit->m_nPrefix;
66 aKey.SetLocalName( pInit->m_eLocalName );
67 XMLTransformerActions::iterator aIter = find( aKey );
68 if( aIter == end() )
69 {
70 aData.m_nActionType = pInit->m_nActionType;
71 aData.m_nParam1 = pInit->m_nParam1;
72 aData.m_nParam2 = pInit->m_nParam2;
73 aData.m_nParam3 = pInit->m_nParam3;
74 XMLTransformerActions::value_type aVal( aKey, aData );
75 insert( aVal );
76 }
77
78 ++pInit;
79 }
80 }
81
82 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */