コード例 #1
0
ファイル: serverRoot.cpp プロジェクト: shuimu98/domi_server
// 初始化
bool CServerRoot::initialize(uint16 uServerID)
{
	// 日志初始化
    char logprev[ 256 ] = { 0 };
    dSprintf( logprev, sizeof( logprev ), "%s_%u", "test_log_", uServerID );
    CLog::initialize( NULL, logprev );

    // 这里必须在CLog::initilize之后
    // 守护进程 TODO

	if(m_bInitFlag)
		return true;

	::srand((uint32)getTime());		// 设置随机种子
	m_uServerID = uServerID;		// 设置服务器id

	// load 服务器配置
	if(!loadConfig()){
		CLog::error("配置文件装载失败!...");
		return false;
	}

	if(!initEvent()){
		CLog::error("事件初始失败!...");
		return false;
	}

	installBreakHandlers();

	m_tmStartTime = getTime();
	m_bInitFlag = true;

	return true;
}
コード例 #2
0
/* virtual */ int
DOM_MutationEvent::initMutationEvent(DOM_Object* this_object, ES_Value* argv, int argc, ES_Value* return_value, DOM_Runtime* origining_runtime)
{
	DOM_THIS_OBJECT(event, DOM_TYPE_MUTATIONEVENT, DOM_MutationEvent);
	DOM_CHECK_ARGUMENTS("sbbOsssn");

	int result = initEvent(this_object, argv, argc, return_value, origining_runtime);
	if (result != ES_FAILED)
		return result;

	if (event->known_type < DOMSUBTREEMODIFIED || event->known_type > DOMCHARACTERDATAMODIFIED)
		return ES_FAILED;

	// If it's ok to set the related_node to NULL if the below isn't true, then
	// we can remove the check and leave it all to the macro.
	if (argv[3].type == VALUE_OBJECT)
		DOM_ARGUMENT_OBJECT_EXISTING(event->related_node, 3, DOM_TYPE_NODE, DOM_Node);

	int attrChange = TruncateDoubleToInt(argv[7].value.number);
	if (attrChange == ADDITION)
		event->attr_change = ADDITION;
	else if (attrChange == REMOVAL)
		event->attr_change = REMOVAL;
	else
		event->attr_change = MODIFICATION;

	if (!(event->prev_value = UniSetNewStr(argv[4].value.string)) ||
		!(event->new_value = UniSetNewStr(argv[5].value.string)) ||
		!(event->attr_name = UniSetNewStr(argv[6].value.string)))
	    return ES_NO_MEMORY;

	return ES_FAILED;
}
コード例 #3
0
ファイル: Event.cpp プロジェクト: adcox/Astrohelion
/**
 *	@brief Create an event
 *
 *	Note that creating a CRASH event using this constructor will default to a crash
 *	with Primary #0 and a minimum acceptable distance of zero; to specify a different 
 *	primary and miss distance, use the customizable constructor.
 *
 *	@param t the event type
 *	@param dir direction (+/-/both) the event will trigger on. +1 indicates (+)
 *	direction, -1 (-) direction, and 0 both directions.
 *	@param willStop whether or not this event should stop the integration
 *	@throws Exception if this constructor is called for an event type that requires data
 *	@throws Exception if the event type is not recognized
 */
