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

📄 base_enum.cpp

📁 270的linux说明
💻 CPP
📖 第 1 页 / 共 3 页
字号:
/*

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.

*///#include "..\stdafx.h"                     #include "base_Enum.h"//#include <hash_map>//#include <hash>#include <map>#define IMPLEMENT_ENUM( name )													\			void * name::m_pHash = new Intel::Mobile::Base::BaseEnumHash();		\			name::name() : BaseEnum() {}										\			name::name( int value ) : BaseEnum( m_pHash, value ) {}				\			name::name( IntelMobileChar *desc, int value ) : BaseEnum( m_pHash, desc, value ) {}namespace Intel {	namespace Mobile {		namespace Base {			//typedef stdext::hash_map<int, BaseEnum*> BaseEnumHash;			typedef map<int, BaseEnum*> BaseEnumHash;			BaseEnum::BaseEnum()			{			}			BaseEnum::BaseEnum( void* hash, int value )			{				m_pHash = hash;				m_nValue = value;				BaseEnumHash::iterator it = ((BaseEnumHash*)m_pHash)->find( this->m_nValue );				if ( it != ((BaseEnumHash*)m_pHash)->end() )				{					m_strDesc = it->second->m_strDesc;				}				else				{					m_strDesc = IntelMobileText("");				}			}			BaseEnum::BaseEnum( void* hash, IntelMobileChar *desc, int value )			{				m_pHash = hash;				m_nValue = value;				m_strDesc = desc;				((BaseEnumHash*)m_pHash)->insert( pair<int, BaseEnum*>( value, this ) );			}			bool BaseEnum::operator == ( const BaseEnum& e )			{				return ( ( e.m_pHash == this->m_pHash ) && ( e.m_nValue == this->m_nValue ) );			}			const StringObject BaseEnum::ToString()			{				return StringObject( m_strDesc.c_str() );			}			int BaseEnum::GetIntValue()			{				return m_nValue;			}			// ProviderTypeEnum			IMPLEMENT_ENUM( ProviderTypeEnum );			const ProviderTypeEnum	ProviderTypeEnum::Battery( IntelMobileText("Battery"), 1);			const ProviderTypeEnum	ProviderTypeEnum::Processor( IntelMobileText("Processor"), 2);			const ProviderTypeEnum	ProviderTypeEnum::LinkProtocol( IntelMobileText("LinkProtocol"), 3);			const ProviderTypeEnum	ProviderTypeEnum::Protocol802_11( IntelMobileText("Protocol802_11"), 4);			const ProviderTypeEnum	ProviderTypeEnum::Protocol802_3( IntelMobileText("Protocol802_3"), 5);			const ProviderTypeEnum	ProviderTypeEnum::ProtocolCdma( IntelMobileText("ProtocolCdma"), 6);			const ProviderTypeEnum	ProviderTypeEnum::ProtocolGprs( IntelMobileText("ProtocolGprs"), 7);			const ProviderTypeEnum	ProviderTypeEnum::ProtocolWwan( IntelMobileText("ProtocolWwan"), 8);			const ProviderTypeEnum	ProviderTypeEnum::NetworkAdapter( IntelMobileText("NetworkAdapter"), 9);			const ProviderTypeEnum	ProviderTypeEnum::RadioAdapter( IntelMobileText("RadioAdapter"), 10);			const ProviderTypeEnum	ProviderTypeEnum::WiredAdapter( IntelMobileText("WiredAdapter"), 11);			const ProviderTypeEnum	ProviderTypeEnum::Context( IntelMobileText("Context"), 12);			const ProviderTypeEnum	ProviderTypeEnum::Platform( IntelMobileText("Platform"), 13);			const ProviderTypeEnum	ProviderTypeEnum::PhysicalDisk( IntelMobileText("PhysicalDisk"), 14);			const ProviderTypeEnum	ProviderTypeEnum::LogicalDisk( IntelMobileText("LogicalDisk"), 15);			const ProviderTypeEnum	ProviderTypeEnum::Memory( IntelMobileText("Memory"), 16);			const ProviderTypeEnum	ProviderTypeEnum::ProtocolBluetoothPan( IntelMobileText("ProtocolBluetoothPan"), 17);			const ProviderTypeEnum	ProviderTypeEnum::DisplayAdapter( IntelMobileText("DisplayAdapter"), 18);		}		namespace Context {			IMPLEMENT_ENUM( SourceEnum );			const SourceEnum	SourceEnum::External( IntelMobileText("External"), 1);			const SourceEnum	SourceEnum::Internal( IntelMobileText("Internal"), 2);			IMPLEMENT_ENUM( StateEnum );			const StateEnum	StateEnum::Unknown( IntelMobileText("Unknown"), 0);			const StateEnum	StateEnum::Charged( IntelMobileText("Charged"), 1);			const StateEnum	StateEnum::Charging( IntelMobileText("Charging"),2);			const StateEnum	StateEnum::Discharged( IntelMobileText("Discharged"), 3);			const StateEnum	StateEnum::Discharging( IntelMobileText("Discharging"), 4);		}		namespace Battery {			IMPLEMENT_ENUM( ConditionEnum );			const ConditionEnum	ConditionEnum::Unknown( IntelMobileText("Unknown"), 0);			const ConditionEnum	ConditionEnum::Charged( IntelMobileText("Charged"), 1);			const ConditionEnum	ConditionEnum::Charging( IntelMobileText("Charging"), 2);			const ConditionEnum	ConditionEnum::Discharged( IntelMobileText("Discharged"), 3);			const ConditionEnum	ConditionEnum::Discharging( IntelMobileText("Discharging"), 4);		}		namespace Display {			IMPLEMENT_ENUM( OrientationEnum );			const OrientationEnum	OrientationEnum::Landscape( IntelMobileText("Landscape"), 1);			const OrientationEnum	OrientationEnum::Portrait( IntelMobileText("Portrait"), 2);			const OrientationEnum	OrientationEnum::InvertedLandscape( IntelMobileText("InvertedLandscape"), 3);			const OrientationEnum	OrientationEnum::InvertedPortrait( IntelMobileText("InvertedPortrait"), 4);			IMPLEMENT_ENUM( ScreenStateEnum );			const ScreenStateEnum	ScreenStateEnum::Blanked( IntelMobileText("Blanked"), 1);			const ScreenStateEnum	ScreenStateEnum::Unblanked( IntelMobileText("Unblanked"), 2);		}		namespace Storage 		{			IMPLEMENT_ENUM( InterfaceEnum );			const InterfaceEnum	InterfaceEnum::Other( IntelMobileText("Other"), 0);			const InterfaceEnum	InterfaceEnum::Ide( IntelMobileText("Ide"), 1);			const InterfaceEnum	InterfaceEnum::Scsi( IntelMobileText("Scsi"), 2);			const InterfaceEnum	InterfaceEnum::Sata( IntelMobileText("Sata"), 3);			const InterfaceEnum	InterfaceEnum::Usb( IntelMobileText("Usb"), 4);			const InterfaceEnum	InterfaceEnum::Ieee1394( IntelMobileText("Ieee1394"), 5);			const InterfaceEnum	InterfaceEnum::UltraDma( IntelMobileText("UltraDma"), 6);			IMPLEMENT_ENUM( MediaEnum );

⌨️ 快捷键说明

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