当前位置: 首页>>代码示例>>C++>>正文


C++ rho::Hashtable类代码示例

本文整理汇总了C++中rho::Hashtable的典型用法代码示例。如果您正苦于以下问题:C++ Hashtable类的具体用法?C++ Hashtable怎么用?C++ Hashtable使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Hashtable类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: replaceCurrentBundle

void CSystemImplBase::replaceCurrentBundle( const rho::String& pathToBundle,  const rho::Hashtable<rho::String, rho::String>& params, rho::apiGenerator::CMethodResult& oResult)
{
    bool do_not_restart_app = false, not_thread_mode = false;
    if( params.containsKey("do_not_restart_app") )
        convertFromStringA( params.get("do_not_restart_app").c_str(), do_not_restart_app );
    if( params.containsKey("not_thread_mode") )
        convertFromStringA( params.get("not_thread_mode").c_str(), not_thread_mode );

    rho_sys_replace_current_bundleEx( pathToBundle.c_str(), params.containsKey("callback") ? params.get("callback").c_str():0, do_not_restart_app, not_thread_mode );
}
开发者ID:ihorsavka,项目名称:rhodes,代码行数:10,代码来源:SystemImplBase.cpp

示例2: getArgValue

		static bool getArgValue( const rho::Hashtable<rho::String, rho::String>& args, const rho::String& newArgName, const rho::String& deprecatedArgName, rho::String& realArgValue ) {
			bool found = false;
			if ( args.containsKey(deprecatedArgName) ) {
				RAWLOG_WARNING2("'%s' argument is deprecated for search. Use '%s' instead.",deprecatedArgName.c_str(),newArgName.c_str());
				realArgValue = args.get(deprecatedArgName);
				found = true;
			}
			if ( args.containsKey(newArgName) ) {
				realArgValue = args.get(newArgName);
				found = true;
			}
			return found;
		}
开发者ID:NHB348,项目名称:rhoconnect-client,代码行数:13,代码来源:RhoConnectClientImpl.cpp

示例3: LOG

