📄 object.h
字号:
#ifndef __object_h
#define __object_h
///////////////////////////////////////////////////////////////////////////////
// $Header: /shorthand/src/object.h 4 1/09/03 7:14p Arm $
//-----------------------------------------------------------------------------
// Project: ShortHand interpreter
// Author: Andrei Remenchuk <andrei@remenchuk.com>
//-----------------------------------------------------------------------------
// object.h: ShortHand object interface
///////////////////////////////////////////////////////////////////////////////
#include "value.h"
#include "map.h"
#include "yydef.h"
class ShhModule;
/**
* ShortHand object.
*/
class ShhObject
{
protected:
string m_type;
ShhModule& m_module;
// location where the object was constructed
YYLTYPE m_ctor_location;
map<ShhValue> m_properties;
public:
ShhObject(ShhModule& module, const char* type, const YYLTYPE& location);
const char* getTypeName() const { return m_type; }
virtual void setProperty(const char* name, ShhValue value);
virtual ShhValue& getProperty(const char* name);
virtual void constructor(ShhValueList* args) = 0;
virtual ShhValue executeMethod(const char* name, ShhValueList* args) = 0;
virtual bool hasMethod(const char* name) = 0;
virtual ~ShhObject();
};
#endif // __object_h
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -