本文整理汇总了C++中wxFileName::IsFileReadable方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFileName::IsFileReadable方法的具体用法?C++ wxFileName::IsFileReadable怎么用?C++ wxFileName::IsFileReadable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFileName
的用法示例。
在下文中一共展示了wxFileName::IsFileReadable方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetUserDir
/*
This routine is platform-independent.
MMEX is a portable application which means ability to to run
without installation, for example, from USB flash drive.
If mmex finds mmexini.db3 in its folder, it assumes portable
mode and GetUserDir() in such case points to that folder.
FIXME: security issue - temp files will be created on host filesystem.
*/
const wxFileName mmex::GetUserDir(bool create)
{
static wxFileName fname;
if (!fname.IsOk())
{
fname = getSettingsPathPortable();
bool portable_file_ok = fname.IsFileWritable() && fname.IsFileReadable();
if (!portable_file_ok)
{
fname.AssignDir(wxStandardPaths::Get().GetUserDataDir());
if (create && !fname.DirExists())
{
portable_file_ok = fname.Mkdir(0700, wxPATH_MKDIR_FULL); // 0700 - octal, "111 000 000"
wxASSERT(portable_file_ok);
}
}
fname.SetFullName(wxGetEmptyString());
}
return fname;
}
示例2: LoadTAGS
bool HexEditorCtrl::LoadTAGS( wxFileName flnm ){
wxXmlDocument doc;
if( flnm.IsFileReadable() )
if( doc.Load( flnm.GetFullPath(), wxT("UTF-8")) )
if (doc.GetRoot()->GetName() == wxT("wxHexEditor_XML_TAG")){
wxXmlNode *child = doc.GetRoot()->GetChildren();
child = child->GetChildren(); //<filename> -> <TAG>
while (child) {
if (child->GetName() == wxT("TAG")) {
wxString propvalue = child->GetAttribute(wxT("id"), wxEmptyString);
#ifdef _DEBUG_TAG_
std::cout << "TAG ID:" << propvalue.ToAscii() << " readed.\n";
#endif
TagElement *tmp = new TagElement();
long long unsigned xxl=0;
for( wxXmlNode *element = child->GetChildren() ; element != NULL ; element = element->GetNext() ){
if (element->GetName() == wxT("start_offset")){
#ifdef __WXMSW__ //I don't knwo why but ToULongLong dowen't work on windows by mingw.
xxl = atoll( element->GetNodeContent().ToAscii() );
#else
element->GetNodeContent().ToULongLong( &xxl, 10 );
#endif
tmp->start = xxl;
}
else if (element->GetName() == wxT("end_offset")){
#ifdef __WXMSW__
xxl = atoll( element->GetNodeContent().ToAscii() );
#else
element->GetNodeContent().ToULongLong( &xxl, 10 );
#endif
tmp->end = xxl;
}
else if (element->GetName() == wxT("tag_text"))
tmp->tag = element->GetNodeContent();
else if (element->GetName() == wxT("font_colour"))
tmp->FontClrData.SetColour( wxColour(element->GetNodeContent()) );
else if (element->GetName() == wxT("note_colour"))
tmp->NoteClrData.SetColour( wxColour(element->GetNodeContent()) );
}
#ifdef _DEBUG_TAG_
tmp->print();
#endif
MainTagArray.Add(tmp);
}
child = child->GetNext();
}
MainTagArray.Sort(TagElementSort);
PreparePaintTAGs();
ClearPaint();
text_ctrl->RePaint();
hex_ctrl ->RePaint();
return true;
}
return false;
}
示例3: ShowReference
void FileViewer::ShowReference(const wxString& ref)
{
const wxFileName filename = GetFilename(ref);
wxFFile file;
wxString data;
if ( !filename.IsFileReadable() ||
!file.Open(filename.GetFullPath()) ||
!file.ReadAll(&data, wxConvAuto()) )
{
wxLogError(_("Error opening file %s!"), filename.GetFullPath().c_str());
return;
}
m_current = ref;
// support GNOME's xml2po's extension to references in the form of
// filename:line(xml_node):
wxString linenumStr = ref.AfterLast(_T(':')).BeforeFirst(_T('('));
long linenum;
if (!linenumStr.ToLong(&linenum))
linenum = 0;
m_text->SetReadOnly(false);
m_text->SetValue(data);
m_text->SetReadOnly(true);
m_text->MarkerDeleteAll(1);
m_text->MarkerAdd((int)linenum - 1, 1);
// Center the highlighted line:
int lineHeight = m_text->TextHeight((int)linenum);
int linesInWnd = m_text->GetSize().y / lineHeight;
m_text->ScrollToLine(wxMax(0, (int)linenum - linesInWnd/2));
}