本文整理汇总了C++中ReadNumber函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadNumber函数的具体用法?C++ ReadNumber怎么用?C++ ReadNumber使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadNumber函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(int argc,char **argv)
{
if(argc != 5)
{
fprintf(stderr,"%s <bank public info> <private coin request> <signed coin request> <coin>\n",
argv[0]);
exit(1);
}
const char *szBankFile=argv[1];
const char *szPrivateRequestFile=argv[2];
const char *szSignatureFile=argv[3];
const char *szCoinFile=argv[4];
SetDumper(stderr);
BIO *bioBank=BIO_new_file(szBankFile,"r");
BIO *bioPrivateRequest=BIO_new_file(szPrivateRequestFile,"r");
BIO *bioSignature=BIO_new_file(szSignatureFile,"r");
BIO *bioCoin=BIO_new_file(szCoinFile,"w");
PublicBank bank(bioBank);
CoinRequest req(bioPrivateRequest);
ReadNumber(bioSignature,"request=");
BIGNUM *bnSignature=ReadNumber(bioSignature,"signature=");
DumpNumber("signature=",bnSignature);
Coin coin;
req.ProcessResponse(&coin,bank,bnSignature);
coin.WriteBIO(bioCoin);
}
示例2: ParsePayload
void ParsePayload( const ParseInfo *info )
{
printf( "\tParse payload...\n" );
uint8_t tmp = ReadByte();
uint8_t streamNumber = tmp & (BIT( 0 ) | BIT( 1 ) | BIT( 2 ) | BIT( 3 ) | BIT( 4 ) | BIT( 5 ) | BIT( 6 ));
bool isKeyFrame = (tmp & BIT( 7 )) != 0;
uint32_t mediaObjectNumber = ReadNumber( info->objectNumberLengthType );
uint32_t offset = ReadNumber( info->offsetLengthType );
uint32_t repLength = ReadNumber( info->repDataLengthType );
printf( "\t\tStream number: %d\n", streamNumber );
printf( "\t\tKey frame: %s\n", isKeyFrame ? "yes" : "no" );
printf( "\t\tMedia object number: %d\n", mediaObjectNumber );
printf( "\t\tOffset into object: %d\n", offset );
printf( "\t\tReplicated data length: %d\n", repLength );
if (repLength >= 8) {
printf( "\t\tReplicated data:\n" );
printf( "\t\t\tMedia object size: %d\n", ReadDWord() );
printf( "\t\t\tPresentation time: %d\n", ReadDWord() );
printf( "\t\tSkipping rest of replicated data...\n" );
cursor += repLength - 8;
} else {
cursor += repLength;
}
size_t headerSize = cursor - packetStart;
size_t dataSize = packetSize - headerSize - 0;
printf( "\t\tData offset: %ld\n", cursor - buffer );
AddDataToObject( ¤tObjects[streamNumber], offset, dataSize, cursor );
}
示例3: main
int main()
{
int a = ReadNumber();
int b = ReadNumber();
WriteAnswer(a + b);
return 0;
}
示例4: if
bool PxMDecoder::readHeader()
{
bool result = false;
if( !m_buf.empty() )
{
if( !m_strm.open(m_buf) )
return false;
}
else if( !m_strm.open( m_filename ))
return false;
try
{
int code = m_strm.getByte();
if( code != 'P' )
throw RBS_BAD_HEADER;
code = m_strm.getByte();
switch( code )
{
case '1': case '4': m_bpp = 1; break;
case '2': case '5': m_bpp = 8; break;
case '3': case '6': m_bpp = 24; break;
default: throw RBS_BAD_HEADER;
}
m_binary = code >= '4';
m_type = m_bpp > 8 ? CV_8UC3 : CV_8UC1;
m_width = ReadNumber( m_strm, INT_MAX );
m_height = ReadNumber( m_strm, INT_MAX );
m_maxval = m_bpp == 1 ? 1 : ReadNumber( m_strm, INT_MAX );
if( m_maxval > 65535 )
throw RBS_BAD_HEADER;
//if( m_maxval > 255 ) m_binary = false; nonsense
if( m_maxval > 255 )
m_type = CV_MAKETYPE(CV_16U, CV_MAT_CN(m_type));
if( m_width > 0 && m_height > 0 && m_maxval > 0 && m_maxval < (1 << 16))
{
m_offset = m_strm.getPos();
result = true;
}
}
catch(...)
{
}
if( !result )
{
m_offset = -1;
m_width = m_height = -1;
m_strm.close();
}
return result;
}
示例5: ReadNumber
TRect TTmCodeReader::ReadRect()
{
TRect r;
r.iTl.iX = ReadNumber();
r.iTl.iY = ReadNumber();
r.iBr.iX = r.iTl.iX + ReadNumber();
r.iBr.iY = r.iTl.iY + ReadNumber();
return r;
}
示例6: ReadBIO
void PublicBank::ReadBIO(BIO *bio)
{
m_pDH=DH_new();
m_pDH->g=ReadNumber(bio,"g=");
m_pDH->p=ReadNumber(bio,"p=");
m_pDH->pub_key=ReadNumber(bio,"public=");
Dump();
}
示例7: ParsePJL
bool Disasm::ParsePJL() {
if (!Expect("\033%-12345X") || !SkipTo(") HP-PCL XL;")) return false;
// version";"minor";" ... \n
int32 version, minor;
if (ReadNumber(version) && Expect(";") && ReadNumber(minor) && Expect(";") && SkipTo("\n")) {
printf("PCL XL %d ; %d\n", (int)version, (int)minor);
return true;
}
return false;
}
示例8: ReadNumber
bool Project_Engine::Parse_Str_Int(wchar_t* Text_Buffer, int Line_length, int &nPosition, int& nValue)//Buffer,Length of line,Position,ReturnValue
{
wchar_t pwzNumber[20];
bool bResult = ReadNumber(Text_Buffer, Line_length, nPosition, pwzNumber);
nValue = (bResult) ? _wtoi(pwzNumber) : 0;
return bResult;
}
示例9: ReadChar
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
bool ReadChar(fielddef_t * fd, void *p)
{
idToken token;
idLexer parser;
idStr string;
if(!parser.ExpectAnyToken(&token))
{
return false;
}
//take literals into account
if(token.type == TT_LITERAL)
{
string.StripQuotes();
*(char *)p = token.string[0];
} //end if
else
{
parser.UnreadToken(&token);
if(!ReadNumber(fd, p))
{
return false;
}
} //end if
return true;
} //end of the function ReadChar
示例10: GetDataPointer
std::shared_ptr<CLuaArgument> CAccount::GetData(const std::string& strKey)
{
CAccountData* pData = GetDataPointer(strKey);
auto pResult = std::make_shared<CLuaArgument>();
if (pData)
{
if (pData->GetType() == LUA_TBOOLEAN)
{
pResult->ReadBool(pData->GetStrValue() == "true");
}
else if (pData->GetType() == LUA_TNUMBER)
{
pResult->ReadNumber(strtod(pData->GetStrValue().c_str(), NULL));
}
else
{
pResult->ReadString(pData->GetStrValue());
}
}
else
{
pResult->ReadBool(false);
}
return pResult;
}
示例11: ReadNumber
CNum CInByte2::ReadNum()
{
UInt64 value = ReadNumber();
if (value > kNumMax)
ThrowUnsupported();
return (CNum)value;
}
示例12: main
int main (void)
{
unsigned long tmp;
tmp = (ReadNumber() & 0x0ff0L) >> 4;
DisplayNumber (tmp);
return 0;
}
示例13: ReadTimestampComponent
void Datum::Reader::ReadTimestamp() {
auto r = ReadTimestampComponent('-', "year");
if(!r.first) return;
long y = r.second;
r = ReadTimestampComponent('-', "month");
if(!r.first) return;
long m = r.second;
r = ReadTimestampComponent('T', "day");
if(!r.first) return;
long d = r.second;
r = ReadTimestampComponent(':', "hour");
if(!r.first) return;
long h = r.second;
r = ReadTimestampComponent(':', "minute");
if(!r.first) return;
long minute = r.second;
ReadNumber();
if(Red == nullptr)
return;
const Num* seconds = dynamic_cast<Num*>(Red.get());
if(seconds == nullptr) {
AddError("seconds were non-numeric");
return; }
long long s = seconds->Truncate();
long double f = seconds->Fraction();
Red.reset(new Timestamp(y, m, d, h, minute, (long)s, (double)f));
return; }
示例14: ReadChar
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
qboolean ReadChar( source_t *source, fielddef_t *fd, void *p )
{
token_t token;
if ( !PC_ExpectAnyToken( source, &token ) )
{
return 0;
}
//take literals into account
if ( token.type == TT_LITERAL )
{
StripSingleQuotes( token.string );
* ( char * ) p = token.string[ 0 ];
} //end if
else
{
PC_UnreadLastToken( source );
if ( !ReadNumber( source, fd, p ) )
{
return 0;
}
} //end if
return 1;
} //end of the function ReadChar
示例15: ParsePayloadHeader
void ParsePayloadHeader( uint8_t flags )
{
printf( "\tParsing payload parsing information...\n" );
bool multiplePayloads = (flags & BIT( 0 )) != 0;
int sequenceType = (flags & (BIT( 1 ) | BIT( 2 ))) >> 1;
int paddingLengthType = (flags & (BIT( 3 ) | BIT( 4 ))) >> 3;
int packetLengthType = (flags & (BIT( 5 ) | BIT( 6 ))) >> 5;
bool ecPresent = (flags & BIT( 7 )) != 0;
printf( "\tMultiple Payloads %s\n", multiplePayloads ? "yes" : "no" );
printf( "\tSequence type: %d\n", sequenceType );
printf( "\tPadding length type: %d\n", paddingLengthType );
printf( "\tPacket length type: %d\n", packetLengthType );
printf( "\tEC present: %s\n", ecPresent ? "yes" : "no" );
uint8_t propertyFlags = ReadByte();
ParseInfo info;
info.repDataLengthType = propertyFlags & (BIT( 0 ) | BIT( 1 ));
info.offsetLengthType = (propertyFlags & (BIT( 2 ) | BIT( 3 ))) >> 2;
info.objectNumberLengthType = (propertyFlags & (BIT( 4 ) | BIT( 5 ))) >> 4;
int streamNumberLengthType = (propertyFlags & (BIT( 6 ) | BIT( 7 ))) >> 6;
printf( "\tRepl. data length type %d\n", info.repDataLengthType );
printf( "\tOffset into media object length type %d\n", info.offsetLengthType );
printf( "\tMedia object number lengtht type %d\n", info.objectNumberLengthType );
printf( "\tStream Number Length Type %d\n", streamNumberLengthType );
uint32_t packetLength = ReadNumber( packetLengthType );
printf( "\tPacket length: %d\n", packetLength );
uint32_t sequence = ReadNumber( sequenceType );
printf( "\tSequence number: %d\n", sequence );
uint32_t paddingLength = ReadNumber( paddingLengthType );
printf( "\tPadding length: %d\n", paddingLength );
uint32_t sendTime = ReadDWord();
printf( "\tSend time: %d\n", sendTime );
uint16_t duration = ReadWord();
printf( "\tDuration: %d\n", duration );
if (multiplePayloads) ParseMultiplePayloads( &info );
else ParsePayload( &info );
}