void CSensorImpl::setProperties(const rho::Hashtable<rho::String, rho::String>& propertyMap, rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request to set properties : " + m_sensorId;

    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot set properties");
    } else
    {
        for (rho::Hashtable<rho::String, rho::String>::const_iterator propMapItr = propertyMap.begin(); propMapItr != propertyMap.end(); propMapItr++)
        {
            if (_stricmp(propMapItr->first.c_str(), "minimumGap") == 0)
            {
                int minimumGap = atoi(propMapItr->second.c_str());
                if (minimumGap < 200)
                {
                    minimumGap = 200;
                }
                this->m_rawSensor->setMinimumGap(minimumGap);
            } else
            {
                oResult.setError(propMapItr->first + " is readonly or is invalid.");
            }
        }
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:26,代码来源:Sensor_impl.cpp

示例4: setProperties

void CMegamoduleBase::setProperties( const rho::Hashtable<rho::String, rho::String>& propertyMap, CMethodResult& oResult)
{
    for ( rho::Hashtable<rho::String, rho::String>::const_iterator it = propertyMap.begin();  it != propertyMap.end(); ++it )
    {
        setProperty( it->first, it->second, oResult );
        if ( oResult.isError() )
            break;
    }
}
开发者ID:bulatovalexey,项目名称:rhodes,代码行数:9,代码来源:MegamoduleBase.cpp

示例5: getHash

void CRhoParams::getHash(const char* name, rho::Hashtable<rho::String,rho::String>& mapHeaders) const
{
    const rho_param * hash = findHashParam(name);
    if (!hash || hash->type != RHO_PARAM_HASH)
        return;

    for (int i = 0; i < hash->v.hash->size; ++i)
    {
        rho_param * value = hash->v.hash->value[i];
        mapHeaders.put( hash->v.hash->name[i], value->v.string );
    }
}
开发者ID:3runo5ouza,项目名称:rhodes,代码行数:12,代码来源:rhoparams.cpp

示例6: beep

void NotificationSound::beep(const rho::Hashtable<rho::String, rho::String> &propertyMap)
{
    int mseconds = 1000;
    if (propertyMap.containsKey("duration")){
        QString propDur(propertyMap.get("duration").c_str());
        quint32 value = propDur.toUInt();
        mseconds = value ? value : mseconds;
    }

    int frequency = 2000;
    if (propertyMap.containsKey("frequency")){
        QString propFreq(propertyMap.get("frequency").c_str());
        quint32 value = propFreq.toUInt();
        frequency = value ? value : frequency;
    }

    int volume = 1;
    if (propertyMap.containsKey("volume")){
        QString propVol(propertyMap.get("volume").c_str());
        quint32 value = propVol.toUInt();
        volume = value ? value : volume;
    }

    NotificationSound * sound = new NotificationSound(frequency,mseconds,volume);
    sound->run();

}
开发者ID:nhinze,项目名称:rhodes,代码行数:27,代码来源:notificationsound.cpp

示例7: flash

    void flash( const rho::Hashtable<rho::String, rho::String>& propertyMap, rho::apiGenerator::CMethodResult& oResult)
	{
		m_eCurrentState = NOTIFY_STATE_CYCLE;
		CYCLE_INFO cycleInfo;
		SI_INIT(&cycleInfo);
		DWORD dwResult = m_pNotifications->lpfn_Notify_GetCycleInfo(m_iID, &cycleInfo);
		if (dwResult != E_NTFY_SUCCESS)
		{
			LOG(WARNING) + "Unable to flash LED " + m_szName + " due to error " + dwResult;
			return;
		}
		//  Set Defaults
		cycleInfo.ObjectTypeSpecific.LedSpecific.dwOnDuration = NOTIFY_LED_DEFAULT_LED_ON_DURATION;
		cycleInfo.ObjectTypeSpecific.LedSpecific.dwOffDuration = NOTIFY_LED_DEFAULT_LED_OFF_DURATION;
		cycleInfo.ObjectTypeSpecific.LedSpecific.dwCount = NOTIFY_LED_DEFAULT_LED_NUMBER_CYCLES;
		typedef std::map<rho::String, rho::String>::const_iterator it_type;
		for (it_type iterator = propertyMap.begin(); iterator != propertyMap.end(); iterator++)
		{
			DEBUGMSG(TRUE, (L"Setting LED Flash Property %s to value %s\n", convertToStringW(iterator->first).c_str(), convertToStringW(iterator->second).c_str()));
			if (_stricmp("onDuration", iterator->first.c_str()) == 0)
				cycleInfo.ObjectTypeSpecific.LedSpecific.dwOnDuration = atoi(iterator->second.c_str());
			else if (_stricmp("offDuration", iterator->first.c_str()) == 0)
				cycleInfo.ObjectTypeSpecific.LedSpecific.dwOffDuration = atoi(iterator->second.c_str());
			else if (_stricmp("numberOfCycles", iterator->first.c_str()) == 0)
				cycleInfo.ObjectTypeSpecific.LedSpecific.dwCount = atoi(iterator->second.c_str());
		}
		//  Remember the Cycle information in case we lose focus.
		memcpy(&mCycleInfoStore, &cycleInfo, sizeof(CYCLE_INFO));
		if (m_bAppHasFocus)
		{
			DWORD dwResult = m_pNotifications->lpfn_Notify_SetCycleInfo(m_iID, &cycleInfo);
			if (dwResult == E_NTFY_SUCCESS)
				dwResult = m_pNotifications->lpfn_Notify_SetState(m_iID, NOTIFY_STATE_CYCLE); 
			if (dwResult != E_NTFY_SUCCESS)
				LOG(WARNING) + "Unable to flash LED " + m_szName + " due to error " + dwResult;
		}
	}
开发者ID:Malisent,项目名称:rhodes,代码行数:37,代码来源:LedImpl.cpp

示例8: createTabbarEx

void CMainWindow::createTabbarEx(const rho::Vector<rho::String>& tabbarElements, const rho::Hashtable<rho::String, rho::String>& tabBarProperties, rho::apiGenerator::CMethodResult& oResult)
{
    if (!rho_rhodesapp_check_mode())
        return;

    std::auto_ptr<QColor> background_color (NULL);

    for ( Hashtable<rho::String, rho::String>::const_iterator it = tabBarProperties.begin(); it != tabBarProperties.end(); ++it )
    {
        const char *name = (it->first).c_str();
        const char *value = (it->second).c_str();
        if (strcasecmp(name, "backgroundColor") == 0)
            background_color.reset(new QColor(getColorFromString(value)));
    }

    ((QtMainWindow*)qtMainWindow)->tabbarInitialize();

    for (int i = 0; i < (int)tabbarElements.size(); ++i)
    {
        const char *label = NULL;
        const char *action = NULL;
        const char *icon = NULL;
        const char *reload = NULL;
        const char *colored_icon = NULL;

        std::auto_ptr<QColor> selected_color (NULL);
        const char *disabled = NULL;
        std::auto_ptr<QColor> web_bkg_color (NULL);
        const char* use_current_view_for_tab = NULL;

        CJSONEntry oEntry(tabbarElements[i].c_str());

        if ( oEntry.hasName("label") )
            label = oEntry.getString("label");
        if ( oEntry.hasName("action") )
            action = oEntry.getString("action");
        if ( oEntry.hasName("icon") )
            icon = oEntry.getString("icon");
        if ( oEntry.hasName("coloredIcon") )
            colored_icon = oEntry.getString("coloredIcon");
        if ( oEntry.hasName("reload") )
            reload = oEntry.getString("reload");
        if ( oEntry.hasName("selectedColor") )
            selected_color.reset(new QColor(getColorFromString(oEntry.getString("selectedColor"))));
        if ( oEntry.hasName("disabled") )
            disabled = oEntry.getString("disabled");
        if ( oEntry.hasName("useCurrentViewForTab") )
        {
            use_current_view_for_tab = oEntry.getString("useCurrentViewForTab");
            if (strcasecmp(use_current_view_for_tab, "true") == 0) {
                action = "none";
            }
        }
        if (oEntry.hasName("backgroundColor"))
            web_bkg_color.reset(new QColor(getColorFromString(oEntry.getString("backgroundColor"))));

        if (label == NULL)
            label = "";

        if ( label == NULL || action == NULL) {
            RAWLOG_ERROR("Illegal argument for create_nativebar");
            return;
        }

        QtMainWindow::QTabBarRuntimeParams tbrp;
        tbrp["label"] = QString(label);
        tbrp["action"] = QString(action);
        tbrp["reload"] = charToBool(reload);
        tbrp["use_current_view_for_tab"] = charToBool(use_current_view_for_tab);
        tbrp["background_color"] = background_color.get() != NULL ? background_color->name() : QString("");
        tbrp["selected_color"] = selected_color.get() != NULL ? selected_color->name() : QString("");
        String strIconPath = icon ? CFilePath::join( RHODESAPP().getAppRootPath(), icon) : String();
        ((QtMainWindow*)qtMainWindow)->tabbarAddTab(QString(label), icon ? strIconPath.c_str() : NULL, charToBool(disabled), web_bkg_color.get(), tbrp);
    }

    if (oResult.hasCallback())
        ((QtMainWindow*)qtMainWindow)->tabbarSetSwitchCallback(oResult);

    ((QtMainWindow*)qtMainWindow)->tabbarShow();

    m_started = true;
}
开发者ID:jvlstudio,项目名称:rhodes,代码行数:82,代码来源:MainWindowImpl.cpp

示例9: createToolbarEx

void CMainWindow::createToolbarEx( const rho::Vector<rho::String>& toolbarElements,  const rho::Hashtable<rho::String, rho::String>& toolBarProperties)
{
    if (!rho_rhodesapp_check_mode())
        return;

    std::auto_ptr<QColor> m_rgbBackColor (NULL);
    std::auto_ptr<QColor> m_rgbMaskColor (NULL);
    int m_nHeight = MIN_TOOLBAR_HEIGHT;

    for ( Hashtable<rho::String, rho::String>::const_iterator it = toolBarProperties.begin(); it != toolBarProperties.end(); ++it )
    {
        const char *name = (it->first).c_str();
        const char *value = (it->second).c_str();
        if (strcasecmp(name, "backgroundColor") == 0)
            m_rgbBackColor.reset(new QColor(getColorFromString(value)));
        else if (strcasecmp(name, "maskColor") == 0)
            m_rgbMaskColor.reset(new QColor(getColorFromString(value)));
        else if (strcasecmp(name, "viewHeight") == 0)
            m_nHeight = atoi(value);
    }

    if ( toolbarElements.size() == 0 )
    {
        removeToolbar();
        return;
    }

    removeAllButtons();

    int nSeparators = 0;
    bool wasSeparator = false;
    for (int ipass=0; ipass < 2; ++ipass)
    {
        for (int i = 0; i < (int)toolbarElements.size(); ++i)
        {
            const char *label = NULL;
            const char *action = NULL;
            const char *icon = NULL;
            const char *colored_icon = NULL;
            int  nItemWidth = 0;

            CJSONEntry oEntry(toolbarElements[i].c_str());

            if ( oEntry.hasName("label") )
                label = oEntry.getString("label");
            if ( oEntry.hasName("action") )
                action = oEntry.getString("action");
            if ( oEntry.hasName("icon") )
                icon = oEntry.getString("icon");
            if ( oEntry.hasName("coloredIcon") )
                colored_icon = oEntry.getString("coloredIcon");
            if ( oEntry.hasName("width") )
                nItemWidth = oEntry.getInt("width");

            if (label == NULL)
                label = "";

            if ( label == NULL || action == NULL) {
                LOG(ERROR) + "Illegal argument for create_nativebar";
                return;
            }
            if ( strcasecmp(action, "forward") == 0 && rho_conf_getBool("jqtouch_mode") )
                continue;

            if (!action) action = "";

            if (ipass==0) {
                if (strcasecmp(action, "separator")==0)
                    ++nSeparators;
            } else {
                LOG(INFO) + "addToolbarButton: Label: '"+label+"';Action: '"+action+"'";
                if (strcasecmp(action, "separator")==0) {
                    if (nSeparators!=1)
                        ((QtMainWindow*)qtMainWindow)->toolbarAddSeparator(nItemWidth);
                    else
                        wasSeparator = true;
                } else {
                    String strImagePath;
                    if ( icon && *icon )
                    {
#ifndef RHODES_EMULATOR
                        strImagePath = rho::common::CFilePath::join( RHODESAPP().getRhoRootPath(), "/apps" );
                        strImagePath = rho::common::CFilePath::join( strImagePath, icon );

#else
                        strImagePath = rho::common::CFilePath::join( RHODESAPP().getRhoRootPath(), icon );
#endif
                    } else {
#if defined(RHODES_EMULATOR)
#define RHODES_EMULATOR_PLATFORM_STR ".win32"
#elif defined(RHO_SYMBIAN)
#define RHODES_EMULATOR_PLATFORM_STR ".sym"
#else
#define RHODES_EMULATOR_PLATFORM_STR
#endif
                        if ( strcasecmp(action, "options")==0 )
                            strImagePath = "res/options_btn" RHODES_EMULATOR_PLATFORM_STR ".png";
                        else if ( strcasecmp(action, "home")==0 )
                            strImagePath = "res/home_btn" RHODES_EMULATOR_PLATFORM_STR ".png";
                        else if ( strcasecmp(action, "refresh")==0 )
//.........这里部分代码省略.........
开发者ID:jvlstudio,项目名称:rhodes,代码行数:101,代码来源:MainWindowImpl.cpp

示例10: getSyncThread

void RhoConnectClientImpl::search( const rho::Hashtable<rho::String, rho::String>& args, rho::apiGenerator::CMethodResult& oResult) {
	getSyncThread()->stopAll();

	bool syncChanges = false;
	int progressStep = -1;
	rho::Vector<rho::String> sources;
	rho::String searchParams;
	rho::String from = "search";
	
	/* handle old-style callback setting */
	if (args.containsKey("callback")) {
		oResult.setRubyCallback(args.get("callback"));
        
        if (args.containsKey("callback_param")) {
            oResult.setCallbackParam(args.get("callback_param"));
        }
	}
		
	if (args.containsKey("from") ) {
		from = args.get("from");
	}
	
	/*this will return new arg value, overriding deprecated one, if it is present*/
	struct DeprecatedArgsHandler {
		static bool getArgValue( const rho::Hashtable<rho::String, rho::String>& args, const rho::String& newArgName, const rho::String& deprecatedArgName, rho::String& realArgValue ) {
			bool found = false;
			if ( args.containsKey(deprecatedArgName) ) {
				RAWLOG_WARNING2("'%s' argument is deprecated for search. Use '%s' instead.",deprecatedArgName.c_str(),newArgName.c_str());
				realArgValue = args.get(deprecatedArgName);
				found = true;
			}
			if ( args.containsKey(newArgName) ) {
				realArgValue = args.get(newArgName);
				found = true;
			}
			return found;
		}
	};
	
	
	String jsonSources;
	if ( DeprecatedArgsHandler::getArgValue(args,"sourceNames","source_names",jsonSources) ) {
		rho::json::CJSONEntry json(jsonSources.c_str());
		if ( json.isArray() ) {
			for( rho::json::CJSONArrayIterator array(json); !array.isEnd(); array.next()) {
				sources.push_back( array.getCurItem().getString() );
			}
		}
	}

	if (args.containsKey("offset")) {
		searchParams += "&offset=" + rho::net::URI::urlEncode(args.get("offset"));
	}
	
	rho::String maxResults;
	if ( DeprecatedArgsHandler::getArgValue(args,"maxResults","max_results",maxResults) ) {
		searchParams += "&max_results=" + rho::net::URI::urlEncode(maxResults);
	}
	
	
	rho::String jsonSearchParams;
	if ( DeprecatedArgsHandler::getArgValue(args,"searchParams","search_params",jsonSearchParams) ) {
		rho::json::CJSONEntry json(jsonSearchParams.c_str());
		if ( json.isObject() ) {
			for ( rho::json::CJSONStructIterator obj(json); !obj.isEnd(); obj.next() ) {
				rho::String key = rho::net::URI::urlEncode(obj.getCurKey());
				rho::String value = rho::net::URI::urlEncode(obj.getCurValue().getString());
				
				searchParams += "&search[" + key + "]=" + value;
			}
		}
	}
	
	rho::String strSyncChanges;
	if ( DeprecatedArgsHandler::getArgValue(args,"syncChanges","sync_changes",strSyncChanges) ) {
		syncChanges = (strSyncChanges=="true") || (strSyncChanges=="1");
	}
	
	rho::String strProgressStep;
	if ( DeprecatedArgsHandler::getArgValue(args,"progressStep","progress_step",strProgressStep) ) {
		progressStep = atoi(strProgressStep.c_str());
	}

	getSyncEngine().getNotify().setSearchNotification( new sync::CSyncNotification(oResult, true) );
	getSyncThread()->addQueueCommand(new sync::CSyncThread::CSyncSearchCommand(from,searchParams,sources,syncChanges,progressStep) );
		
	handleSyncResult(oResult);
}
开发者ID:NHB348,项目名称:rhoconnect-client,代码行数:88,代码来源:RhoConnectClientImpl.cpp

示例11: CreateTabbarEx

void CNativeTabbar::CreateTabbarEx(const rho::Vector<rho::String>& tabbarElements, const rho::Hashtable<rho::String, rho::String>& tabBarProperties, rho::apiGenerator::CMethodResult& oResult)
{
    if (!rho_rhodesapp_check_mode() )
        return;

    RemoveTabbar();

	COLORREF   rgbBackColor;
    bool bHiddenTabs = false, bCreateOnInit = false;

    for ( Hashtable<rho::String, rho::String>::const_iterator it = tabBarProperties.begin(); it != tabBarProperties.end(); ++it )
    {
        const char *name = (it->first).c_str();
        const char *value = (it->second).c_str();
        if (strcasecmp(name, "backgroundColor") == 0) 
            rgbBackColor = getColorFromString(value);
        if (strcasecmp(name, "hiddenTabs") == 0) 
            bHiddenTabs = strcasecmp(value, "true") == 0;
        if (strcasecmp(name, "createOnInit") == 0) 
            bCreateOnInit = strcasecmp(value, "true") == 0;

    }

    if ( !bHiddenTabs )
    {
        LOG(WARNING) + "Illegal argument for create_nativebar: hiddenTabs should be true for Windows Mobile and Windows CE.";
        bHiddenTabs = true;
    }

    int nStartTab = -1;

    for (int i = 0; i < (int)tabbarElements.size(); ++i) 
    {
        const char *label = NULL;
        const char *action = NULL;
        const char *icon = NULL;
        const char *reload = NULL;
        const char *colored_icon = NULL;
        
    	COLORREF selected_color;
        const char *disabled = NULL;
		COLORREF web_bkg_color;
        const char* use_current_view_for_tab = NULL;
        bool bUseCurrentViewForTab = false, bReloadPage = false, bPerishable = false, bCreateOnInitTab = false;
        CJSONEntry oEntry(tabbarElements[i].c_str());

        if ( oEntry.hasName("label") )
            label = oEntry.getString("label");
        if ( oEntry.hasName("action") )
            action = oEntry.getString("action");
        if ( oEntry.hasName("icon") )
            icon = oEntry.getString("icon");
        if ( oEntry.hasName("coloredIcon") )
            colored_icon = oEntry.getString("coloredIcon");
        if ( oEntry.hasName("reload") )
        {
            reload = oEntry.getString("reload");
            if (strcasecmp(reload, "true") == 0)
                bReloadPage = true;
        }
        if ( oEntry.hasName("perishable") )
        {
            const char* perishable = oEntry.getString("perishable");
            if (strcasecmp(perishable, "true") == 0)
                bPerishable = true;
        }
        if ( oEntry.hasName("createOnInit") )
        {
            const char* createOnInit = oEntry.getString("createOnInit");
            if (strcasecmp(createOnInit, "true") == 0)
                bCreateOnInitTab = true;
        }

        if ( oEntry.hasName("selectedColor") )
            selected_color = getColorFromString(oEntry.getString("selectedColor"));
        if ( oEntry.hasName("disabled") )
            disabled = oEntry.getString("disabled");
        if ( oEntry.hasName("useCurrentViewForTab") )
        {
            use_current_view_for_tab = oEntry.getString("useCurrentViewForTab");
            if (strcasecmp(use_current_view_for_tab, "true") == 0)
                bUseCurrentViewForTab = true;
        }
        if (oEntry.hasName("backgroundColor")) 
            web_bkg_color = getColorFromString(oEntry.getString("backgroundColor"));

        if (label == NULL)
            label = "";
        if (action == NULL)
            action = "";
        
        m_arTabs.addElement(CTabBarItem(action, label, bUseCurrentViewForTab, bReloadPage, bPerishable, bCreateOnInitTab));

        if (m_strStartTabName.length()>0 && m_strStartTabName == label)
            nStartTab = i;

    }

    if ( oResult.hasCallback() )
        m_oCallback = oResult;
//.........这里部分代码省略.........
开发者ID:abmahmoodi,项目名称:rhodes,代码行数:101,代码来源:NativeTabbar.cpp

示例12: stop

void CSensorImpl::stop(rho::apiGenerator::CMethodResult& oResult)
{
    LOG(TRACE) + "Received request to stop sensor: " + m_sensorId;
    if (NULL == m_rawSensor)
    {
        oResult.setError("No sensor found. Cannot get stop.");
    }
    else
    {
        
        this->m_rawSensor->Stop();
        if ((NULL != m_callbackMethodResult) && (m_callbackMethodResult->hasCallback()))
        {
            m_callbackMethodResult = NULL;

        }
        rho::common::CMutexLock lock(m_cs);
        m_cache.clear();
    }
}
开发者ID:Fr3eZer,项目名称:rhodes,代码行数:20,代码来源:Sensor_impl.cpp


注:本文中的rho::Hashtable类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。