本文整理汇总了C++中GetExtension函数的典型用法代码示例。如果您正苦于以下问题:C++ GetExtension函数的具体用法?C++ GetExtension怎么用?C++ GetExtension使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetExtension函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
示例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);
}
示例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();
}
示例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);
}
}
示例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;
}
示例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;
}
}
示例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();
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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 );
}
}
示例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;
}