Skip to content

Commit

Permalink
Removed redundant 'inline' keyword usage. (TheCherno#159)
Browse files Browse the repository at this point in the history
A function defined entirely inside a class/struct/union definition, whether it's a member function or a non-member friend function, is implicitly an inline function.
  • Loading branch information
d-tatianin authored Apr 8, 2020
1 parent 5e94d7d commit 76dcfca
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 34 deletions.
4 changes: 2 additions & 2 deletions Hazel/src/Hazel/Core/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ namespace Hazel {
void PushLayer(Layer* layer);
void PushOverlay(Layer* layer);

inline Window& GetWindow() { return *m_Window; }
Window& GetWindow() { return *m_Window; }

inline static Application& Get() { return *s_Instance; }
static Application& Get() { return *s_Instance; }
private:
void Run();
bool OnWindowClose(WindowCloseEvent& e);
Expand Down
12 changes: 6 additions & 6 deletions Hazel/src/Hazel/Core/Input.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ namespace Hazel {
Input(const Input&) = delete;
Input& operator=(const Input&) = delete;

inline static bool IsKeyPressed(KeyCode key) { return s_Instance->IsKeyPressedImpl(key); }
static bool IsKeyPressed(KeyCode key) { return s_Instance->IsKeyPressedImpl(key); }

inline static bool IsMouseButtonPressed(MouseCode button) { return s_Instance->IsMouseButtonPressedImpl(button); }
inline static std::pair<float, float> GetMousePosition() { return s_Instance->GetMousePositionImpl(); }
inline static float GetMouseX() { return s_Instance->GetMouseXImpl(); }
inline static float GetMouseY() { return s_Instance->GetMouseYImpl(); }
static bool IsMouseButtonPressed(MouseCode button) { return s_Instance->IsMouseButtonPressedImpl(button); }
static std::pair<float, float> GetMousePosition() { return s_Instance->GetMousePositionImpl(); }
static float GetMouseX() { return s_Instance->GetMouseXImpl(); }
static float GetMouseY() { return s_Instance->GetMouseYImpl(); }

static Scope<Input> Create();
protected:
Expand All @@ -32,4 +32,4 @@ namespace Hazel {
private:
static Scope<Input> s_Instance;
};
}
}
2 changes: 1 addition & 1 deletion Hazel/src/Hazel/Core/Layer.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace Hazel {
virtual void OnImGuiRender() {}
virtual void OnEvent(Event& event) {}

inline const std::string& GetName() const { return m_DebugName; }
const std::string& GetName() const { return m_DebugName; }
protected:
std::string m_DebugName;
};
Expand Down
4 changes: 2 additions & 2 deletions Hazel/src/Hazel/Core/Log.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ namespace Hazel {
public:
static void Init();

inline static Ref<spdlog::logger>& GetCoreLogger() { return s_CoreLogger; }
inline static Ref<spdlog::logger>& GetClientLogger() { return s_ClientLogger; }
static Ref<spdlog::logger>& GetCoreLogger() { return s_CoreLogger; }
static Ref<spdlog::logger>& GetClientLogger() { return s_ClientLogger; }
private:
static Ref<spdlog::logger> s_CoreLogger;
static Ref<spdlog::logger> s_ClientLogger;
Expand Down
4 changes: 2 additions & 2 deletions Hazel/src/Hazel/Events/ApplicationEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ namespace Hazel {
WindowResizeEvent(unsigned int width, unsigned int height)
: m_Width(width), m_Height(height) {}

inline unsigned int GetWidth() const { return m_Width; }
inline unsigned int GetHeight() const { return m_Height; }
unsigned int GetWidth() const { return m_Width; }
unsigned int GetHeight() const { return m_Height; }

std::string ToString() const override
{
Expand Down
2 changes: 1 addition & 1 deletion Hazel/src/Hazel/Events/Event.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace Hazel {
virtual int GetCategoryFlags() const = 0;
virtual std::string ToString() const { return GetName(); }

inline bool IsInCategory(EventCategory category)
bool IsInCategory(EventCategory category)
{
return GetCategoryFlags() & category;
}
Expand Down
4 changes: 2 additions & 2 deletions Hazel/src/Hazel/Events/KeyEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Hazel {
class KeyEvent : public Event
{
public:
inline KeyCode GetKeyCode() const { return m_KeyCode; }
KeyCode GetKeyCode() const { return m_KeyCode; }

EVENT_CLASS_CATEGORY(EventCategoryKeyboard | EventCategoryInput)
protected:
Expand All @@ -24,7 +24,7 @@ namespace Hazel {
KeyPressedEvent(KeyCode keycode, int repeatCount)
: KeyEvent(keycode), m_RepeatCount(repeatCount) {}

inline int GetRepeatCount() const { return m_RepeatCount; }
int GetRepeatCount() const { return m_RepeatCount; }

std::string ToString() const override
{
Expand Down
8 changes: 4 additions & 4 deletions Hazel/src/Hazel/Events/MouseEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Hazel {
MouseMovedEvent(float x, float y)
: m_MouseX(x), m_MouseY(y) {}

inline float GetX() const { return m_MouseX; }
inline float GetY() const { return m_MouseY; }
float GetX() const { return m_MouseX; }
float GetY() const { return m_MouseY; }

std::string ToString() const override
{
Expand All @@ -33,8 +33,8 @@ namespace Hazel {
MouseScrolledEvent(float xOffset, float yOffset)
: m_XOffset(xOffset), m_YOffset(yOffset) {}

inline float GetXOffset() const { return m_XOffset; }
inline float GetYOffset() const { return m_YOffset; }
float GetXOffset() const { return m_XOffset; }
float GetYOffset() const { return m_YOffset; }

std::string ToString() const override
{
Expand Down
4 changes: 2 additions & 2 deletions Hazel/src/Hazel/Renderer/Buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ namespace Hazel {
CalculateOffsetsAndStride();
}

inline uint32_t GetStride() const { return m_Stride; }
inline const std::vector<BufferElement>& GetElements() const { return m_Elements; }
uint32_t GetStride() const { return m_Stride; }
const std::vector<BufferElement>& GetElements() const { return m_Elements; }

std::vector<BufferElement>::iterator begin() { return m_Elements.begin(); }
std::vector<BufferElement>::iterator end() { return m_Elements.end(); }
Expand Down
10 changes: 5 additions & 5 deletions Hazel/src/Hazel/Renderer/RenderCommand.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,27 @@ namespace Hazel {
class RenderCommand
{
public:
inline static void Init()
static void Init()
{
s_RendererAPI->Init();
}

inline static void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
static void SetViewport(uint32_t x, uint32_t y, uint32_t width, uint32_t height)
{
s_RendererAPI->SetViewport(x, y, width, height);
}

inline static void SetClearColor(const glm::vec4& color)
static void SetClearColor(const glm::vec4& color)
{
s_RendererAPI->SetClearColor(color);
}

inline static void Clear()
static void Clear()
{
s_RendererAPI->Clear();
}

inline static void DrawIndexed(const Ref<VertexArray>& vertexArray, uint32_t count = 0)
static void DrawIndexed(const Ref<VertexArray>& vertexArray, uint32_t count = 0)
{
s_RendererAPI->DrawIndexed(vertexArray, count);
}
Expand Down
2 changes: 1 addition & 1 deletion Hazel/src/Hazel/Renderer/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Hazel {

static void Submit(const Ref<Shader>& shader, const Ref<VertexArray>& vertexArray, const glm::mat4& transform = glm::mat4(1.0f));

inline static RendererAPI::API GetAPI() { return RendererAPI::GetAPI(); }
static RendererAPI::API GetAPI() { return RendererAPI::GetAPI(); }
private:
struct SceneData
{
Expand Down
3 changes: 1 addition & 2 deletions Hazel/src/Hazel/Renderer/RendererAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,8 @@ namespace Hazel {

virtual void DrawIndexed(const Ref<VertexArray>& vertexArray, uint32_t indexCount = 0) = 0;

inline static API GetAPI() { return s_API; }
static API GetAPI() { return s_API; }
static Scope<RendererAPI> Create();

private:
static API s_API;
};
Expand Down
8 changes: 4 additions & 4 deletions Hazel/src/Platform/Windows/WindowsWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ namespace Hazel {

void OnUpdate() override;

inline unsigned int GetWidth() const override { return m_Data.Width; }
inline unsigned int GetHeight() const override { return m_Data.Height; }
unsigned int GetWidth() const override { return m_Data.Width; }
unsigned int GetHeight() const override { return m_Data.Height; }

// Window attributes
inline void SetEventCallback(const EventCallbackFn& callback) override { m_Data.EventCallback = callback; }
void SetEventCallback(const EventCallbackFn& callback) override { m_Data.EventCallback = callback; }
void SetVSync(bool enabled) override;
bool IsVSync() const override;

inline virtual void* GetNativeWindow() const { return m_Window; }
virtual void* GetNativeWindow() const { return m_Window; }
private:
virtual void Init(const WindowProps& props);
virtual void Shutdown();
Expand Down

0 comments on commit 76dcfca

Please sign in to comment.