这篇教程C++ GetExtension函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中GetExtension函数的典型用法代码示例。如果您正苦于以下问题:C++ GetExtension函数的具体用法?C++ GetExtension怎么用?C++ GetExtension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了GetExtension函数的27个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: GetExtensionbool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const{ const std::string extension = GetExtension(pFile); if(extension == "3mf") { return true; } else if(!extension.length() || checkSig) { if(!pIOHandler) return true; } return false;}
开发者ID:Dimrok,项目名称:assimp,代码行数:16,
示例2: sprintf//================================================================// Name: Write// Class: DocFileOutput// // Description: Writes the file to disk//// Parameters: char *filename -- the filename to create//// Returns: None////================================================================void DocFileOutput::Write(const char *filename, ClassDef *classlist, int ptypeFlag){ char realname[255]; sprintf(realname,"%s.%s",filename,GetExtension()); fileptr = fopen(realname,"w"); if ( !fileptr ) return; // Store the type flag privately so we don't have to pass it around typeFlag = ptypeFlag; // Start the writing process OutputClasses(classlist); fclose(fileptr);}
开发者ID:UberGames,项目名称:EF2GameSource,代码行数:27,
示例3: CFStringGetCStringvoid CAAudioFileFormats::FileFormatInfo::DebugPrint(){ char ftype[20]; char ftypename[64]; CFStringGetCString(mFileTypeName, ftypename, sizeof(ftypename), kCFStringEncodingUTF8); printf("File type: '%s' = %s/n Extensions:", OSTypeToStr(ftype, mFileTypeID), ftypename); int i, n = NumberOfExtensions(); for (i = 0; i < n; ++i) { GetExtension(i, ftype, sizeof(ftype)); printf(" .%s", ftype); } LoadDataFormats(); printf("/n Formats:/n"); for (i = 0; i < mNumDataFormats; ++i) mDataFormats[i].DebugPrint();}
开发者ID:Michael-Lfx,项目名称:iOS,代码行数:16,
示例4: GetExtensionvoid CDesignCollection::SelectAdventure (DWORD dwUNID)// SelectAdventure//// Enable the given adventure and disable all other adventures { int i; for (i = 0; i < GetExtensionCount(); i++) { SExtensionDesc *pEntry = GetExtension(i); if (pEntry->iType == extAdventure) pEntry->bEnabled = (pEntry->dwUNID == dwUNID); } }
开发者ID:alanhorizon,项目名称:Transport,代码行数:16,
示例5: switchint CExtensionListControl::CListItem::Compare(const CSortingListItem *baseOther, int subitem) const{ int r = 0; const CListItem *other = (const CListItem *)baseOther; switch (subitem) { case COL_EXTENSION: { r = signum(GetExtension().CompareNoCase(other->GetExtension())); } break; case COL_COLOR: case COL_BYTES: { r = signum(m_record.bytes - other->m_record.bytes); } break; case COL_FILES: { r = signum(m_record.files - other->m_record.files); } break; case COL_DESCRIPTION: { r = signum(GetDescription().CompareNoCase(other->GetDescription())); } break; case COL_BYTESPERCENT: { r = signum(GetBytesFraction() - other->GetBytesFraction()); } break; default: { ASSERT(0); } } return r;}
开发者ID:JDuverge,项目名称:windirstat,代码行数:47,
示例6: HasExtension bool HasExtension(const bfs::path& path) { // not sure this gives the same results as below // because the "." will be included in the extension // meaning that this may return true for a path that // is simply has an empty extension // see link for more information: // http://www.boost.org/doc/libs/1_49_0/libs/filesystem/v3/doc/reference.html#path-extension //return path.has_extension(); std::string extension = GetExtension(path); if (extension.empty() || extension == ".") { return false; } else { return true; } }
开发者ID:fifengine,项目名称:fifengine,代码行数:17,
示例7: fnwxSize Image::ToImageFile(wxString filename){ wxFileName fn(filename); wxString ext = fn.GetExt(); if(filename.Lower().EndsWith(GetExtension().Lower())) { wxFile file(filename,wxFile::write); if(!file.IsOpened()) return wxSize(-1,-1); file.Write(m_compressedImage.GetData(), m_compressedImage.GetDataLen()); if(file.Close()) return wxSize(m_originalWidth,m_originalHeight); else return wxSize(-1,-1); } else { wxBitmap bitmap = GetUnscaledBitmap(); wxImage image=bitmap.ConvertToImage(); wxBitmapType mimetype = wxBITMAP_TYPE_ANY; if((ext.Lower() == wxT("jpg")) || (ext.Lower() == wxT("jpeg"))) mimetype = wxBITMAP_TYPE_JPEG; else if(ext.Lower() == wxT("png")) mimetype = wxBITMAP_TYPE_PNG; else if(ext.Lower() == wxT("pcx")) mimetype = wxBITMAP_TYPE_PCX; else if(ext.Lower() == wxT("pnm")) mimetype = wxBITMAP_TYPE_PNM; else if((ext.Lower() == wxT("tif")) || (ext.Lower() == wxT("tiff"))) mimetype = wxBITMAP_TYPE_TIFF; else if(ext.Lower() == wxT("xpm")) mimetype = wxBITMAP_TYPE_XPM; else if(ext.Lower() == wxT("ico")) mimetype = wxBITMAP_TYPE_ICO; else if(ext.Lower() == wxT("cur")) mimetype = wxBITMAP_TYPE_CUR; else return(wxSize(-1,-1)); if(!image.SaveFile(filename,mimetype)) return wxSize(-1,-1); return image.GetSize(); }}
开发者ID:andrejv,项目名称:wxmaxima,代码行数:45,
示例8: assertRETCODE World::EntityLoad_Trigger(hQBSP qbsp, const EntityParse & entityDat){ //create new trigger Trigger *newObj = new Trigger; assert(newObj); /////////////////////////////////////////////////////// //load up the common stuff EntityLoad_CommonObject(qbsp, entityDat, dynamic_cast<Object *>(newObj)); const char *pStr; int iVal; /////////////////////////////////////////////////////// //can it only be turned on once? pStr = entityDat.GetVal("bOnce"); if(pStr) sscanf(pStr, "%d", &iVal); else iVal = 0; newObj->SetFlag(OBJ_FLAG_ONCE_ONLY, iVal ? true : false); //get script file char scriptPath[MAXCHARBUFF]; strcpy(scriptPath, m_filePath.c_str()); strcpy(GetExtension(scriptPath), SCENE_EXT); /////////////////////////////////////////////////////// //check if we want multiple entities to activate the trigger pStr = entityDat.GetVal("bAllowMultiple"); if(pStr) { sscanf(pStr, "%d", &iVal); newObj->AllowMultipleEntities(iVal == 1 ? true : false); } /////////////////////////////////////////////////////// //set the script for 'on' pStr = entityDat.GetVal("script"); if(pStr) newObj->LoadScript(scriptPath, pStr); return RETCODE_SUCCESS;}
开发者ID:ddionisio,项目名称:TaTaMahatta,代码行数:45,
示例9: GetExtensionRageSurface *RageSurfaceUtils::LoadFile( const RString &sPath, RString &error, bool bHeaderOnly ){ { RageFile TestOpen; if( !TestOpen.Open( sPath ) ) { error = TestOpen.GetError(); return NULL; } } set<RString> FileTypes; vector<RString> const& exts= ActorUtil::GetTypeExtensionList(FT_Bitmap); for(vector<RString>::const_iterator curr= exts.begin(); curr != exts.end(); ++curr) { FileTypes.insert(*curr); } RString format = GetExtension(sPath); format.MakeLower(); bool bKeepTrying = true; /* If the extension matches a format, try that first. */ if( FileTypes.find(format) != FileTypes.end() ) { RageSurface *ret = TryOpenFile( sPath, bHeaderOnly, error, format, bKeepTrying ); if( ret ) return ret; FileTypes.erase( format ); } for( set<RString>::iterator it = FileTypes.begin(); bKeepTrying && it != FileTypes.end(); ++it ) { RageSurface *ret = TryOpenFile( sPath, bHeaderOnly, error, *it, bKeepTrying ); if( ret ) { LOG->UserLog( "Graphic file", sPath, "is really %s", it->c_str() ); return ret; } } return NULL;}
开发者ID:Highlogic,项目名称:stepmania-event,代码行数:45,
示例10: GetExtensionvoid CDesignCollection::GetEnabledExtensions (TArray<CExtension *> *retExtensionList)// GetEnabledExtensions//// Returns the list of enabled extensions { int i; retExtensionList->DeleteAll(); for (i = 0; i < GetExtensionCount(); i++) { CExtension *pEntry = GetExtension(i); if (pEntry->GetType() == extExtension) retExtensionList->Insert(pEntry); } }
开发者ID:bmer,项目名称:Mammoth,代码行数:18,
示例11: GetExtensionvoid CDesignCollection::GetEnabledExtensions (TArray<DWORD> *retExtensionList)// GetEnabledExtensions//// Returns the list of enabled extensions { int i; retExtensionList->DeleteAll(); for (i = 0; i < GetExtensionCount(); i++) { SExtensionDesc *pEntry = GetExtension(i); if (pEntry->iType == extExtension && pEntry->bEnabled) retExtensionList->Insert(pEntry->dwUNID); } }
开发者ID:Sdw195,项目名称:Transcendence,代码行数:18,
示例12: search_formatsBOOL CImage::ReadFile(const CString& fileName, int imageType){ int oldImageType = filetype; filename = fileName; if (imageType==-1) { imageType = search_formats(GetExtension((char *)(const char *)filename)); } filetype = imageType; if (!implementation || (imageType != oldImageType)) { if (!CreateImplementation(filename, imageType)) return FALSE; } return implementation->ReadFile(filename);}
开发者ID:hackshields,项目名称:antivirus,代码行数:18,
示例13: CreateOldStyleShortcutvoid CreateOldStyleShortcut(HANDLE hContact, TCHAR *history_filename){ TCHAR shortcut[MAX_PATH] = _T(""); GetOldStyleAvatarName(shortcut, hContact); mir_sntprintf(shortcut, MAX_REGS(shortcut), _T("%s.%s.lnk"), shortcut, GetExtension(history_filename)); if (!CreateShortcut(history_filename, shortcut)) { ShowPopup(hContact, _T("Avatar History: Unable to create shortcut"), shortcut); } else { ShowDebugPopup(hContact, _T("AVH Debug: Shortcut created successfully"), shortcut); }}
开发者ID:Robyer,项目名称:miranda-plugins,代码行数:18,
示例14: GetExtensionvoid CDlgBOMExport::OnBrowse() { CString ext = GetExtension(); // Generate the filter string from the extension TCHAR szFilter[256]; _stprintf_s(szFilter, _T("Parts List (*%s)|*%s|All files (*.*)|*.*||"), ext, ext ); CFileDialog dlg( FALSE, _T("*")+ext, m_Filename, OFN_HIDEREADONLY, szFilter, AfxGetMainWnd() ); if (dlg.DoModal() == IDOK) { m_Filename = dlg.GetPathName(); UpdateData( FALSE ); }}
开发者ID:saranyan,项目名称:tinycad_graph_matching,代码行数:18,
示例15: SetNamebool SpriteSheet2D::BeginLoad(Deserializer& source){ if (GetName().Empty()) SetName(source.GetName()); loadTextureName_.Clear(); spriteMapping_.Clear(); String extension = GetExtension(source.GetName()); if (extension == ".plist") return BeginLoadFromPListFile(source); if (extension == ".xml") return BeginLoadFromXMLFile(source); URHO3D_LOGERROR("Unsupported file type"); return false;}
开发者ID:boberfly,项目名称:Urho3D,代码行数:18,
示例16: GetExtensionSoundReader *SoundReader_FileReader::OpenFile( CString filename, CString &error ){ { RageFile TestOpen; if( !TestOpen.Open( filename ) ) { error = TestOpen.GetError(); return NULL; } } set<CString> FileTypes; FileTypes.insert("ogg"); FileTypes.insert("mp3"); FileTypes.insert("wav"); CString format = GetExtension(filename); format.MakeLower(); error = ""; bool bKeepTrying = true; /* If the extension matches a format, try that first. */ if( FileTypes.find(format) != FileTypes.end() ) { SoundReader_FileReader *NewSample = TryOpenFile( filename, error, format, bKeepTrying ); if( NewSample ) return NewSample; FileTypes.erase( format ); } for( set<CString>::iterator it = FileTypes.begin(); bKeepTrying && it != FileTypes.end(); ++it ) { SoundReader_FileReader *NewSample = TryOpenFile( filename, error, *it, bKeepTrying ); if( NewSample ) { LOG->Warn("File /"%s/" is really %s", filename.c_str(), it->c_str()); return NewSample; } } return NULL;}
开发者ID:BitMax,项目名称:openitg,代码行数:44,
示例17: GetExtension// little helper function (to stay independent)void CResourceCompilerHelper::ReplaceExtension(const char* path, const char* new_ext, char* buffer, size_t bufferSizeInBytes){ const char* const ext = GetExtension(path); SettingsManagerHelpers::CFixedString<char, 512> p; if(ext) { p.set(path, ext - path); p.append(new_ext); } else { p.set(path); p.append("."); p.append(new_ext); } cry_strcpy(buffer, bufferSizeInBytes, p.c_str());}
开发者ID:amrhead,项目名称:eaascode,代码行数:20,
示例18: lockerbool wxGISDataset::Rename(const wxString &sNewName, ITrackCancel* const pTrackCancel){ wxCriticalSectionLocker locker(m_CritSect); Close(); CPLString szDirPath = CPLGetPath(m_sPath); CPLString szName = CPLGetBasename(m_sPath); CPLString szNewName(ClearExt(sNewName).mb_str(wxConvUTF8)); char** papszFileList = GetFileList(); papszFileList = CSLAddString( papszFileList, m_sPath ); if(!papszFileList) { if(pTrackCancel) pTrackCancel->PutMessage(_("No files to rename"), wxNOT_FOUND, enumGISMessageErr); return false; } char **papszNewFileList = NULL; for(int i = 0; papszFileList[i] != NULL; ++i ) { CPLString szNewPath(CPLFormFilename(szDirPath, szNewName, GetExtension(papszFileList[i], szName))); papszNewFileList = CSLAddString(papszNewFileList, szNewPath); if(!RenameFile(papszFileList[i], papszNewFileList[i], pTrackCancel)) { // Try to put the ones we moved back. for( --i; i >= 0; i-- ) RenameFile( papszNewFileList[i], papszFileList[i]); CSLDestroy( papszFileList ); CSLDestroy( papszNewFileList ); return false; } } m_sPath = CPLString(CPLFormFilename(szDirPath, szNewName, CPLGetExtension(m_sPath))); CSLDestroy( papszFileList ); CSLDestroy( papszNewFileList ); return true;}
开发者ID:Mileslee,项目名称:wxgis,代码行数:43,
示例19: FixSlashesInPlacevoid Transition::Load( CString sBGAniDir ){ if( IsADirectory(sBGAniDir) && sBGAniDir.Right(1) != "/" ) sBGAniDir += "/"; this->RemoveAllChildren(); m_sprTransition.Load( sBGAniDir ); m_sprTransition->PlayCommand( "On" ); this->AddChild( m_sprTransition ); m_fLengthSeconds = m_sprTransition->GetTweenTimeLeft(); m_State = waiting; // load sound from file specified by ini, or use the first sound in the directory if( IsADirectory(sBGAniDir) ) { IniFile ini; ini.ReadFile( sBGAniDir+"/BGAnimation.ini" ); CString sSoundFileName; if( ini.GetValue("BGAnimation","Sound", sSoundFileName) ) { FixSlashesInPlace( sSoundFileName ); CString sPath = sBGAniDir+sSoundFileName; CollapsePath( sPath ); m_sound.Load( sPath ); } else { m_sound.Load( sBGAniDir ); } } else if( GetExtension(sBGAniDir).CompareNoCase("xml") == 0 ) { CString sSoundFile; XNode xml; xml.LoadFromFile( sBGAniDir ); if( xml.GetAttrValue( "Sound", sSoundFile ) ) m_sound.Load( Dirname(sBGAniDir) + sSoundFile ); }}
开发者ID:DataBeaver,项目名称:openitg,代码行数:43,
示例20: GetFileTypeFileType GetFileType(const ea::string& fileName){ auto extension = GetExtension(fileName).to_lower(); if (archiveExtensions_.contains(extension)) return FTYPE_ARCHIVE; if (wordExtensions_.contains(extension)) return FTYPE_WORD; if (codeExtensions_.contains(extension)) return FTYPE_CODE; if (imagesExtensions_.contains(extension)) return FTYPE_IMAGE; if (textExtensions_.contains(extension)) return FTYPE_TEXT; if (audioExtensions_.contains(extension)) return FTYPE_AUDIO; if (extension == "pdf") return FTYPE_PDF; return FTYPE_FILE;}
开发者ID:rokups,项目名称:Urho3D,代码行数:19,
示例21: _void LocationDlg::OnLoadAnim( wxCommandEvent &event ){ wxString filter = _("Polyline Data Sources"); filter += _T("|"); AddType(filter, FSTRING_VTAP); AddType(filter, FSTRING_SHP); AddType(filter, FSTRING_DXF); AddType(filter, FSTRING_IGC); wxFileDialog loadFile(NULL, _("Load Animation Path"), _T(""), _T(""), filter, wxFD_OPEN); bool bResult = (loadFile.ShowModal() == wxID_OK); if (!bResult) return; vtAnimPath *anim; bool bSuccess; wxString str = loadFile.GetPath(); vtString filename = (const char *) str.mb_str(wxConvUTF8); if (GetExtension(filename) == ".vtap") { anim = CreateAnimPath(); bSuccess = anim->Read(filename); } else { vtFeatureLoader loader; vtFeatureSet *pSet = loader.LoadFrom(filename); if (!pSet) return; anim = CreateAnimPath(); bSuccess = anim->CreateFromLineString(m_pSaver->GetAtProjection(), pSet); delete pSet; } if (bSuccess) { AppendAnimPath(anim, filename); RefreshAnims(); } else delete anim;}
开发者ID:kamalsirsa,项目名称:vtp,代码行数:42,
示例22: GetExtensionbool BuildWindows::CheckIncludeResourceFile(const String& resourceDir, const String& fileName){ // #623 BEGIN TODO: Skip files that have a converted version in the cache AssetDatabase* db = GetSubsystem<AssetDatabase>(); String cachePath = db->GetCachePath(); if (resourceDir != cachePath) { String ext = GetExtension(fileName); if (ext == ".jpg" || ext == ".png" || ext == ".tga") { FileSystem* fileSystem = GetSubsystem<FileSystem>(); String compressedPath = cachePath + "DDS/" + fileName + ".dds"; if (fileSystem->FileExists(compressedPath)) return false; } } // #623 END TODO return BuildBase::CheckIncludeResourceFile(resourceDir, fileName);}
开发者ID:LumaDigital,项目名称:AtomicGameEngine,代码行数:20,
示例23: GetDescriptionwxString ExportPlugin::GetMask(){ if (!mMask.IsEmpty()) { return mMask; } wxString mask = GetDescription() + wxT("|"); // Build the mask, but cater to the Mac FileDialog and put the default // extension at the end of the mask. wxString ext = GetExtension(); wxArrayString exts = GetExtensions(); for (size_t i = 0; i < exts.GetCount(); i++) { if (ext != exts[i]) { mask += wxT("*.") + exts[i] + wxT(";"); } } return mask + wxT("*.") + ext;}
开发者ID:ruthmagnus,项目名称:audacity,代码行数:20,
示例24: GetExtensionvoid ImportCmd::Run(){ ToolSystem* tsystem = GetSubsystem<ToolSystem>(); Project* project = tsystem->GetProject(); String resourcePath = project->GetResourcePath(); String ext = GetExtension(assetFilename_); if (ext == ".json") { Poco::File file(assetFilename_.CString()); if (!file.exists()) { Error(ToString("JSON source scene does not exist: %s", assetFilename_.CString())); return; } LOGRAWF("Importing JSON: %s", assetFilename_.CString()); SharedPtr<JSONSceneImporter> jimporter; jimporter = new JSONSceneImporter(context_); jimporter->Import(assetFilename_); SharedPtr<JSONSceneProcess> sceneProcess; sceneProcess = new JSONSceneProcess(context_, jimporter); sceneProcess->Process(resourcePath); sceneProcess->Write(); } else { SharedPtr<OpenAssetImporter> importer(new OpenAssetImporter(context_)); if (importer->Load(assetFilename_)) { importer->ExportModel("/Users/josh/Desktop/ExportedModel.mdl"); } } Finished();}
开发者ID:WorldofOpenDev,项目名称:AtomicGameEngine,代码行数:41,
示例25: GetExtensionvoid OggOpusFile::Open(CStdString& filename, fileOpenModeEnum mode, bool stereo, int sampleRate){ if(m_sampleRate == 0) { m_sampleRate = sampleRate; } if(!m_filename.Equals(filename)) { m_filename = filename + GetExtension(); } fout = NULL; m_mode = mode; if (mode == READ) { fout = ACE_OS::fopen((PCSTR)m_filename, "rb"); } else { FileRecursiveMkdir(m_filename, CONFIG.m_audioFilePermissions, CONFIG.m_audioFileOwner, CONFIG.m_audioFileGroup, CONFIG.m_audioOutputPathMcf); fout = ACE_OS::fopen((PCSTR)m_filename, "wb"); if(CONFIG.m_audioFilePermissions) { FileSetPermissions(m_filename, CONFIG.m_audioFilePermissions); } if(CONFIG.m_audioFileGroup.size() && CONFIG.m_audioFileOwner.size()) { FileSetOwnership(m_filename, CONFIG.m_audioFileOwner, CONFIG.m_audioFileGroup); } } if(!fout) { throw(CStdString("Could not open file: ") + m_filename); } Init(); WriteHeader(); //Close();}
开发者ID:iulianu,项目名称:oreka,代码行数:41,
示例26: GetExtensionFileType ActorUtil::GetFileType( const RString &sPath ){ RString sExt = GetExtension( sPath ); sExt.MakeLower(); etft_cont_t::iterator conversion_entry= ExtensionToFileType.find(sExt); if(conversion_entry != ExtensionToFileType.end()) { return conversion_entry->second; } else if(sPath.size() > 0 && sPath[sPath.size()-1] == '/') { return FT_Directory; } /* Do this last, to avoid the IsADirectory in most cases. */ else if(IsADirectory(sPath)) { return FT_Directory; } return FileType_Invalid;}
开发者ID:AratnitY,项目名称:stepmania,代码行数:21,
示例27: bool C4ObjectInfo::Load(C4Group &hMother, const char *szEntryname){ // New version if (SEqualNoCase(GetExtension(szEntryname),"oci")) { C4Group hChild; if (hChild.OpenAsChild(&hMother,szEntryname)) { if (!C4ObjectInfo::Load(hChild)) { hChild.Close(); return false; } // resolve definition, if possible // only works in game, but is not needed in frontend or startup editing anyway pDef = C4Id2Def(id); hChild.Close(); return true; } } return false;}
开发者ID:TheBlackJokerDevil,项目名称:openclonk,代码行数:21,
注:本文中的GetExtension函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ GetExtraStyle函数代码示例 C++ GetExt函数代码示例 |