⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.h

📁 a basic interpreter free basic
💻 H
字号:
#pragma once
#include "Common.h"
/*
 * Class CFunction - Type for a single function (builtin or defined)
 */
class CFunction
{
private:
	// Name of a function
	string m_Name;

	// Is this a builtin function?
	bool m_Builtin;

	// For defined functions, store the expression to be
	// evaluated at runtime
	string m_Expression;

	// For builtins, provide a coderef
	float (*m_Coderef)(float Value);

	// Symbol used for parameter
	CSymbol *m_Symbol;

public:
	CFunction(void);
	CFunction(string Name, float (*coderef)(float));
	CFunction(string Name, string Expression);
	~CFunction(void);
	// Set the name of a function
	void SetName(string Name);
	// Get the name of the current function
	string GetName(void);
	// Set the builtin flag to either true or false
	void SetBuiltin(bool Value);
	// Returns true if the function is a builtin
	bool GetBuiltin(void);
	// Set the expression to run when the function is called
	void SetExpression(string Expression);
	// Get the runtime expression of the function
	string GetExpression(void);
	// Set the coderef for a builtin function
	void SetCoderef(float (*coderef)(float));

	// Execute the builtin function by coderef
	float ExecuteBuiltin(float Value);
	// Set the symbol used as a parameter
	void SetSymbol(CSymbol * Symbol);
	// Get the symbol used for the function parameter
	CSymbol * GetSymbol(void);
};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -