📄 contextfactory.cpp
字号:
/*
Copyright (c) 2008, Intel Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or
other materials provided with the distribution.
* Neither the name of Intel Corporation nor the names of its contributors
may be used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGE.
*///==============================================================================// ContextFactory.cpp : // Implementation of class ContextFactory//==============================================================================#define DllExport //__declspec( dllexport )//#include "../stdafx.h"#include "./ContextFactory.h"#include "./ContextClassObject.h"#include "./PowerInstanceObject.h"#include "./StorageInstanceObject.h"#include "./ConnectivityInstanceObject.h"#include "./ContextInstanceObject.h"#include "./BandwidthInstanceObject.h"#include "./DisplayInstanceObject.h"using namespace Intel::Mobile::Context;static ContextFactory cf;//==============================================================================// C-Tor()//==============================================================================ContextFactory::ContextFactory(): ObjectFactory (){ Initial();} // C-Tor()//==============================================================================// D-Tor()//==============================================================================ContextFactory::~ContextFactory(){ RemoveType("Context_Class" );
RemoveType("Power_Instance" );
RemoveType("Storage_Instance" );
RemoveType("Bandwidth_Instance" );
RemoveType("Connectivity_Instance" );
RemoveType("Context_Instance" );
RemoveType("Display_Instance" );}//==============================================================================// Initial()//==============================================================================void ContextFactory::Initial(){ AddType(IntelMobileText("Context_Class") ); AddType(IntelMobileText("Power_Instance") ); AddType(IntelMobileText("Storage_Instance") ); AddType(IntelMobileText("Bandwidth_Instance") ); AddType(IntelMobileText("Connectivity_Instance") ); AddType(IntelMobileText("Context_Instance") ); AddType(IntelMobileText("Display_Instance") );} // Initial//==============================================================================// CreateObject() : //==============================================================================Intel::Mobile::Base::Object* ContextFactory::CreateObject( IntelMobileString objType, IntelMobileString type, void* pImpl ){ if ( objType.compare(IntelMobileText("InstanceObject")) == 0 ) { if ( type.compare(IntelMobileText("Power")) == 0 ) return new PowerInstance(pImpl ); else if ( type.compare(IntelMobileText("Storage")) == 0 ) return new StorageInstance(pImpl ); else if ( type.compare(IntelMobileText("Bandwidth")) == 0 ) return new BandwidthInstance(pImpl ); else if ( type.compare(IntelMobileText("Connectivity")) == 0 ) return new ConnectivityInstance(pImpl ); else if ( type.compare(IntelMobileText("Display")) == 0 ) return new DisplayInstance(pImpl ); else if ( type.compare(IntelMobileText("Context")) == 0 ) return new ContextInstance(pImpl ); } else if ( objType.compare(IntelMobileText("ClassObject")) == 0 ) { if ( type.compare(IntelMobileText("Context")) == 0 ) return new ContextClass( pImpl ); } else if ( objType.compare( "Property" ) == 0 )
{
if( type.compare( "SourceEnumProperty" ) == 0 )
return new Intel::Mobile::Context::SourceEnumProperty(*((Intel::Mobile::Base::InstanceObject *)pImpl));
else if( type.compare( "StateEnumProperty" ) == 0 )
return new Intel::Mobile::Context::StateEnumProperty(*((Intel::Mobile::Base::InstanceObject *)pImpl));
else if( type.compare( "OrientationEnumProperty" ) == 0 )
return new Intel::Mobile::Display::OrientationEnumProperty(*((Intel::Mobile::Base::InstanceObject *)pImpl));
} return NULL;}//==============================================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -