/** Opens a file, overriding the filename extension with the one supplied * * @param filename A String containing the file to open * @param ext A String containing the extension of the file, which overrides the filename extension * @param create Whether the file should be created if not found * * @returns A Handle to the file opened. NULL is returned if not found * * NOTE: The extension string supplied here will be deleted by this method, * be sure this will not crash your application, sources of bugs in * this method are related to this operation * * Operation: * -# Finds a plugin associated with the extension supplied * -# Finds a transport associated with the filesystem requested in the filename * -# If the transport was found, attempt to use that transport to open the file, passing the filename and plugin to that transport * -# delete the extension supplied * -# Return the handle of the file */ VFSHandle * VirtualFS::Open(char *filename, char *ext, bool create) { VFSTransport *t = FindTransport(filename); VFSPlugin *p = FindPlugin(ext); VFSHandle *h = NULL; if(t != NULL && p != NULL) h = t->Open(filename,p,create); return h; }
/*********************************************************************\ Function name : CDialogCustomElement::Load Description : Created at : 27.03.02, @ 14:54:02 Created by : Thomas Kunert Modified by : \*********************************************************************/ Bool CDialogCustomElement::Load(BaseContainer* bc) { Int32 lPlugID = bc->GetInt32(DROLDWIN_SDK); BasePlugin *bs = (BasePlugin*)FindPlugin(lPlugID, PLUGINTYPE_CUSTOMGUI); CDialogItem::Load(bc); // check out, which element this is in our list if (!bs) return true; CCustomElements* pFirst = (CCustomElements*)g_pCustomElements->First(); Int32 lElement = 0; Bool bFound = false; while (pFirst) { if (pFirst->m_lID == lPlugID) { bFound = true; break; } pFirst = (CCustomElements*)g_pCustomElements->Next(pFirst); lElement++; } if (!bFound) return true; m_lElement = lElement; BaseContainer* pBC = &m_pbcGUI[m_lElement]; *pBC = *bc; if (bc->GetBool(DR_CUSTOMGUI_OPEN)) pFirst->m_bIsOpen = true; CCustomElements* pElement = g_pCustomElements->GetItem(m_lElement); m_strName = GeLoadString(IDS_CUSTOM_ELEMENT); m_strName += " [" + pElement->m_strName + "]"; m_strDescr = m_strName; return true; }
/** Uses the extension of the file, to find an appropiate Plugin to decode the file * * @param extension A String containing the extension for which to find a plugin * * @returns A Plugin object to encode/decode the type of file being opened. NULL is returned, if not found * * Operation: * -# Loop through all the available plugins * -# Get the plugin identifier * -# Loop through the plugin identifier string extracting each extension * -# Compare each extension found to the extension requested * -# If a match is found, return a pointer to the correct plugin * -# Otherwise, NULL is returned */ VFSPlugin * VirtualFS::FindPlugin(char *extension) { // Loop through all the plugins for(int a=0;a<m_plugin.size();a++){ char *type = new char[strlen(m_plugin[a]->Type())+1]; strcpy(type,m_plugin[a]->Type()); char *token = strtok(type,";"); while(token != NULL){ if(strcmp(extension,token) == 0){ delete[] type; return m_plugin[a]; } token = strtok(NULL,";"); } delete[] type; } return FindPlugin("binary"); }
void NFCPluginManager::Registered(NFIPlugin* plugin) { std::string strPluginName = plugin->GetPluginName(); if (!FindPlugin(strPluginName)) { bool bFind = false; PluginNameMap::iterator it = mPluginNameMap.begin(); for (it; it != mPluginNameMap.end(); ++it) { if (strPluginName == it->first) { bFind = true; break; } } if (bFind) { mPluginInstanceMap.insert(PluginInstanceMap::value_type(strPluginName, plugin)); plugin->Install(); } } }
void NFCPluginManager::Registered(NFIPlugin* plugin) { std::string strPluginName = plugin->GetPluginName(); if (!FindPlugin(strPluginName)) { // dynamic add plugin no dlls //bool bFind = false; //PluginNameMap::iterator it = mPluginNameMap.begin(); //for (it; it != mPluginNameMap.end(); ++it) //{ // if (strPluginName == it->first) // { // bFind = true; // break; // } //} //if (bFind) { mPluginInstanceMap.insert(PluginInstanceMap::value_type(strPluginName, plugin)); plugin->Install(); } } }
// --------------------------------------------------------------------------- // Resolve view plugin based on the criteria passed in parameter. // --------------------------------------------------------------------------- // CMPXViewPlugin* CMPXViewPluginHandler::ResolvePluginL( const RArray<TUid>& aUids, TUid& aResolvedPluginType, TUid& aResolvedPluginImplementationUid ) { MPX_FUNC( "CMPXViewPluginHandler::ResolvePluginL uid array" ); #ifdef _DEBUG for ( TInt i = 0; i < aUids.Count(); i++ ) { MPX_DEBUG2( "CMPXViewPluginHandler::ResolvePluginL input Uid = 0x%x", aUids[i].iUid ); } #endif // _DEBUG TUid impUid( FindPlugin( aUids.Array() ) ); MPX_DEBUG2( "CMPXViewPluginHandler::ResolvePluginL resolved implementation Uid = 0x%x", impUid.iUid ); if ( impUid == KNullUid ) { User::Leave( KErrNotFound ); } else { aResolvedPluginImplementationUid = impUid; aResolvedPluginType = PluginType( impUid ); } return PluginL( impUid ); }
/*********************************************************************\ Function name : CCustomSubDialog::CreateLayout Description : Created at : 27.03.02, @ 12:04:28 Created by : Thomas Kunert Modified by : \*********************************************************************/ Bool CCustomSubDialog::CreateLayout(void) { Int32 i; GroupBegin(100, BFH_SCALEFIT | BFV_SCALEFIT, 2, 0, "", 0); Int32 lID = FIRST_CUSTOM_ELEMENT_ID; if (!m_pProp || m_pProp[0].type == CUSTOMTYPE_END) { GroupBegin(100, BFH_SCALEFIT, 1, 0, "", 0); } AddCheckbox(IDC_CUSTOM_OPEN_CLOSE, BFH_LEFT, 0, 0, "Open"); Bool b = false; if (m_pElement) { CCustomElements* pElement = g_pCustomElements->GetItem(m_pElement->m_lElement); if (pElement) { BasePlugin *bs = (BasePlugin*)FindPlugin(pElement->m_lID, PLUGINTYPE_CUSTOMGUI); if (bs) { b = true; if (!(bs->GetInfo() & CUSTOMGUI_SUPPORT_LAYOUTSWITCH)) Enable(IDC_CUSTOM_OPEN_CLOSE, false); else Enable(IDC_CUSTOM_OPEN_CLOSE, true); } } } if (!b) Enable(IDC_CUSTOM_OPEN_CLOSE, true); if (!m_pProp || m_pProp[0].type == CUSTOMTYPE_END) { AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, GeLoadString(IDS_CUSTOM_NO_PROPS), 0); GroupEnd(); } AddStaticText(100, 0, 0, 0, "", 0); for (i = 0; m_pProp && m_pProp[i].type != CUSTOMTYPE_END; i++, lID++) { AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, m_pProp[i].ident, 0); switch (m_pProp[i].type) { case CUSTOMTYPE_FLAG: AddCheckbox(lID, BFH_LEFT | BFV_CENTER, 0, 0, ""); break; case CUSTOMTYPE_LONG: AddEditNumber(lID, BFH_LEFT | BFV_CENTER); break; case CUSTOMTYPE_REAL: AddEditNumber(lID, BFH_LEFT | BFV_CENTER); break; case CUSTOMTYPE_STRING: AddEditText(lID, BFH_SCALEFIT | BFV_CENTER); break; case CUSTOMTYPE_VECTOR: AddEditNumber(lID++, BFH_LEFT | BFV_CENTER); AddEditNumber(lID++, BFH_LEFT | BFV_CENTER); AddEditNumber(lID, BFH_LEFT | BFV_CENTER); break; default: AddStaticText(lID, BFH_LEFT | BFV_CENTER, 0, 0, "wird auch noch ;-)", 0); break; } } /*if (!m_pProp || i == 0) AddStaticText(100, BFH_LEFT | BFV_CENTER, 0, 0, GeLoadString(IDS_CUSTOM_NO_PROPS), 0);*/ return true; }