Convert MCore::Command uint32 -> size_t
Signed-off-by: Chris Burel <burelc@amazon.com>
This commit is contained in:
@@ -163,9 +163,9 @@ namespace EMStudio
|
|||||||
{}
|
{}
|
||||||
~UndoMenuCallback() = default;
|
~UndoMenuCallback() = default;
|
||||||
|
|
||||||
void OnRemoveCommand([[maybe_unused]] uint32 historyIndex) override { m_mainWindow->UpdateUndoRedo(); }
|
void OnRemoveCommand([[maybe_unused]] size_t historyIndex) override { m_mainWindow->UpdateUndoRedo(); }
|
||||||
void OnSetCurrentCommand([[maybe_unused]] uint32 index) override { m_mainWindow->UpdateUndoRedo(); }
|
void OnSetCurrentCommand([[maybe_unused]] size_t index) override { m_mainWindow->UpdateUndoRedo(); }
|
||||||
void OnAddCommandToHistory([[maybe_unused]] uint32 historyIndex, [[maybe_unused]] MCore::CommandGroup* group, [[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine) override { m_mainWindow->UpdateUndoRedo(); }
|
void OnAddCommandToHistory([[maybe_unused]] size_t historyIndex, [[maybe_unused]] MCore::CommandGroup* group, [[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine) override { m_mainWindow->UpdateUndoRedo(); }
|
||||||
|
|
||||||
void OnPreExecuteCommand([[maybe_unused]] MCore::CommandGroup* group, [[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine) override {}
|
void OnPreExecuteCommand([[maybe_unused]] MCore::CommandGroup* group, [[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine) override {}
|
||||||
void OnPostExecuteCommand([[maybe_unused]] MCore::CommandGroup* group, [[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine, [[maybe_unused]] bool wasSuccess, [[maybe_unused]] const AZStd::string& outResult) override {}
|
void OnPostExecuteCommand([[maybe_unused]] MCore::CommandGroup* group, [[maybe_unused]] MCore::Command* command, [[maybe_unused]] const MCore::CommandLine& commandLine, [[maybe_unused]] bool wasSuccess, [[maybe_unused]] const AZStd::string& outResult) override {}
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
// include the required headers
|
// include the required headers
|
||||||
#include "Command.h"
|
#include "Command.h"
|
||||||
|
#include <AzCore/std/numeric.h>
|
||||||
|
|
||||||
#include <AzCore/Serialization/SerializeContext.h>
|
#include <AzCore/Serialization/SerializeContext.h>
|
||||||
|
|
||||||
@@ -81,9 +82,9 @@ namespace MCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32 Command::GetNumCallbacks() const
|
size_t Command::GetNumCallbacks() const
|
||||||
{
|
{
|
||||||
return static_cast<uint32>(mCallbacks.size());
|
return mCallbacks.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -123,37 +124,18 @@ namespace MCore
|
|||||||
|
|
||||||
|
|
||||||
// calculate the number of registered pre-execute callbacks
|
// calculate the number of registered pre-execute callbacks
|
||||||
uint32 Command::CalcNumPreCommandCallbacks() const
|
size_t Command::CalcNumPreCommandCallbacks() const
|
||||||
{
|
{
|
||||||
uint32 result = 0;
|
return AZStd::accumulate(begin(mCallbacks), end(mCallbacks), size_t{0}, [](size_t total, const Callback* callback)
|
||||||
|
|
||||||
const size_t numCallbacks = mCallbacks.size();
|
|
||||||
for (size_t i = 0; i < numCallbacks; ++i)
|
|
||||||
{
|
{
|
||||||
if (mCallbacks[i]->GetExecutePreCommand())
|
return callback->GetExecutePreCommand() ? total + 1 : total;
|
||||||
{
|
});
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// calculate the number of registered post-execute callbacks
|
// calculate the number of registered post-execute callbacks
|
||||||
uint32 Command::CalcNumPostCommandCallbacks() const
|
size_t Command::CalcNumPostCommandCallbacks() const
|
||||||
{
|
{
|
||||||
uint32 result = 0;
|
return mCallbacks.size() - CalcNumPreCommandCallbacks();
|
||||||
|
|
||||||
const size_t numCallbacks = mCallbacks.size();
|
|
||||||
for (size_t i = 0; i < numCallbacks; ++i)
|
|
||||||
{
|
|
||||||
if (mCallbacks[i]->GetExecutePreCommand() == false)
|
|
||||||
{
|
|
||||||
result++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
} // namespace MCore
|
} // namespace MCore
|
||||||
|
|||||||
@@ -279,26 +279,26 @@ namespace MCore
|
|||||||
* Get the number of registered/added command callbacks.
|
* Get the number of registered/added command callbacks.
|
||||||
* @result The number of command callbacks that have been added.
|
* @result The number of command callbacks that have been added.
|
||||||
*/
|
*/
|
||||||
uint32 GetNumCallbacks() const;
|
size_t GetNumCallbacks() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the number of registered pre-execute callbacks.
|
* Calculate the number of registered pre-execute callbacks.
|
||||||
* @result The number of registered pre-execute callbacks.
|
* @result The number of registered pre-execute callbacks.
|
||||||
*/
|
*/
|
||||||
uint32 CalcNumPreCommandCallbacks() const;
|
size_t CalcNumPreCommandCallbacks() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Calculate the number of registered post-execute callbacks.
|
* Calculate the number of registered post-execute callbacks.
|
||||||
* @result The number of registered post-execute callbacks.
|
* @result The number of registered post-execute callbacks.
|
||||||
*/
|
*/
|
||||||
uint32 CalcNumPostCommandCallbacks() const;
|
size_t CalcNumPostCommandCallbacks() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a given command callback.
|
* Get a given command callback.
|
||||||
* @param index The callback number, which must be in range of [0..GetNumCallbacks()-1].
|
* @param index The callback number, which must be in range of [0..GetNumCallbacks()-1].
|
||||||
* @result A pointer to the command callback object.
|
* @result A pointer to the command callback object.
|
||||||
*/
|
*/
|
||||||
MCORE_INLINE Command::Callback* GetCallback(uint32 index) { return mCallbacks[index]; }
|
MCORE_INLINE Command::Callback* GetCallback(size_t index) { return mCallbacks[index]; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add (register) a command callback.
|
* Add (register) a command callback.
|
||||||
|
|||||||
Reference in New Issue
Block a user