本文整理汇总了C++中Reader函数的典型用法代码示例。如果您正苦于以下问题:C++ Reader函数的具体用法?C++ Reader怎么用?C++ Reader使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Reader函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: showError
medDataReaderWriter::Reader medDataReaderWriter::reader(const QString& path) {
QList<QString> readers = medAbstractDataFactory::instance()->readers();
if (readers.size()==0) {
#if 0
emit showError(tr("No reader plugin"),5000);
emit failure(this);
#endif
return Reader();
}
const QFileInfo& fi(path);
const QString& filename = fi.filePath();
// Store the last reader.
static Reader dreader;
if (!dreader.isNull() && dreader->canRead(filename))
return dreader;
for (int i=0;i<readers.size();++i) {
dreader = medAbstractDataFactory::instance()->readerSmartPointer(readers[i]);
if (dreader->canRead(filename)) {
dreader->enableDeferredDeletion(false);
return dreader;
}
}
return dreader = Reader();
}
示例2: r
bool MultipartParser::parse(const uint8_t *d, size_t l, const String &ct, bool files) {
Reader r(ct.c_str(), ct.length());
if (!parseContentType(r)) {
return false;
}
readFiles = files;
data = Reader((const char *)d, l);
origData = Reader((const char *)d, l);
return parseBody();
}
示例3: Bitmap_getTiffImageSize
static bool Bitmap_getTiffImageSize(StackBuffer<256> &data, const io::Producer &file, size_t &width, size_t &height) {
auto reader = Reader(data.data() + 4, 4);
auto offset = reader.readUnsigned32();
data.clear();
if (file.seekAndRead(offset, data, 2) != 2) {
return false;
}
auto size = Reader(data.data(), 2).readUnsigned16();
auto dictSize = size * 12;
offset += 2;
while (dictSize > 0) {
data.clear();
size_t blockSize = min(12 * 21, dictSize);
if (file.read(data, blockSize) != blockSize) {
return false;
}
auto blocks = blockSize / 12;
reader = Reader(data.data(), blockSize);
for (uint16_t i = 0; i < blocks; ++i) {
auto tagid = reader.readUnsigned16();
auto type = reader.readUnsigned16();
auto count = reader.readUnsigned32();
if (tagid == 256 && count == 1) {
if (type == 3) {
width = reader.readUnsigned16();
reader.offset(2);
} else if (type == 4) {
width = reader.readUnsigned32();
} else {
reader.offset(4);
}
} else if (tagid == 257 && count == 1) {
if (type == 3) {
height = reader.readUnsigned16();
reader.offset(2);
} else if (type == 4) {
height = reader.readUnsigned32();
} else {
reader.offset(4);
}
return true;
} else {
if (tagid > 257) {
return false;
}
reader.offset(4);
}
}
}
return false;
}
示例4: Reader
bool WiiWAD::IsWiiWAD(const std::string& _rName)
{
DiscIO::IBlobReader* pReader = DiscIO::CreateBlobReader(_rName.c_str());
if (pReader == NULL)
return false;
CBlobBigEndianReader Reader(*pReader);
bool Result = false;
// check for wii wad
if (Reader.Read32(0x00) == 0x20)
{
u32 WADTYpe = Reader.Read32(0x04);
switch(WADTYpe)
{
case 0x49730000:
case 0x69620000:
Result = true;
}
}
delete pReader;
return Result;
}
示例5: Writer
void FTransaction::FObjectRecord::Restore( FTransaction* Owner )
{
if( !bRestored )
{
bRestored = true;
TArray<uint8> FlipData;
TArray<FReferencedObject> FlipReferencedObjects;
TArray<FName> FlipReferencedNames;
TSharedPtr<ITransactionObjectAnnotation> FlipObjectAnnotation;
if( Owner->bFlip )
{
FlipObjectAnnotation = Object->GetTransactionAnnotation();
FWriter Writer( FlipData, FlipReferencedObjects, FlipReferencedNames, bWantsBinarySerialization );
SerializeContents( Writer, -Oper );
}
FTransaction::FObjectRecord::FReader Reader( Owner, Data, ReferencedObjects, ReferencedNames, bWantsBinarySerialization );
SerializeContents( Reader, Oper );
if( Owner->bFlip )
{
Exchange( ObjectAnnotation, FlipObjectAnnotation );
Exchange( Data, FlipData );
Exchange( ReferencedObjects, FlipReferencedObjects );
Exchange( ReferencedNames, FlipReferencedNames );
Oper *= -1;
}
}
}
示例6: StartElementL
void CSenBaseIdentityManager::StartElementL(
const TDesC8& aNsUri,
const TDesC8& aLocalName,
const TDesC8& aQName,
const RAttributeArray& aAttributes
)
{
if (aLocalName == KIdentityElementLocalName)
{
delete iIdentity; // there can be only one at the moment
iIdentity = NULL;
TPtr8 imei = ipDeviceID->Des();
iIdentity = CSenBaseIdentity::NewL(imei);
iIdentity->SetAttributesL(aAttributes);
iIdentity->SetReader(*Reader());
DelegateParsingL(*iIdentity);
}
// else if (aLocalName == KUsers)
// {
// }
else
{
CSenBaseFragment::StartElementL(aNsUri,
aLocalName, aQName, aAttributes);
}
}
示例7: QDir
void FourierSearch::run(QString pathToCuttedData) {
QStringList files = QDir(pathToCuttedData).entryList();
const int modules = 6;
const int rays = 8;
const int channels = 6;
QVector<float> res[6][8];
for (int i = 0; i < modules; i++)
for (int j = 0; j < rays; j++) {
res[i][j].resize(1024);
res[i][j].fill(0);
}
for (int i = 0; i < files.size(); i++)
if (files[i].endsWith(".pnt")) {
QString name = QDir(pathToCuttedData).absolutePath()+ "/" + files[i];
qDebug() << "processing file" << name;
Data data = Reader().readBinaryFile(name);
for (int module = 0; module < modules; module++)
for (int ray = 0; ray < rays; ray++)
for (int channel = 0; channel < channels; channel++)
runFourier(data, res[module][ray], module, ray, channel);
}
QFile f("/home/vlad/txt");
f.open(QIODevice::WriteOnly);
QTextStream s(&f);
for (int i = 0; i < 1024; i++)
s << res[5][7][i] << "\n";
}
示例8: detectInput
MeshReader
detectInput( const std::string& filename )
// *****************************************************************************
// Detect input mesh file type
//! \param[in] filename File to open and detect its type
//! \return enum specifying the mesh reader type
//! \author J. Bakosi
// *****************************************************************************
{
// Get first three letters from input file
std::string s( Reader( filename ).firstline().substr(0,4) );
if ( s.find("$Me") != std::string::npos ) {
return MeshReader::GMSH;
} else if ( s.find("CDF") != std::string::npos ||
s.find("HDF") != std::string::npos ) {
return MeshReader::EXODUSII;
} else if ( s.find("<?x") != std::string::npos ) {
return MeshReader::HYPERMESH;
} else {
try {
std::stoi(s); // try to convert to an integer
} catch ( std::invalid_argument ) {
Throw( "Input mesh file type could not be determined from header: " +
filename );
}
// could also catch std::out_of_range, the other exception potentially
// thrown by std::stoi(), but a three-digit integer will always fit into int
// if we got here, the above string-to-integer conversion succeeded
return MeshReader::NETGEN;
}
}
示例9: main
int main()
{
printf("\nProcessing...\n");
pcb_list = fopen("directory.pcb", "rt");
if (!pcb_list)
{
printf("error! no directory.pcb file in this dir\n");
exit(1);
}
dd_list = fopen("daydream.dir", "wt");
if (!dd_list)
{
printf("error writing directory.new.daydream file!\n");
exit(1);
}
fgets(line, 200, pcb_list);
fgets(line, 200, pcb_list); /* header */
while (!feof(pcb_list))
Reader();
printf("Thanks for using pcbfilelist to daydreamfilelist.\n");
fclose(pcb_list);
printf("closed pcb_list\n");
fclose(dd_list);
printf("closed dd_list\n");
return 0;
}
示例10: GetDiscType
EDiscType GetDiscType(IBlobReader& _rReader)
{
CBlobBigEndianReader Reader(_rReader);
u32 WiiMagic = Reader.Read32(0x18);
u32 WiiContainerMagic = Reader.Read32(0x60);
u32 WADMagic = Reader.Read32(0x02);
u32 GCMagic = Reader.Read32(0x1C);
// check for Wii
if (WiiMagic == 0x5D1C9EA3 && WiiContainerMagic != 0)
return DISC_TYPE_WII;
if (WiiMagic == 0x5D1C9EA3 && WiiContainerMagic == 0)
return DISC_TYPE_WII_CONTAINER;
// check for WAD
// 0x206962 for boot2 wads
if (WADMagic == 0x00204973 || WADMagic == 0x00206962)
return DISC_TYPE_WAD;
// check for GC
if (GCMagic == 0xC2339F3D)
return DISC_TYPE_GC;
WARN_LOG(DISCIO, "No known magic words found");
WARN_LOG(DISCIO, "Wii offset: 0x18 value: 0x%08x", WiiMagic);
WARN_LOG(DISCIO, "WiiC offset: 0x60 value: 0x%08x", WiiContainerMagic);
WARN_LOG(DISCIO, "WAD offset: 0x02 value: 0x%08x", WADMagic);
WARN_LOG(DISCIO, "GC offset: 0x1C value: 0x%08x", GCMagic);
return DISC_TYPE_UNK;
}
示例11: UpdateFromSeek
//----------------------------------------------------------------------------
//! @brief 再生が開始された時にコールされる
//! @return エラーコード
//----------------------------------------------------------------------------
HRESULT CDemuxSource::ChangeStart(void)
{
UpdateFromSeek();
if( m_rtStart > m_rtDuration )
m_rtStart = m_rtDuration; // 丸め
return Reader()->SetStartTime( m_rtStart );
}
示例12: Reader
//Load and save gamesettings
void GameProperties::Load()
{
CIniReader Reader(CFG_FILENAME);
GameProperties::Width = Reader.ReadInteger("settings" , "app_width" , 1280);
GameProperties::Height = Reader.ReadInteger("settings" , "app_height" , 1024);
GameProperties::Windowed = Reader.ReadInteger("settings" , "app_windowed" , 1);
}
示例13: sizeof
bool FNFSMessageHeader::ReceivePayload(FArrayReader& OutPayload, const FSimpleAbstractSocket& Socket)
{
// make room to receive a header
TArray<uint8> HeaderBytes;
int32 Size = sizeof(FNFSMessageHeader);
HeaderBytes.AddZeroed(Size);
if (!Socket.Receive(HeaderBytes.GetData(), Size))
{
UE_LOG(LogSockets, Error, TEXT("Unable to read full header"));
return false;
}
// parse it as a header (doing any byte swapping as needed)
FMemoryReader Reader(HeaderBytes);
FNFSMessageHeader Header(Socket);
Reader << Header;
// make sure it's valid
if (Header.Magic != Socket.GetMagic())
{
UE_LOG(LogSockets, Error, TEXT("Bad network header magic"));
return false;
}
if (!Header.PayloadSize)
{
UE_LOG(LogSockets, Error, TEXT("Empty payload"));
return false;
}
// was the header byteswapped? If so, make the archive byteswapped
OutPayload.SetByteSwapping(Reader.ForceByteSwapping());
// we are going to append to the payload, so note how much data is in it now
int32 PayloadOffset = OutPayload.AddUninitialized(Header.PayloadSize);
// put the read head at the start of the new data
OutPayload.Seek(PayloadOffset);
// receive the payload
if (!Socket.Receive(OutPayload.GetData() + PayloadOffset, Header.PayloadSize))
{
UE_LOG(LogSockets, Error, TEXT("Unable to read full payload"));
return false;
}
// make sure it's valid
uint32 ActualPayloadCrc = FCrc::MemCrc_DEPRECATED(OutPayload.GetData() + PayloadOffset, Header.PayloadSize);
if (Header.PayloadCrc != ActualPayloadCrc)
{
UE_LOG(LogSockets, Error, TEXT("Payload Crc failure."));
return false;
}
// success!
return true;
}
示例14: GetDuration
//----------------------------------------------------------------------------
//! @brief 再生範囲の設定を反映する
//! @return エラーコード
//----------------------------------------------------------------------------
HRESULT CWMReader::SetRange(void)
{
QWORD duration;
if( m_EndTime != 0 )
duration = m_EndTime - m_StartTime;
else
duration = GetDuration() - m_StartTime;
return Reader()->SetRange( m_StartTime, duration );
}
示例15: Reader
//----------------------------------------------------------------------------
//! @brief ストリームが閉じられる時にコールされる
//! @return エラーコード
//----------------------------------------------------------------------------
HRESULT CWMReader::Close(void)
{
Reader()->Close();
m_AudioOut.SetStreamNumber( 0 );
m_VideoOut.SetStreamNumber( 0 );
m_StartTime = 0;
m_EndTime = 0;
m_Rate = 1.0;
return S_OK;
}