📄 js_context.h
字号:
/* $Id: js_context.h,v 1.6 2004/01/02 15:42:44 mbn Exp $
**
** ClanLib Game SDK
** Copyright (C) 2003 The ClanLib Team
** For a total list of contributers see the file CREDITS.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License as published by the Free Software Foundation; either
** version 2.1 of the License, or (at your option) any later version.
**
** This library is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
** Lesser General Public License for more details.
**
** You should have received a copy of the GNU Lesser General Public
** License along with this library; if not, write to the Free Software
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
//! clanJavaScript="Framework"
//! header=javascript.h
#ifndef header_js_context
#define header_js_context
#if _MSC_VER > 1000
#pragma once
#endif
#include "js_config.h"
#include "js_value.h"
#include <map>
#include <string>
class CL_JSRuntime;
class CL_JSObject;
//: Javascript context.
//- !group=JavaScript/Framework!
//- !header=javascript.h!
class CL_JSContext
{
//! Construction:
public:
CL_JSContext(CL_JSRuntime &runtime, int stackSize);
~CL_JSContext();
//! Attributes:
public:
JSContext *getContext();
operator JSContext *();
//! Operations:
public:
CL_JSValue evaluateScript(
CL_JSObject &globalObject,
const std::string &code,
const std::string &filename = "",
int lineNumber = 1);
static CL_JSContext *tempFromHandle(JSContext *cx);
static CL_JSContext *permanentFromHandle(JSContext *cx);
//! Implementation:
private:
CL_JSContext(JSContext *context, bool tempObject);
JSContext *context;
bool tempObject;
static std::map<JSContext*, CL_JSContext *> tempMap;
static std::map<JSContext*, CL_JSContext *> permanentMap;
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -