Pol  Revision:cb584c9
lockable.h
Go to the documentation of this file.
1 
7 #ifndef LOCKABLE_H
8 #define LOCKABLE_H
9 
10 #include "../clib/compilerspecifics.h"
11 #include "baseobject.h"
12 
13 namespace Pol
14 {
15 namespace Bscript
16 {
17 class BObjectImp;
18 } // namespace Bscript
19 namespace Clib
20 {
21 class ConfigElem;
22 class StreamWriter;
23 } // namespace Clib
24 namespace Items
25 {
26 class ItemDesc;
27 } // namespace Items
28 } // namespace Pol
29 #ifndef ITEM_H
30 #include "item/item.h"
31 #endif
32 
33 namespace Pol
34 {
35 namespace Core
36 {
37 class ULockable : public Items::Item
38 {
39  typedef Item base;
40 
41 public:
42  bool locked() const;
43 
44 protected:
45  void locked( bool newvalue );
46 
47  virtual void printProperties( Clib::StreamWriter& sw ) const POL_OVERRIDE;
48  virtual void readProperties( Clib::ConfigElem& elem ) POL_OVERRIDE;
49  virtual Bscript::BObjectImp* get_script_member( const char* membername ) const POL_OVERRIDE;
50  virtual Bscript::BObjectImp* get_script_member_id( const int id ) const POL_OVERRIDE;
51  virtual Bscript::BObjectImp* set_script_member( const char* membername, int value ) POL_OVERRIDE;
52  virtual Bscript::BObjectImp* set_script_member_id( const int id,
53  int value ) POL_OVERRIDE; // id test
54  virtual bool script_isa( unsigned isatype ) const POL_OVERRIDE;
55 
56  virtual Items::Item* clone() const POL_OVERRIDE; // dave 12-20
57  virtual ~ULockable(){};
58  virtual size_t estimatedSize() const POL_OVERRIDE;
59 
60 protected:
61  explicit ULockable( const Items::ItemDesc& itemdesc, UOBJ_CLASS uobj_class );
62  friend class Items::Item;
63 };
64 
65 inline bool ULockable::locked() const
66 {
67  return flags_.get( OBJ_FLAGS::LOCKED );
68 }
69 inline void ULockable::locked( bool newvalue )
70 {
71  flags_.change( OBJ_FLAGS::LOCKED, newvalue );
72 }
73 }
74 }
75 #endif
#define POL_OVERRIDE
bool locked() const
Definition: lockable.h:65
Definition: berror.cpp:12