本文整理汇总了C++中wxInputStream类的典型用法代码示例。如果您正苦于以下问题:C++ wxInputStream类的具体用法?C++ wxInputStream怎么用?C++ wxInputStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了wxInputStream类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: if
FbImportBook::FbImportBook(FbImportThread & owner, wxInputStream & in, const wxString & filename)
: m_parser(NULL)
, m_database(*owner.GetDatabase())
, m_filename(owner.GetRelative(filename))
, m_filepath(owner.GetAbsolute(filename))
, m_filetype(Ext(m_filename))
, m_message(filename)
, m_filesize(in.GetLength())
, m_archive(0)
, m_ok(false)
{
wxLogMessage(_("Import file %s"), m_filename.c_str());
m_ok = in.IsOk();
if (!m_ok) return;
if (m_filetype == wxT("fb2")) {
m_parser = new FbImportReaderFB2(in, true);
m_md5sum = m_parser->GetMd5();
} else if (m_filetype == wxT("epub")) {
m_md5sum = CalcMd5(in);
in.SeekI(0);
wxString rootfile = FbRootReaderEPUB(in).GetRoot();
in.SeekI(0);
m_parser = new FbDataReaderEPUB(in, rootfile);
} else {
m_md5sum = CalcMd5(in);
}
}
开发者ID:EvgeniiFrolov,项目名称:myrulib,代码行数:28,代码来源:FbImportReader.cpp
示例2: Put
bool wxCurlFTP::Put(wxInputStream& buffer, const wxString& szRemoteFile /*= wxEmptyString*/)
{
curl_off_t iSize = 0;
if(m_pCURL && buffer.IsOk())
{
SetCurlHandleToDefaults(szRemoteFile);
iSize = buffer.GetSize();
if(iSize == (~(ssize_t)0))
return false;
SetOpt(CURLOPT_UPLOAD, TRUE);
SetStreamReadFunction(buffer);
SetOpt(CURLOPT_INFILESIZE_LARGE, iSize);
if(Perform())
{
return ((m_iResponseCode > 199) && (m_iResponseCode < 300));
}
}
return false;
}
开发者ID:KastB,项目名称:OpenCPN,代码行数:25,代码来源:ftp.cpp
示例3: Put
bool wxCurlHTTP::Put(wxInputStream& buffer, const wxString& szRemoteFile /*= wxEmptyString*/)
{
curl_off_t iSize = 0;
if(m_pCURL && buffer.IsOk())
{
SetCurlHandleToDefaults(szRemoteFile);
iSize = buffer.GetSize();
if(iSize == (~(size_t)0)) // wxCurlHTTP does not know how to upload unknown length streams.
return false;
SetOpt(CURLOPT_UPLOAD, TRUE);
SetOpt(CURLOPT_PUT, TRUE);
SetStreamReadFunction(buffer);
SetOpt(CURLOPT_INFILESIZE_LARGE, (curl_off_t)iSize);
SetStringWriteFunction(m_szResponseBody);
if(Perform())
{
return IsResponseOk();
}
}
return false;
}
开发者ID:tvo,项目名称:springlobby,代码行数:27,代码来源:http.cpp
示例4: DoGetFromStream
void MyPipeFrame::DoGetFromStream(wxTextCtrl *text, wxInputStream& in)
{
while ( in.CanRead() )
{
char buffer[4096];
buffer[in.Read(buffer, WXSIZEOF(buffer) - 1).LastRead()] = '\0';
text->AppendText(buffer);
}
}
开发者ID:wuqiong4945,项目名称:memu,代码行数:10,代码来源:processmanager.cpp
示例5: ReadInt
/** @brief Read an int from an input stream
*
* @param in wxInputStream&
* @param out_Int int&
* @return bool
*
*/
static bool ReadInt( wxInputStream& in, int& out_Int )
{
int val = 0;
if (!in.CanRead())
return false;
in.Read(&val, sizeof(val));
out_Int = val;
return true;
}
开发者ID:stahta01,项目名称:ClangLib,代码行数:17,代码来源:tokendatabase.cpp
示例6: ReadLongLong
/** @brief Read a long long from an input stream
*
* @param in wxInputStream&
* @param out_LongLong long long&
* @return bool
*
*/
static bool ReadLongLong( wxInputStream& in, long long& out_LongLong )
{
long long val = 0;
if (!in.CanRead())
return false;
in.Read(&val, sizeof(val));
out_LongLong = val;
return true;
}
开发者ID:stahta01,项目名称:ClangLib,代码行数:17,代码来源:tokendatabase.cpp
示例7: Load
bool HexView::Load(wxInputStream& iStr)
{
wxFileOffset strSize = iStr.SeekI(0, wxFromEnd);
iStr.SeekI(0);
unsigned char* data = new unsigned char[strSize];
iStr.Read(data, strSize);
Load(data, strSize);
delete [] data;
return true;
}
开发者ID:WondermSwift,项目名称:HLMWadExplorer,代码行数:11,代码来源:HexView.cpp
示例8: ReadToken
wxString IACFile::ReadToken(wxInputStream &file) {
// 0 = read chars until digit
// 1 = read digits until no digit
// 2 = token found
wxString token = wxEmptyString;
int mode = 0;
while (file.IsOk() && mode != 2) {
int c = file.GetC();
if (c != wxEOF && c <= 128) {
if (c == '\n' && m_tokensI > 0) {
m_newlineTokens.push_back(m_tokensI + 1);
}
m_RawData.Append((char)c);
switch (mode) {
case 0:
if (isdigit(c)) {
token.Append((char)c);
mode = 1;
}
break;
case 1:
if (isdigit(c) || c == '/') {
token.Append((char)c);
} else {
if (token.Len() == 5) {
// token found!!
mode = 2;
} else {
token.Empty();
}
}
break;
/* this is dead code
case 2:
mode = 0;
break;
*/
} // case
}
} // while
if (mode != 2) {
token.Empty();
}
return token;
}
开发者ID:rgleason,项目名称:iacfleet_pi,代码行数:49,代码来源:iacfile.cpp
示例9: ReadIn
/** @brief Read a tokendatabase from disk
*
* @param tokenDatabase The tokendatabase to read into
* @param in The wxInputStream to read from
* @return true if the operation succeeded, false otherwise
*
*/
bool ClTokenDatabase::ReadIn( ClTokenDatabase& tokenDatabase, wxInputStream& in )
{
in.SeekI(4); // Magic number
int version = 0;
if (!ReadInt(in, version))
return false;
int i = 0;
if (version != 0x01)
{
return false;
}
tokenDatabase.Clear();
int read_count = 0;
wxMutexLocker(tokenDatabase.m_Mutex);
while (in.CanRead())
{
int packetType = 0;
if (!ReadInt(in, packetType))
return false;
switch (packetType)
{
case ClTokenPacketType_filenames:
if (!ClFilenameDatabase::ReadIn(tokenDatabase.m_FileDB, in))
return false;
break;
case ClTokenPacketType_tokens:
int packetCount = 0;
if (!ReadInt(in, packetCount))
return false;
for (i = 0; i < packetCount; ++i)
{
ClAbstractToken token;
if (!ClAbstractToken::ReadIn(token, in))
return false;
if (token.fileId != -1)
{
//ClTokenId tokId =
tokenDatabase.InsertToken(token);
//fprintf( stdout, " '%s' / '%s' / fId=%d location=%d:%d hash=%d dbEntryId=%d\n", (const char*)token.identifier.mb_str(), (const char*)token.displayName.mbc_str(), token.fileId, token.location.line, token.location.column, token.tokenHash, tokId );
read_count++;
}
}
break;
}
}
return true;
}
开发者ID:stahta01,项目名称:ClangLib,代码行数:55,代码来源:tokendatabase.cpp
示例10: Read
bool IACFile::Read(wxInputStream &stream) {
bool isok = false; // true if minimum one token was read from file
Invalidate();
wxString token;
m_tokensI = 0;
if (stream.IsOk()) {
for (;;) {
token = ReadToken(stream);
if (!token.IsEmpty()) {
m_tokens.Add(token);
m_tokensI++;
isok = true;
} else {
break;
}
}
}
m_tokensI = 0;
// for (std::vector<size_t>::iterator it = m_newlineTokens.begin(); it != m_newlineTokens.end(); ++it)
// {
// wxMessageBox( wxString::Format( _T("ID: %i :"), *it ) + m_tokens[*it] );
// }
if (isok) {
// decode tokens if some were found
isok = Decode();
}
m_isok = isok;
return isok;
}
开发者ID:rgleason,项目名称:iacfleet_pi,代码行数:31,代码来源:iacfile.cpp
示例11:
FbImportZip::FbImportZip(FbImportThread & owner, wxInputStream &in, const wxString &filename):
m_owner(owner),
m_database(*owner.GetDatabase()),
m_conv(wxT("cp866")),
m_zip(in, m_conv),
m_filename(owner.GetRelative(filename)),
m_filepath(owner.GetAbsolute(filename)),
m_filesize(in.GetLength()),
m_ok(m_zip.IsOk())
{
if (!m_ok) {
wxLogError(_("Zip read error %s"), filename.c_str());
return;
}
wxLogMessage(_("Import zip %s"), filename.c_str());
while (wxZipEntry * entry = m_zip.GetNextEntry()) {
if (entry->GetSize()) {
wxString filename = entry->GetInternalName();
if (Ext(filename) == wxT("fbd")) {
wxString infoname = filename.BeforeLast(wxT('.'));
wxZipEntry*& current = m_map[infoname];
delete current;
current = entry;
} else {
m_list.Add(entry);
}
}
if (m_owner.IsClosed()) break;
}
}
开发者ID:EvgeniiFrolov,项目名称:myrulib,代码行数:31,代码来源:FbImportReader.cpp
示例12: DoCanRead
bool wxPNMHandler::DoCanRead( wxInputStream& stream )
{
Skip_Comment(stream);
if ( stream.GetC() == 'P' )
{
switch (stream.GetC())
{
case '3':
case '6':
return true;
}
}
return false;
}
开发者ID:gitrider,项目名称:wxsj2,代码行数:16,代码来源:imagpnm.cpp
示例13: loadIpCounts
void Database::loadIpCounts(wxInputStream &file)
{
double totallinecount = 0;
wxTextInputStream str(file);
str >> totallinecount;
int c = 0;
while(!file.Eof())
{
wxString line = str.ReadLine();
if (line.IsEmpty())
break;
std::wistringstream stream(line.c_str().AsWChar());
std::wstring memaddr;
stream >> memaddr;
double count;
stream >> count;
std::wstring srcfile;
int linenum;
::readQuote(stream, srcfile);
stream >> linenum;
LineInfo& lineinfo = (fileinfo[srcfile])[linenum];
lineinfo.count += count;
lineinfo.percentage += 100.0f * ((float)count / (float)totallinecount);
}
}
开发者ID:CyberShadow,项目名称:verysleepy-1,代码行数:33,代码来源:database.cpp
示例14: DoCanRead
bool wxSVGHandler::DoCanRead(wxInputStream& stream) {
unsigned char hdr[5];
if (!stream.Read(hdr, WXSIZEOF(hdr))) // it's ok to modify the stream position here
return false;
return hdr[0] == '<' && hdr[1] == '?' && hdr[2] == 'x' && hdr[3] == 'm' && hdr[4] == 'l'; // <?xml
}
开发者ID:KastB,项目名称:OpenCPN,代码行数:8,代码来源:imagsvg.cpp
示例15: ReadStream
wxString ReadStream(wxInputStream& stream)
{
wxTextInputStream txt(stream);
wxString str, line;
while (!stream.Eof())
str += txt.ReadLine() + wxT('\n');
return str;
}
开发者ID:coldfix,项目名称:latex-preview,代码行数:8,代码来源:window.cpp
示例16: DoCanRead
bool wxJPEGHandler::DoCanRead( wxInputStream& stream )
{
unsigned char hdr[2];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
return false;
return hdr[0] == 0xFF && hdr[1] == 0xD8;
}
开发者ID:Ailick,项目名称:rpcs3,代码行数:9,代码来源:imagjpeg.cpp
示例17: Read
bool wxTarHeaderBlock::Read(wxInputStream& in)
{
bool ok = true;
for (int id = 0; id < TAR_NUMFIELDS && ok; id++)
ok = in.Read(Get(id), Len(id)).LastRead() == Len(id);
return ok;
}
开发者ID:catalinr,项目名称:wxWidgets,代码行数:9,代码来源:tarstrm.cpp
示例18: DoCanRead
bool wxJPEGHandler::DoCanRead( wxInputStream& stream )
{
unsigned char hdr[2];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) ) // it's ok to modify the stream position here
return false;
return hdr[0] == 0xFF && hdr[1] == 0xD8;
}
开发者ID:EEmmanuel7,项目名称:wxWidgets,代码行数:9,代码来源:imagjpeg.cpp
示例19: doRead
void ApprExpansionDatabase::doRead(wxInputStream& in) {
wxTextInputStream tin(in);
while (!in.Eof()) {
String l = tin.ReadLine();
if (l.size() < 3) continue;
order.push_back(l.substr(0,2));
expansions[l.substr(0,2)] = l.substr(3);
}
}
开发者ID:CustomCardsOnline,项目名称:MagicSetEditor,代码行数:9,代码来源:apprentice.cpp
示例20: DoCanRead
bool wxPNGHandler::DoCanRead( wxInputStream& stream )
{
unsigned char hdr[4];
if ( !stream.Read(hdr, WXSIZEOF(hdr)) )
return false;
return memcmp(hdr, "\211PNG", WXSIZEOF(hdr)) == 0;
}
开发者ID:EdgarTx,项目名称:wx,代码行数:9,代码来源:imagpng.cpp
注:本文中的wxInputStream类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论