#6106 Apply clang-format on AppFwk

This commit is contained in:
Magne Sjaastad
2020-06-19 07:53:59 +02:00
parent e2ef6a910b
commit bdc536dfc4
407 changed files with 88976 additions and 42309 deletions

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Ceetron Solutions AS
//
//
// <APPLICATION_NAME> is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
//
// <APPLICATION_NAME> is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -24,94 +24,80 @@
#include <algorithm>
namespace caf
{
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
NotificationCenter::NotificationCenter()
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
NotificationCenter::~NotificationCenter()
{
CAF_ASSERT(m_observers.size() == 0);
CAF_ASSERT( m_observers.size() == 0 );
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void NotificationCenter::registerObserver(DataModelObserver* observer)
void NotificationCenter::registerObserver( DataModelObserver* observer )
{
std::vector<DataModelObserver*>::iterator it = std::find(m_observers.begin(), m_observers.end(), observer);
if (it == m_observers.end())
std::vector<DataModelObserver*>::iterator it = std::find( m_observers.begin(), m_observers.end(), observer );
if ( it == m_observers.end() )
{
m_observers.push_back(observer);
m_observers.push_back( observer );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void NotificationCenter::removeObserver(DataModelObserver* observer)
void NotificationCenter::removeObserver( DataModelObserver* observer )
{
std::vector<DataModelObserver*>::iterator it = std::find(m_observers.begin(), m_observers.end(), observer);
if (it != m_observers.end())
std::vector<DataModelObserver*>::iterator it = std::find( m_observers.begin(), m_observers.end(), observer );
if ( it != m_observers.end() )
{
m_observers.erase(it);
m_observers.erase( it );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void NotificationCenter::notifyObserversOfDataChange(caf::PdmObjectHandle* itemThatChanged)
void NotificationCenter::notifyObserversOfDataChange( caf::PdmObjectHandle* itemThatChanged )
{
CAF_ASSERT(itemThatChanged);
CAF_ASSERT( itemThatChanged );
foreach(DataModelObserver* o, m_observers)
foreach ( DataModelObserver* o, m_observers )
{
o->handleModelNotification(itemThatChanged);
o->handleModelNotification( itemThatChanged );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void NotificationCenter::notifyObservers()
{
foreach(DataModelObserver* o, m_observers)
foreach ( DataModelObserver* o, m_observers )
{
o->handleModelNotification(nullptr);
o->handleModelNotification( nullptr );
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void NotificationCenter::notifyObserversOfSelectionChange()
{
foreach(DataModelObserver* o, m_observers)
foreach ( DataModelObserver* o, m_observers )
{
o->handleModelSelectionChange();
}
}
} // end namespace caf