本文整理汇总了C++中wxFFile类的典型用法代码示例。如果您正苦于以下问题:C++ wxFFile类的具体用法?C++ wxFFile怎么用?C++ wxFFile使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxFFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writeStatus
void CCCSHandler::writeStatus(wxFFile& file)
{
for (unsigned int i = 0U; i < m_count; i++) {
CCCSHandler* handler = m_handlers[i];
if (handler != NULL) {
struct tm* tm = ::gmtime(&handler->m_time);
switch (handler->m_direction) {
case DIR_OUTGOING:
if (handler->m_state == CS_ACTIVE) {
wxString text;
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: CCS link - Rptr: %s Remote: %s Dir: Outgoing\n"),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
handler->m_callsign.c_str(), handler->m_yourCall.c_str());
file.Write(text);
}
break;
case DIR_INCOMING:
if (handler->m_state == CS_ACTIVE) {
wxString text;
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: CCS link - Rptr: %s Remote: %s Dir: Incoming\n"),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
handler->m_callsign.c_str(), handler->m_yourCall.c_str());
file.Write(text);
}
break;
}
}
}
}
示例2: SaveXML
void SilentBlockFile::SaveXML(int depth, wxFFile &xmlFile)
{
for(int i = 0; i < depth; i++)
xmlFile.Write("\t");
xmlFile.Write("<silentblockfile ");
xmlFile.Write(wxString::Format("len='%d' ", mLen));
xmlFile.Write("/>\n");
}
示例3: CPPUNIT_ASSERT
// test a wxFFile and wxFFileInput/OutputStreams of a known type
//
void FileKindTestCase::TestFILE(wxFFile& file, bool expected)
{
CPPUNIT_ASSERT(file.IsOpened());
CPPUNIT_ASSERT((wxGetFileKind(file.fp()) == wxFILE_KIND_DISK) == expected);
CPPUNIT_ASSERT((file.GetKind() == wxFILE_KIND_DISK) == expected);
wxFFileInputStream inStream(file);
CPPUNIT_ASSERT(inStream.IsSeekable() == expected);
wxFFileOutputStream outStream(file);
CPPUNIT_ASSERT(outStream.IsSeekable() == expected);
}
示例4: writeStatus
void CDPlusHandler::writeStatus(wxFFile& file)
{
for (unsigned int i = 0U; i < m_maxReflectors; i++) {
CDPlusHandler* reflector = m_reflectors[i];
if (reflector != NULL) {
wxString text;
struct tm* tm = ::gmtime(&reflector->m_time);
if (reflector->m_linkState == DPLUS_LINKED) {
switch (reflector->m_direction) {
case DIR_OUTGOING:
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle Rptr: %s Refl: %s Dir: Outgoing\n"),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
reflector->m_repeater.c_str(), reflector->m_reflector.c_str());
break;
case DIR_INCOMING:
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle User: %s Dir: Incoming\n"),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
reflector->m_reflector.c_str());
break;
}
file.Write(text);
}
}
}
}
示例5: IsMcdFormatted
static bool IsMcdFormatted( wxFFile& fhand )
{
static const char formatted_string[] = "Sony PS2 Memory Card Format";
static const int fmtstrlen = sizeof( formatted_string )-1;
char dest[fmtstrlen];
fhand.Read( dest, fmtstrlen );
return memcmp( formatted_string, dest, fmtstrlen ) == 0;
}
示例6: print
void PPToken::print(wxFFile &fp)
{
#if 0
wxString buff;
buff << wxT("Name : ") << name << wxT("\n");
buff << wxT("replacement : ") << replacement << wxT("\n");
buff << wxT("isFunctionLike: ") << isFunctionLike << wxT("\n");
if(isFunctionLike) {
for(size_t i=0; i<args.size(); i++) {
buff << wxT("Arg: ") << args.Item(i) << wxT("\n");
}
}
buff << wxT(" ---- \n");
fp.Write(buff);
#else
wxString buff;
buff << name << wxT("(") << (flags & IsFunctionLike) << wxT(")") << wxT("=") << replacement << wxT("\n");
fp.Write(buff);
#endif
}
示例7: Seek
// Returns FALSE if the seek failed (is outside the bounds of the file).
bool FileMemoryCard::Seek( wxFFile& f, u32 adr )
{
const u32 size = f.Length();
// If anyone knows why this filesize logic is here (it appears to be related to legacy PSX
// cards, perhaps hacked support for some special emulator-specific memcard formats that
// had header info?), then please replace this comment with something useful. Thanks! -- air
u32 offset = 0;
if( size == MCD_SIZE + 64 )
offset = 64;
else if( size == MCD_SIZE + 3904 )
offset = 3904;
else
{
// perform sanity checks here?
}
return f.Seek( adr + offset );
}
示例8: IsMcdFormatted
static bool IsMcdFormatted( wxFFile& fhand )
{
static const char formatted_psx[] = "MC";
static const char formatted_string[] = "Sony PS2 Memory Card Format";
static const int fmtstrlen = sizeof( formatted_string )-1;
char dest[fmtstrlen];
fhand.Read( dest, fmtstrlen );
bool formatted = memcmp( formatted_string, dest, fmtstrlen ) == 0;
if(!formatted) formatted = memcmp( formatted_psx, dest, 2 ) == 0;
return formatted;
}
示例9: writeStatus
void CXReflectorDPlusHandler::writeStatus(wxFFile& file)
{
for (unsigned int i = 0U; i < m_maxReflectors; i++) {
CXReflectorDPlusHandler* reflector = m_reflectors[i];
if (reflector != NULL) {
struct tm* tm = ::gmtime(&reflector->m_time);
wxString text;
text.Printf(wxT("%04d-%02d-%02d %02d:%02d:%02d: DPlus link - Type: Dongle User: %s Dir: Inbound\n"),
tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec,
reflector->m_reflector.c_str());
file.Write(text);
}
}
}
示例10: GenerateHeaderCode
void GenerateHeaderCode(wxFFile& file)
{
file.Write(_T("class ") + m_className + _T(" : public ") + m_parentClassName
+ _T(" {\nprotected:\n"));
size_t i;
for(i=0;i<m_wdata.Count();++i)
{
const XRCWidgetData& w = m_wdata.Item(i);
if( !IsRealClass(w.GetClass()) ) continue;
if( w.GetName().Length() == 0 ) continue;
file.Write(
_T(" ") + w.GetClass() + _T("* ") + w.GetName()
+ _T(";\n"));
}
file.Write(_T("\nprivate:\n void InitWidgetsFromXRC(){\n")
_T(" wxXmlResource::Get()->LoadObject(this,NULL,_T(\"")
+ m_className
+ _T("\"), _T(\"")
+ m_parentClassName
+ _T("\"));\n"));
for(i=0;i<m_wdata.Count();++i)
{
const XRCWidgetData& w = m_wdata.Item(i);
if( !IsRealClass(w.GetClass()) ) continue;
if( w.GetName().Length() == 0 ) continue;
file.Write( _T(" ")
+ w.GetName()
+ _T(" = XRCCTRL(*this,\"")
+ w.GetName()
+ _T("\",")
+ w.GetClass()
+ _T(");\n")
);
}
file.Write(_T(" }\n"));
file.Write(
_T("public:\n")
+ m_className
+ _T("::")
+ m_className
+ _T("(){\n")
+ _T(" InitWidgetsFromXRC();\n")
_T(" }\n")
_T("};\n")
);
};
示例11: SaveXML
void PCMAliasBlockFile::SaveXML(int depth, wxFFile &xmlFile)
{
for(int i = 0; i < depth; i++)
xmlFile.Write("\t");
xmlFile.Write("<pcmaliasblockfile ");
xmlFile.Write(wxString::Format("summaryfile='%s' ",
XMLTagHandler::XMLEsc(mFileName.GetFullName()).c_str()));
xmlFile.Write(wxString::Format("aliasfile='%s' ",
XMLTagHandler::XMLEsc(mAliasedFileName.GetFullPath()).c_str()));
xmlFile.Write(wxString::Format("aliasstart='%d' ", mAliasStart));
xmlFile.Write(wxString::Format("aliaslen='%d' ", mLen));
xmlFile.Write(wxString::Format("aliaschannel='%d' ", mAliasChannel));
xmlFile.Write(wxString::Format("min='%s' ",
Internat::ToString(mMin).c_str()));
xmlFile.Write(wxString::Format("max='%s' ",
Internat::ToString(mMax).c_str()));
xmlFile.Write(wxString::Format("rms='%s'",
Internat::ToString(mRMS).c_str()));
xmlFile.Write("/>\n");
}
示例12: Init
bool FLACImportFileHandle::Init()
{
#ifdef LEGACY_FLAC
bool success = mFile->set_filename(OSINPUT(mFilename));
if (!success) {
return false;
}
mFile->set_metadata_respond(FLAC__METADATA_TYPE_STREAMINFO);
mFile->set_metadata_respond(FLAC__METADATA_TYPE_VORBIS_COMMENT);
FLAC::Decoder::File::State state = mFile->init();
if (state != FLAC__FILE_DECODER_OK) {
return false;
}
#else
if (!mHandle.Open(mFilename, wxT("rb"))) {
return false;
}
// Even though there is an init() method that takes a filename, use the one that
// takes a file handle because wxWidgets can open a file with a Unicode name and
// libflac can't (under Windows).
//
// Responsibility for closing the file is passed to libflac.
// (it happens when mFile->finish() is called)
bool result = mFile->init(mHandle.fp())?true:false;
mHandle.Detach();
if (result != FLAC__STREAM_DECODER_INIT_STATUS_OK) {
return false;
}
#endif
mFile->process_until_end_of_metadata();
#ifdef LEGACY_FLAC
state = mFile->get_state();
if (state != FLAC__FILE_DECODER_OK) {
return false;
}
#else
// not necessary to check state, error callback will catch errors, but here's how:
if (mFile->get_state() > FLAC__STREAM_DECODER_READ_FRAME) {
return false;
}
#endif
if (!mFile->is_valid() || mFile->get_was_error()) {
// This probably is not a FLAC file at all
return false;
}
return true;
}
示例13: systemStopGameRecording
void systemStopGameRecording()
{
if (!game_recording)
return;
if (game_file.Write(&game_frame, sizeof(game_frame)) != sizeof(game_frame) || game_file.Write(&game_joypad, sizeof(game_joypad)) != sizeof(game_joypad) || !game_file.Close())
wxLogError(_("Error writing game recording"));
game_recording = false;
MainFrame* mf = wxGetApp().frame;
mf->cmd_enable &= ~CMDEN_GREC;
mf->cmd_enable |= CMDEN_NGREC | CMDEN_NGPLAY;
mf->enable_menus();
}
示例14: ExecuteCmd
bool DbgGdb::ExecuteCmd( const wxString &cmd )
{
if( m_gdbProcess ) {
if ( m_info.enableDebugLog ) {
#if DBG_LOG
if(gfp.IsOpened()) {
gfp.Write(wxString::Format( wxT( "DEBUG>>%s\n" ), cmd.c_str() ));
gfp.Flush();
}
#else
m_observer->UpdateAddLine( wxString::Format( wxT( "DEBUG>>%s" ), cmd.c_str() ) );
#endif
}
return m_gdbProcess->Write( cmd );
}
return false;
}
示例15: systemStartGameRecording
void systemStartGameRecording(const wxString &fname)
{
GameArea* panel = wxGetApp().frame->GetPanel();
if (!panel || panel->game_type() == IMAGE_UNKNOWN ||
!panel->emusys->emuWriteState)
{
wxLogError(_("No game in progress to record"));
return;
}
systemStopGamePlayback();
wxString fn = fname;
if (fn.size() < 4 || !wxString(fn.substr(fn.size() - 4)).IsSameAs(wxT(".vmv"), false))
fn.append(wxT(".vmv"));
u32 version = 1;
if (!game_file.Open(fn.c_str(), wxT("wb")) ||
game_file.Write(&version, sizeof(version)) != sizeof(version))
{
wxLogError(_("Cannot open output file %s"), fname.c_str());
return;
}
fn[fn.size() - 1] = wxT('0');
if (!panel->emusys->emuWriteState(fn.mb_fn_str()))
{
wxLogError(_("Error writing game recording"));
game_file.Close();
return;
}
game_frame = 0;
game_joypad = 0;
game_recording = true;
MainFrame* mf = wxGetApp().frame;
mf->cmd_enable &= ~(CMDEN_NGREC | CMDEN_GPLAY | CMDEN_NGPLAY);
mf->cmd_enable |= CMDEN_GREC;
mf->enable_menus();
}