• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetExtension函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: GetExtension

bool 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,代码来源:D3MFImporter.cpp


示例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,代码来源:output.cpp


示例3: CFStringGetCString

void	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,代码来源:CAAudioFileFormats.cpp


示例4: GetExtension

void 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,代码来源:CDesignCollection.cpp


示例5: switch

int 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,代码来源:typeview.cpp


示例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,代码来源:fife_boost_filesystem.cpp


示例7: fn

wxSize 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,代码来源:Image.cpp


示例8: assert

RETCODE 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,代码来源:tata_world_load_entity_trigger.cpp


示例9: GetExtension

RageSurface *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,代码来源:RageSurface_Load.cpp


示例10: GetExtension

void 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,代码来源:CDesignCollection.cpp


示例11: GetExtension

void 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,代码来源:CDesignCollection.cpp


示例12: search_formats

BOOL 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,代码来源:cimage.cpp


示例13: CreateOldStyleShortcut

void 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,代码来源:AvatarHistory.cpp


示例14: GetExtension

void 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,代码来源:DlgBOMExport.cpp


示例15: SetName

bool 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,代码来源:SpriteSheet2D.cpp


示例16: GetExtension

SoundReader *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,代码来源:RageSoundReader_FileReader.cpp


示例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,代码来源:ResourceCompilerHelper.cpp


示例18: locker

bool 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,代码来源:dataset.cpp


示例19: FixSlashesInPlace

void 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,代码来源:Transition.cpp


示例20: GetFileType

FileType 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,代码来源:ContentUtilities.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetExtraStyle函数代码示例发布时间:2022-05-30
下一篇:
C++ GetExt函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap