Skip to content

Commit

Permalink
utils/IXmlDeserializable: drop useless interface
Browse files Browse the repository at this point in the history
There is no IXmlDeserializable::Deserialize() call on a possibly
polymorphed object, and therefore the whole interface with virtual
methods is pointless.  This patch removes overhead for vtable
initialization and for indirect calls.
  • Loading branch information
MaxKellermann committed Jun 14, 2018
1 parent c183fd0 commit f821789
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 43 deletions.
2 changes: 1 addition & 1 deletion xbmc/settings/lib/SettingConditions.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class CSettingConditionItem : public CBooleanLogicValue, public ISettingConditio
{ }
~CSettingConditionItem() override = default;

bool Deserialize(const TiXmlNode *node) override;
bool Deserialize(const TiXmlNode *node);
const char* GetTag() const override { return SETTING_XML_ELM_CONDITION; }
bool Check() const override;

Expand Down
6 changes: 3 additions & 3 deletions xbmc/settings/lib/SettingDependency.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class CSettingDependencyCondition : public CSettingConditionItem
CSettingsManager *settingsManager = nullptr);
~CSettingDependencyCondition() override = default;

bool Deserialize(const TiXmlNode *node) override;
bool Deserialize(const TiXmlNode *node);
bool Check() const override;

const std::string& GetName() const { return m_name; }
Expand Down Expand Up @@ -94,7 +94,7 @@ class CSettingDependencyConditionCombination : public CSettingConditionCombinati
}
~CSettingDependencyConditionCombination() override = default;

bool Deserialize(const TiXmlNode *node) override;
bool Deserialize(const TiXmlNode *node);

const std::set<std::string>& GetSettings() const { return m_settings; }

Expand All @@ -115,7 +115,7 @@ class CSettingDependency : public CSettingCondition
CSettingDependency(SettingDependencyType type, CSettingsManager *settingsManager = nullptr);
~CSettingDependency() override = default;

bool Deserialize(const TiXmlNode *node) override;
bool Deserialize(const TiXmlNode *node);

SettingDependencyType GetType() const { return m_type; }
std::set<std::string> GetSettings() const;
Expand Down
14 changes: 7 additions & 7 deletions xbmc/utils/BooleanLogic.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,22 @@

#include <memory>

#include "utils/IXmlDeserializable.h"
class TiXmlNode;

typedef enum {
BooleanLogicOperationOr = 0,
BooleanLogicOperationAnd
} BooleanLogicOperation;

class CBooleanLogicValue : public IXmlDeserializable
class CBooleanLogicValue
{
public:
CBooleanLogicValue(const std::string &value = "", bool negated = false)
: m_value(value), m_negated(negated)
{ }
virtual ~CBooleanLogicValue() = default;

bool Deserialize(const TiXmlNode *node) override;
bool Deserialize(const TiXmlNode *node);

virtual const std::string& GetValue() const { return m_value; }
virtual bool IsNegated() const { return m_negated; }
Expand All @@ -61,15 +61,15 @@ class CBooleanLogicOperation;
typedef std::shared_ptr<CBooleanLogicOperation> CBooleanLogicOperationPtr;
typedef std::vector<CBooleanLogicOperationPtr> CBooleanLogicOperations;

class CBooleanLogicOperation : public IXmlDeserializable
class CBooleanLogicOperation
{
public:
explicit CBooleanLogicOperation(BooleanLogicOperation op = BooleanLogicOperationAnd)
: m_operation(op)
{ }
virtual ~CBooleanLogicOperation() = default;

bool Deserialize(const TiXmlNode *node) override;
bool Deserialize(const TiXmlNode *node);

virtual BooleanLogicOperation GetOperation() const { return m_operation; }
virtual const CBooleanLogicOperations& GetOperations() const { return m_operations; }
Expand All @@ -86,14 +86,14 @@ class CBooleanLogicOperation : public IXmlDeserializable
CBooleanLogicValues m_values;
};

class CBooleanLogic : public IXmlDeserializable
class CBooleanLogic
{
protected:
/* make sure nobody deletes a pointer to this class */
~CBooleanLogic() = default;

public:
bool Deserialize(const TiXmlNode *node) override;
bool Deserialize(const TiXmlNode *node);

const CBooleanLogicOperationPtr& Get() const { return m_operation; }
CBooleanLogicOperationPtr Get() { return m_operation; }
Expand Down
1 change: 0 additions & 1 deletion xbmc/utils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ set(HEADERS ActorProtocol.h
IRssObserver.h
ISerializable.h
ISortable.h
IXmlDeserializable.h
Job.h
JobManager.h
JSONVariantParser.h
Expand Down
31 changes: 0 additions & 31 deletions xbmc/utils/IXmlDeserializable.h

This file was deleted.

0 comments on commit f821789

Please sign in to comment.