Skip to content

Commit

Permalink
Add xray::noncopyable interface
Browse files Browse the repository at this point in the history
  • Loading branch information
ForserX committed Dec 11, 2024
1 parent 588b484 commit 0857ed2
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 35 deletions.
15 changes: 15 additions & 0 deletions src/xrCore/_noncopyable.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#pragma once

namespace xray
{
class noncopyable
{
public:
noncopyable() = default;
virtual ~noncopyable() = default;

private:
noncopyable(const noncopyable&) = delete;
noncopyable& operator=(const noncopyable&) = delete;
};
}
1 change: 1 addition & 0 deletions src/xrCore/xrCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@
// Engine
#include "Platform/PlatformAPI.h"
#include "xr_delegate.h"
#include "_noncopyable.h"

#include "xrDebug.h"
#include "vector.h"
Expand Down
7 changes: 3 additions & 4 deletions src/xrGame/smart_cover.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ struct loophole_data {
u32 m_level_vertex_id;
};

class cover final : public CCoverPoint
class cover final :
public CCoverPoint,
private xray::noncopyable
{
public:
cover(const cover& other) = delete;
cover& operator=(const cover& other) = delete;

typedef intrusive_ptr<
smart_cover::description,
detail::intrusive_base_time
Expand Down
8 changes: 4 additions & 4 deletions src/xrGame/smart_cover_animation_planner.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ namespace smart_cover {
class cover;
class target_selector;

class animation_planner final : public CActionPlannerScript<CAI_Stalker>
class animation_planner final :
public CActionPlannerScript<CAI_Stalker>,
private xray::noncopyable
{
private:
typedef CActionPlannerScript<CAI_Stalker> inherited;
Expand All @@ -46,11 +48,9 @@ class animation_planner final : public CActionPlannerScript<CAI_Stalker>
private:
void add_evaluators ();
void add_actions ();
bool hit_callback (SHit const *hit);
bool hit_callback (SHit const *hit);

public:
animation_planner(const animation_planner& other) = delete;
animation_planner& operator=(const animation_planner& other) = delete;
animation_planner (CAI_Stalker *object, LPCSTR action_name);
virtual ~animation_planner ();
virtual void setup (CAI_Stalker *object, CPropertyStorage *storage);
Expand Down
16 changes: 6 additions & 10 deletions src/xrGame/smart_cover_description.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
// Author : Alexander Dudin
// Description : Smart cover description class
////////////////////////////////////////////////////////////////////////////

#ifndef SMART_COVER_DESCRIPTION_H_INCLUDED
#define SMART_COVER_DESCRIPTION_H_INCLUDED
#pragma once

#include "smart_cover_detail.h"
#include "graph_abstract.h"
Expand All @@ -20,7 +18,9 @@ namespace transitions {
class action;
}

class description final : public detail::intrusive_base_time
class description final :
public detail::intrusive_base_time,
private xray::noncopyable
{
public:
typedef xr_vector<loophole*> Loopholes;
Expand All @@ -39,8 +39,6 @@ class description final : public detail::intrusive_base_time
shared_str m_table_id;

public:
description(const description& other) = delete;
description& operator=(const description& other) = delete;
description (shared_str const &table_id);
~description ();
IC shared_str const &table_id () const;
Expand All @@ -55,8 +53,6 @@ class description final : public detail::intrusive_base_time
void load_actions (luabind::object const &table, ActionsList& result);
};

} // namespace smart_cover

#include "smart_cover_description_inline.h"
}

#endif // SMART_COVER_DESCRIPTION_H_INCLUDED
#include "smart_cover_description_inline.h"
5 changes: 2 additions & 3 deletions src/xrPhysics/PHWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class CObjectList;

class CPHWorld : public pureFrame,
public IPHWorld,
public cphysics_scripted
public cphysics_scripted,
private xray::noncopyable
#ifdef DEBUG_DRAW
, public pureRender
#endif
Expand Down Expand Up @@ -74,8 +75,6 @@ class CPHWorld : public pureFrame,
PhysicsStepTimeCallback* physics_step_time_callback;

public:
CPHWorld(const CPHWorld& other) = delete;
CPHWorld& operator =(const CPHWorld& other) = delete;
CPHWorld ( ) ;
virtual ~CPHWorld (){} ;

Expand Down
15 changes: 1 addition & 14 deletions src/xrPhysics/iphysics_scripted.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,23 +25,10 @@ class XRPHYSICS_API iphysics_scripted_class
virtual ~iphysics_scripted_class() {};
};

namespace non_copy
{
class noncopyable
{
protected:
noncopyable() {}
~noncopyable() {}
private: // emphasize the following members are private
noncopyable( const noncopyable& );
const noncopyable& operator=( const noncopyable& );
};
};

template<class T>
class cphysics_game_scripted :
public iphysics_game_scripted,
private non_copy::noncopyable
private xray::noncopyable
{
T& impl;
public:
Expand Down

0 comments on commit 0857ed2

Please sign in to comment.