/* -*- 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 .
*/
// returns NULL if no entry exists, or a pointer to the internal value const SvxMacro* SvxMacroTableDtor::Get(SvMacroItemId nEvent) const
{
SvxMacroTable::const_iterator it = aSvxMacroTable.find(nEvent); return it == aSvxMacroTable.end() ? nullptr : &(it->second);
}
// returns NULL if no entry exists, or a pointer to the internal value
SvxMacro* SvxMacroTableDtor::Get(SvMacroItemId nEvent)
{
SvxMacroTable::iterator it = aSvxMacroTable.find(nEvent); return it == aSvxMacroTable.end() ? nullptr : &(it->second);
}
// return true if the key exists bool SvxMacroTableDtor::IsKeyValid(SvMacroItemId nEvent) const
{
SvxMacroTable::const_iterator it = aSvxMacroTable.find(nEvent); return it != aSvxMacroTable.end();
}
// This stores a copy of the rMacro parameter
SvxMacro& SvxMacroTableDtor::Insert(SvMacroItemId nEvent, const SvxMacro& rMacro)
{ return aSvxMacroTable.emplace( nEvent, rMacro ).first->second;
}
// If the entry exists, remove it from the map and release it's storage void SvxMacroTableDtor::Erase(SvMacroItemId nEvent)
{
SvxMacroTable::iterator it = aSvxMacroTable.find(nEvent); if ( it != aSvxMacroTable.end())
{
aSvxMacroTable.erase(it);
}
}
void SvxMacroItem::SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro )
{ // tdf#141123: emplace doesn't replace the element in the map if already exists // see https://en.cppreference.com/w/cpp/container/map/emplace // so first erase the macro if there's one for this event
aMacroTable.Erase(nEvent);
aMacroTable.Insert( nEvent, rMacro);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.