void Event::createEvent(Event_tp t, int dir, bool willStop){
	switch(t){
		case Event_tp::SIM_TOF:
		case Event_tp::SIM_COMPTIME:
		case Event_tp::SIM_ERR:
		case Event_tp::YZ_PLANE:
		case Event_tp::XZ_PLANE:
		case Event_tp::XY_PLANE:
		case Event_tp::CRASH:
		case Event_tp::MASS:
		{
			std::vector<double> params {0};
			initEvent(t, dir, willStop, params);
			break;
		}
		case Event_tp::ANGLE_PLANE_P1:
		case Event_tp::STATE_PLANE:
		case Event_tp::JC:
		case Event_tp::APSE:
		case Event_tp::DIST:
			throw Exception("Event_tp::Event: Cannot create this type of event without parameter data...");
		default: 
			throw Exception("Event_tp::Event: Creating event with no type");
	}
}//===================================================
コード例 #4
0
ファイル: DeviceMotionEvent.cpp プロジェクト: RasterCode/wke
void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData* deviceMotionData)
{
    if (dispatched())
        return;

    initEvent(type, bubbles, cancelable);
    m_deviceMotionData = deviceMotionData;
}
コード例 #5
0
void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceOrientationData* orientation)
{
    if (dispatched())
        return;

    initEvent(type, bubbles, cancelable);
    m_orientation = orientation;
}
コード例 #6
0
ファイル: ConfigFileTest.cpp プロジェクト: jerbs/sinema
void ConfigFileTestApp::sendInitEvents()
{
    boost::shared_ptr<CommonInitEvent> initEvent(new CommonInitEvent());
    initEvent->mediaCommon = configFileTest.get();
    initEvent->configFile = configFile;
    configFileTest->queue_event(initEvent);
    configFile->queue_event(initEvent);
}
コード例 #7
0
ファイル: CustomEvent.cpp プロジェクト: Marforius/qt
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, ScriptValue detail)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_detail = detail;
}
コード例 #8
0
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> serializedDetail)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_serializedDetail = serializedDetail;
}
コード例 #9
0
void PopStateEvent::initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> stateObject)
{
    if (dispatched())
        return;
    
    initEvent(type, canBubble, cancelable);

    m_stateObject = stateObject;
}
コード例 #10
0
ファイル: PopStateEvent.cpp プロジェクト: sysrqb/chromium-src
void PopStateEvent::initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& state)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_state = state;
}
コード例 #11
0
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const ScriptValue& detail)
{
    ASSERT(!m_serializedScriptValue.get());
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_detail = detail;
}
コード例 #12
0
ファイル: MutationEvent.cpp プロジェクト: craigsapp/humextra
void MutationEvent::initMutationEvent(const XMLString& type, bool canBubble, bool cancelable, Node* relatedNode, 
	                                  const XMLString& prevValue, const XMLString& newValue, const XMLString& attrName, AttrChangeType change)
{
	initEvent(type, canBubble, cancelable);
	m_pRelatedNode = relatedNode;
	m_prevValue    = prevValue;
	m_newValue     = newValue;
	m_attrName     = attrName;
	m_change       = change;
}
コード例 #13
0
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> serializedScriptValue)
{
    ASSERT(m_detail.hasNoValue());
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_serializedScriptValue = serializedScriptValue;
}
コード例 #14
0
ファイル: UIEvent.cpp プロジェクト: edcwconan/webkit
void UIEvent::initUIEvent(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, AbstractView* viewArg, int detailArg)
{
    if (dispatched())
        return;

    initEvent(typeArg, canBubbleArg, cancelableArg);

    m_view = viewArg;
    m_detail = detailArg;
}
コード例 #15
0
void UIEvent::initUIEventInternal(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, PassRefPtrWillBeRawPtr<AbstractView> viewArg, int detailArg, InputDeviceCapabilities* sourceCapabilitiesArg)
{
    if (dispatched())
        return;

    initEvent(typeArg, canBubbleArg, cancelableArg);

    m_view = viewArg;
    m_detail = detailArg;
    m_sourceCapabilities = sourceCapabilitiesArg;
}
コード例 #16
0
void ErrorEvent::initErrorEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& message, const String& fileName, unsigned lineNumber)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_message = message;
    m_fileName = fileName;
    m_lineNumber = lineNumber;
}
コード例 #17
0
void UIEvent::initUIEventInternal(const AtomicString& typeArg, bool canBubbleArg, bool cancelableArg, EventTarget* relatedTarget, AbstractView* viewArg, int detailArg, InputDeviceCapabilities* sourceCapabilitiesArg)
{
    if (isBeingDispatched())
        return;

    initEvent(typeArg, canBubbleArg, cancelableArg, relatedTarget);

    m_view = viewArg;
    m_detail = detailArg;
    m_sourceCapabilities = sourceCapabilitiesArg;
}
コード例 #18
0
void UIEventImp::initUIEvent(
		DOMString typeArg,
		bool canBubbleArg,
		bool cancelableArg,
		AbstractView * viewArg,
		long detailArg)
{
	initEvent(typeArg, canBubbleArg, cancelableArg);
	view_ = viewArg;
	detail_ = detailArg;
}
コード例 #19
0
ファイル: CustomEvent.cpp プロジェクト: biddyweb/switch-oss
void CustomEvent::initCustomEvent(const AtomicString& type, bool canBubble, bool cancelable, const Deprecated::ScriptValue& detail)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_detail = detail;
    m_serializedDetail = nullptr;
    m_triedToSerialize = false;
}
コード例 #20
0
ファイル: OverflowEvent.cpp プロジェクト: eocanha/webkit
void OverflowEvent::initOverflowEvent(unsigned short orient, bool horizontalOverflow, bool verticalOverflow)
{
    if (dispatched())
        return;

    initEvent(eventNames().overflowchangedEvent, false, false);
    
    m_orient = orient;
    m_horizontalOverflow = horizontalOverflow;
    m_verticalOverflow = verticalOverflow;
}
コード例 #21
0
ファイル: CustomEvent.cpp プロジェクト: caiolima/webkit
void CustomEvent::initCustomEvent(JSC::ExecState& state, const AtomicString& type, bool canBubble, bool cancelable, JSC::JSValue detail)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_detail = { state.vm(), detail };
    m_serializedDetail = nullptr;
    m_triedToSerialize = false;
}
コード例 #22
0
void PageTransitionEvent::initPageTransitionEvent(const AtomicString& type, 
                                            bool canBubbleArg,
                                            bool cancelableArg,
                                            bool persisted)
{
    if (dispatched())
        return;
    
    initEvent(type, canBubbleArg, cancelableArg);
    
    m_persisted = persisted;
}
コード例 #23
0
void DeviceMotionEvent::initDeviceMotionEvent(const AtomicString& type, bool bubbles, bool cancelable, DeviceMotionData* deviceMotionData)
{
    if (dispatched())
        return;

    initEvent(type, bubbles, cancelable);
    m_deviceMotionData = deviceMotionData;

    m_acceleration.clear();
    m_accelerationIncludingGravity.clear();
    m_rotationRate.clear();
}
コード例 #24
0
ファイル: MessageEvent.cpp プロジェクト: venkatarajasekhar/Qt
void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& origin, const String& lastEventId, LocalDOMWindow* source, PassOwnPtr<MessagePortArray> ports)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_dataType = DataTypeScriptValue;
    m_origin = origin;
    m_lastEventId = lastEventId;
    m_source = source;
    m_ports = ports;
}
コード例 #25
0
void WebKitAnimationEvent::initWebKitAnimationEvent(const AtomicString& type, 
                                        bool /*canBubbleArg*/,
                                        bool /*cancelableArg*/,
                                        const String& animationName,
                                        double elapsedTime)
{
    if (dispatched())
        return;
    
    initEvent(type, false, true);
    
    m_animationName = animationName;
}
コード例 #26
0
void StorageEvent::initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& url, Storage* storageArea)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_key = key;
    m_oldValue = oldValue;
    m_newValue = newValue;
    m_url = url;
    m_storageArea = storageArea;
}
コード例 #27
0
void StorageEvent::initStorageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& key, const String& oldValue, const String& newValue, const String& uri, PassRefPtr<DOMWindow> source, Storage* storageArea)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_key = key;
    m_oldValue = oldValue;
    m_newValue = newValue;
    m_uri = uri;
    m_source = source;
    m_storageArea = storageArea;
}
コード例 #28
0
void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> data, const String& origin, const String& lastEventId, DOMWindow* source, std::unique_ptr<MessagePortArray> ports)
{
    if (dispatched())
        return;

    initEvent(type, canBubble, cancelable);

    m_dataType = DataTypeSerializedScriptValue;
    m_dataAsSerializedScriptValue = data;
    m_origin = origin;
    m_lastEventId = lastEventId;
    m_source = source;
    m_ports = WTFMove(ports);
}
コード例 #29
0
void DeviceOrientationEvent::initDeviceOrientationEvent(
    const AtomicString& type,
    bool bubbles,
    bool cancelable,
    const Nullable<double>& alpha,
    const Nullable<double>& beta,
    const Nullable<double>& gamma,
    bool absolute) {
  if (isBeingDispatched())
    return;

  initEvent(type, bubbles, cancelable);
  m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute);
}
コード例 #30
0
ファイル: P003Snowman.cpp プロジェクト: dalechngame/mygame
bool P003::init()
{
	if (!PBase::init())
	{
		return false;
	}

	initSceneJson("game/json/P003.json");

	initEvent();
	initScrollLayer();

	return true;
}