本文整理汇总了C++中wxFFile::IsOpened方法的典型用法代码示例。如果您正苦于以下问题:C++ wxFFile::IsOpened方法的具体用法?C++ wxFFile::IsOpened怎么用?C++ wxFFile::IsOpened使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wxFFile
的用法示例。
在下文中一共展示了wxFFile::IsOpened方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TestFILE
// 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);
}
示例2: 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;
}
示例3: Import
bool OggImportFileHandle::Import(TrackFactory *trackFactory, Track ***outTracks,
int *outNumTracks, Tags *tags)
{
wxASSERT(mFile->IsOpened());
/* -1 is for the current logical bitstream */
vorbis_info *vi = ov_info(mVorbisFile, -1);
vorbis_comment *vc = ov_comment(mVorbisFile, -1);
WaveTrack **channels = new WaveTrack *[vi->channels];
int c;
for (c = 0; c < vi->channels; c++) {
channels[c] = trackFactory->NewWaveTrack(int16Sample, vi->rate);
if (vi->channels == 2) {
switch (c) {
case 0:
channels[c]->SetChannel(Track::LeftChannel);
channels[c]->SetLinked(true);
break;
case 1:
channels[c]->SetChannel(Track::RightChannel);
channels[c]->SetTeamed(true);
break;
}
}
else {
channels[c]->SetChannel(Track::MonoChannel);
}
}
/* The number of bytes to get from the codec in each run */
#define CODEC_TRANSFER_SIZE 4096
/* The number of samples to read between calls to the callback.
* Balance between responsiveness of the GUI and throughput of import. */
#define SAMPLES_PER_CALLBACK 100000
short *mainBuffer = new short[CODEC_TRANSFER_SIZE];
/* determine endianness (clever trick courtesy of Nicholas Devillard,
* (http://www.eso.org/~ndevilla/endian/) */
int testvar = 1, endian;
if(*(char *)&testvar)
endian = 0; // little endian
else
endian = 1; // big endian
/* number of samples currently in each channel's buffer */
bool cancelled = false;
long bytesRead = 0;
long samplesRead = 0;
int bitstream = 0;
int samplesSinceLastCallback = 0;
// You would think that the stream would already be seeked to 0, and
// indeed it is if the file is legit. But I had several ogg files on
// my hard drive that have malformed headers, and this added call
// causes them to be read correctly. Otherwise they have lots of
// zeros inserted at the beginning
ov_pcm_seek(mVorbisFile, 0);
do {
/* get data from the decoder */
bytesRead = ov_read(mVorbisFile, (char *) mainBuffer,
CODEC_TRANSFER_SIZE,
endian,
2, // word length (2 for 16 bit samples)
1, // signed
&bitstream);
if (bytesRead < 0) {
/* Malformed Ogg Vorbis file. */
/* TODO: Return some sort of meaningful error. */
break;
}
samplesRead = bytesRead / vi->channels / sizeof(short);
/* give the data to the wavetracks */
for (c = 0; c < vi->channels; c++)
channels[c]->Append((char *)(mainBuffer + c),
int16Sample,
samplesRead,
vi->channels);
samplesSinceLastCallback += samplesRead;
if (samplesSinceLastCallback > SAMPLES_PER_CALLBACK) {
if( mProgressCallback )
cancelled = mProgressCallback(mUserData,
ov_time_tell(mVorbisFile) /
ov_time_total(mVorbisFile, bitstream));
samplesSinceLastCallback -= SAMPLES_PER_CALLBACK;
}
} while (!cancelled && bytesRead != 0 && bitstream == 0);
delete[]mainBuffer;
//.........这里部分代码省略.........
示例4: Import
int OggImportFileHandle::Import(TrackFactory *trackFactory, Track ***outTracks,
int *outNumTracks, Tags *tags)
{
wxASSERT(mFile->IsOpened());
CreateProgress();
//Number of streams used may be less than mVorbisFile->links,
//but this way bitstream matches array index.
mChannels = new WaveTrack **[mVorbisFile->links];
int i,c;
for (i = 0; i < mVorbisFile->links; i++)
{
//Stream is not used
if (mStreamUsage[i] == 0)
{
//This is just a padding to keep bitstream number and
//array indices matched.
mChannels[i] = NULL;
continue;
}
vorbis_info *vi = ov_info(mVorbisFile, i);
vorbis_comment *vc = ov_comment(mVorbisFile, i);
mChannels[i] = new WaveTrack *[vi->channels];
for (c = 0; c < vi->channels; c++) {
mChannels[i][c] = trackFactory->NewWaveTrack(int16Sample, vi->rate);
if (vi->channels == 2) {
switch (c) {
case 0:
mChannels[i][c]->SetChannel(Track::LeftChannel);
mChannels[i][c]->SetLinked(true);
break;
case 1:
mChannels[i][c]->SetChannel(Track::RightChannel);
mChannels[i][c]->SetTeamed(true);
break;
}
}
else {
mChannels[i][c]->SetChannel(Track::MonoChannel);
}
}
}
/* The number of bytes to get from the codec in each run */
#define CODEC_TRANSFER_SIZE 4096
/* The number of samples to read between calls to the callback.
* Balance between responsiveness of the GUI and throughput of import. */
#define SAMPLES_PER_CALLBACK 100000
short *mainBuffer = new short[CODEC_TRANSFER_SIZE];
/* determine endianness (clever trick courtesy of Nicholas Devillard,
* (http://www.eso.org/~ndevilla/endian/) */
int testvar = 1, endian;
if(*(char *)&testvar)
endian = 0; // little endian
else
endian = 1; // big endian
/* number of samples currently in each channel's buffer */
bool cancelled = false;
long bytesRead = 0;
long samplesRead = 0;
int bitstream = 0;
int samplesSinceLastCallback = 0;
// You would think that the stream would already be seeked to 0, and
// indeed it is if the file is legit. But I had several ogg files on
// my hard drive that have malformed headers, and this added call
// causes them to be read correctly. Otherwise they have lots of
// zeros inserted at the beginning
ov_pcm_seek(mVorbisFile, 0);
do {
/* get data from the decoder */
bytesRead = ov_read(mVorbisFile, (char *) mainBuffer,
CODEC_TRANSFER_SIZE,
endian,
2, // word length (2 for 16 bit samples)
1, // signed
&bitstream);
if (bytesRead < 0) {
/* Malformed Ogg Vorbis file. */
/* TODO: Return some sort of meaningful error. */
break;
}
samplesRead = bytesRead / mVorbisFile->vi[bitstream].channels / sizeof(short);
/* give the data to the wavetracks */
if (mStreamUsage[bitstream] != 0)
{
//.........这里部分代码省略.........
示例5: Poke
void DbgGdb::Poke()
{
static wxRegEx reCommand( wxT( "^([0-9]{8})" ) );
//poll the debugger output
wxString curline;
if ( !m_gdbProcess || m_gdbOutputArr.IsEmpty() ) {
return;
}
while ( DoGetNextLine( curline ) ) {
GetDebugeePID(curline);
// For string manipulations without damaging the original line read
wxString tmpline ( curline );
StripString( tmpline );
tmpline.Trim().Trim( false );
if ( m_info.enableDebugLog ) {
//Is logging enabled?
if ( curline.IsEmpty() == false && !tmpline.StartsWith( wxT( ">" ) ) ) {
wxString strdebug( wxT( "DEBUG>>" ) );
strdebug << curline;
#if DBG_LOG
if(gfp.IsOpened()) {
gfp.Write(strdebug);
gfp.Flush();
}
#else
m_observer->UpdateAddLine( strdebug );
#endif
}
}
if ( reConnectionRefused.Matches( curline ) ) {
StripString( curline );
#ifdef __WXGTK__
m_consoleFinder.FreeConsole();
#endif
m_observer->UpdateAddLine( curline );
m_observer->UpdateGotControl( DBG_EXITED_NORMALLY );
return;
}
// Check for "Operation not permitted" usually means
// that the process does not have enough permission to
// attach to the process
if( curline.Contains(wxT("Operation not permitted")) ) {
#ifdef __WXGTK__
m_consoleFinder.FreeConsole();
#endif
m_observer->UpdateAddLine( _("Failed to start debugger: permission denied") );
m_observer->UpdateGotControl( DBG_EXITED_NORMALLY );
return;
}
if( tmpline.StartsWith( wxT( ">" ) ) ) {
// Shell line, probably user command line
continue;
}
if ( curline.StartsWith( wxT( "~" ) ) || curline.StartsWith( wxT( "&" ) ) || curline.StartsWith("@") ) {
// lines starting with ~ are considered "console stream" message
// and are important to the CLI handler
bool consoleStream( false );
bool targetConsoleStream(false);
if ( curline.StartsWith( wxT( "~" ) ) ) {
consoleStream = true;
}
if ( curline.StartsWith( wxT( "@" ) ) ) {
targetConsoleStream = true;
}
// Filter out some gdb error lines...
if ( FilterMessage( curline ) ) {
continue;
}
StripString( curline );
// If we got a valid "CLI Handler" instead of writing the output to
// the output view, concatenate it into the handler buffer
if ( targetConsoleStream ) {
m_observer->UpdateAddLine( curline );
} else if ( consoleStream && GetCliHandler()) {
GetCliHandler()->Append( curline );
} else if ( consoleStream ) {
// log message
m_observer->UpdateAddLine( curline );
}
//.........这里部分代码省略.........
示例6: Import
int OggImportFileHandle::Import(TrackFactory *trackFactory, TrackHolders &outTracks,
Tags *tags)
{
outTracks.clear();
wxASSERT(mFile->IsOpened());
CreateProgress();
//Number of streams used may be less than mVorbisFile->links,
//but this way bitstream matches array index.
mChannels.resize(mVorbisFile->links);
int i = -1;
for (auto &link: mChannels)
{
++i;
//Stream is not used
if (mStreamUsage[i] == 0)
{
//This is just a padding to keep bitstream number and
//array indices matched.
continue;
}
vorbis_info *vi = ov_info(mVorbisFile, i);
link.resize(vi->channels);
int c = - 1;
for (auto &channel : link) {
++c;
channel = trackFactory->NewWaveTrack(mFormat, vi->rate);
if (vi->channels == 2) {
switch (c) {
case 0:
channel->SetChannel(Track::LeftChannel);
channel->SetLinked(true);
break;
case 1:
channel->SetChannel(Track::RightChannel);
break;
}
}
else {
channel->SetChannel(Track::MonoChannel);
}
}
}
/* The number of bytes to get from the codec in each run */
#define CODEC_TRANSFER_SIZE 4096
/* The number of samples to read between calls to the callback.
* Balance between responsiveness of the GUI and throughput of import. */
#define SAMPLES_PER_CALLBACK 100000
short *mainBuffer = new short[CODEC_TRANSFER_SIZE];
/* determine endianness (clever trick courtesy of Nicholas Devillard,
* (http://www.eso.org/~ndevilla/endian/) */
int testvar = 1, endian;
if(*(char *)&testvar)
endian = 0; // little endian
else
endian = 1; // big endian
/* number of samples currently in each channel's buffer */
int updateResult = eProgressSuccess;
long bytesRead = 0;
long samplesRead = 0;
int bitstream = 0;
int samplesSinceLastCallback = 0;
// You would think that the stream would already be seeked to 0, and
// indeed it is if the file is legit. But I had several ogg files on
// my hard drive that have malformed headers, and this added call
// causes them to be read correctly. Otherwise they have lots of
// zeros inserted at the beginning
ov_pcm_seek(mVorbisFile, 0);
do {
/* get data from the decoder */
bytesRead = ov_read(mVorbisFile, (char *) mainBuffer,
CODEC_TRANSFER_SIZE,
endian,
2, // word length (2 for 16 bit samples)
1, // signed
&bitstream);
if (bytesRead == OV_HOLE) {
wxFileName ff(mFilename);
wxLogError(wxT("Ogg Vorbis importer: file %s is malformed, ov_read() reported a hole"),
ff.GetFullName().c_str());
/* http://lists.xiph.org/pipermail/vorbis-dev/2001-February/003223.html
* is the justification for doing this - best effort for malformed file,
* hence the message.
//.........这里部分代码省略.........