本文整理汇总了C++中ReadNumber函数的典型用法代码示例。如果您正苦于以下问题:C++ ReadNumber函数的具体用法?C++ ReadNumber怎么用?C++ ReadNumber使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ReadNumber函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:Open-Transactions,项目名称:lucre,代码行数:29,代码来源:coin-unblind.cpp
示例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 );
}
开发者ID:5sw,项目名称:stuff,代码行数:33,代码来源:asf.c
示例3: main
int main()
{
int a = ReadNumber();
int b = ReadNumber();
WriteAnswer(a + b);
return 0;
}
开发者ID:NitinSingh2020,项目名称:C-Plus-Plus,代码行数:7,代码来源:quiz3.cpp
示例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;
}
开发者ID:4auka,项目名称:opencv,代码行数:59,代码来源:grfmt_pxm.cpp
示例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;
}
开发者ID:kuailexs,项目名称:symbiandump-os2,代码行数:9,代码来源:TMCODE.CPP
示例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();
}
开发者ID:1974kpkpkp,项目名称:Open-Transactions,代码行数:10,代码来源:bankimp.cpp
示例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;
}
开发者ID:SummerSnail2014,项目名称:haiku,代码行数:10,代码来源:disasm.cpp
示例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;
}
开发者ID:nikola-spasojevic,项目名称:SpectralProfiling,代码行数:7,代码来源:Text_Reading.cpp
示例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
开发者ID:TheDushan,项目名称:OpenWolf,代码行数:33,代码来源:l_struct.cpp
示例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;
}
开发者ID:Audifire,项目名称:mtasa-blue,代码行数:26,代码来源:CAccount.cpp
示例11: ReadNumber
CNum CInByte2::ReadNum()
{
UInt64 value = ReadNumber();
if (value > kNumMax)
ThrowUnsupported();
return (CNum)value;
}
开发者ID:0963682490,项目名称:omaha,代码行数:7,代码来源:7zIn.cpp
示例12: main
int main (void)
{
unsigned long tmp;
tmp = (ReadNumber() & 0x0ff0L) >> 4;
DisplayNumber (tmp);
return 0;
}
开发者ID:BigEd,项目名称:snes-sdk,代码行数:7,代码来源:20031216-1.c
示例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; }
开发者ID:kumoyuki,项目名称:WarpSolve,代码行数:35,代码来源:SExp.cpp
示例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
开发者ID:SHOVELL,项目名称:Unvanquished,代码行数:33,代码来源:l_struct.c
示例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 );
}
开发者ID:5sw,项目名称:stuff,代码行数:46,代码来源:asf.c
示例16: SkipData
static SRes SkipData(CSzData *sd)
{
UInt64 size;
RINOK(ReadNumber(sd, &size));
if (size > sd->Size)
return SZ_ERROR_ARCHIVE;
SKIP_DATA(sd, size);
return SZ_OK;
}
开发者ID:670232921,项目名称:pfm_archive,代码行数:9,代码来源:7zArcIn.c
示例17: strtod
std::shared_ptr<CLuaArgument> CAccountManager::GetAccountData( CAccount* pAccount, const char* szKey )
{
if ( !pAccount->IsRegistered () )
{
return pAccount->GetData ( szKey );
}
// Check cache first
if ( pAccount->HasData ( szKey ) )
{
return pAccount->GetData ( szKey );
}
//Get the user ID
int iUserID = pAccount->GetID();
//create a new registry result for the query return
CRegistryResult result;
//Select the value and type from the database where the user is our user and the key is the required key
m_pDatabaseManager->QueryWithResultf ( m_hDbConnection, &result, "SELECT value,type from userdata where userid=? and key=? LIMIT 1", SQLITE_INTEGER, iUserID, SQLITE_TEXT, szKey );
// Default result is nil
auto pResult = std::make_shared<CLuaArgument> ();
//Do we have any results?
if ( result->nRows > 0 )
{
const CRegistryResultRow& row = result->Data.front();
const char* szValue = (const char *)row[0].pVal;
int iType = static_cast < int > ( row[1].nVal );
// Cache value for next get
pAccount->SetData ( szKey, szValue, iType );
//Account data is stored as text so we don't need to check what type it is just return it
if ( iType == LUA_TBOOLEAN )
{
SString strResult = szValue;
pResult->ReadBool ( strResult == "true" );
}
else
if ( iType == LUA_TNUMBER )
pResult->ReadNumber ( strtod ( szValue, NULL ) );
else
pResult->ReadString ( szValue );
}
else
{
//No results
pResult->ReadBool ( false );
}
return pResult;
}
开发者ID:ljnx86,项目名称:mtasa-blue,代码行数:55,代码来源:CAccountManager.cpp
示例18: ReadNumber
void CInArchive::ReadPackInfo(
UInt64 &dataOffset,
CRecordVector<UInt64> &packSizes,
CRecordVector<bool> &packCRCsDefined,
CRecordVector<UInt32> &packCRCs)
{
dataOffset = ReadNumber();
CNum numPackStreams = ReadNum();
WaitAttribute(NID::kSize);
packSizes.Clear();
packSizes.Reserve(numPackStreams);
for (CNum i = 0; i < numPackStreams; i++)
packSizes.Add(ReadNumber());
UInt64 type;
for (;;)
{
type = ReadID();
if (type == NID::kEnd)
break;
if (type == NID::kCRC)
{
ReadHashDigests(numPackStreams, packCRCsDefined, packCRCs);
continue;
}
SkeepData();
}
if (packCRCsDefined.IsEmpty())
{
packCRCsDefined.Reserve(numPackStreams);
packCRCsDefined.Clear();
packCRCs.Reserve(numPackStreams);
packCRCs.Clear();
for (CNum i = 0; i < numPackStreams; i++)
{
packCRCsDefined.Add(false);
packCRCs.Add(0);
}
}
}
开发者ID:bks,项目名称:qz7,代码行数:41,代码来源:7zIn.cpp
示例19: while
void TLexer::Read() {
char c;
std::string value = "";
while (true) {
c = GetChar();
if (FileEOF()) {
break;
}
value += c;
switch (c) {
case 34: {
ReadString(value);
break;
}
case 39: {
ReadSymbol(value);
break;
}
case '.' : {
FindToken(State_Point, value);
break;
}
case '(': {
FindToken(State_Lbkt,value);
break;
}
case ')': {
FindToken(State_Rbkt,value);
break;
}
case '#': {
ReadSharp(value);
break;
}
default: {
if (isspecial(c) || isalpha(c)) {
ReadIdent(value);
} else if (isdigit(c)) {
ReadNumber(value);
} else if (IsEndToken(c)) {
value.erase(value.size() - 1, value.size());
}
break;
}
}
}
value = "EOF";
FindToken(State_EOF, value);
}
开发者ID:Roninsc2,项目名称:for_scheme,代码行数:53,代码来源:lexer.cpp
示例20: WaitAttribute
void CInArchive::ReadUnpackInfo(
const CObjectVector<CByteBuffer> *dataVector,
CObjectVector<CFolder> &folders)
{
WaitAttribute(NID::kFolder);
CNum numFolders = ReadNum();
{
CStreamSwitch streamSwitch;
streamSwitch.Set(this, dataVector);
folders.Clear();
folders.Reserve(numFolders);
for (CNum i = 0; i < numFolders; i++)
{
folders.Add(CFolder());
GetNextFolderItem(folders.Back());
}
}
WaitAttribute(NID::kCodersUnpackSize);
CNum i;
for (i = 0; i < numFolders; i++)
{
CFolder &folder = folders[i];
CNum numOutStreams = folder.GetNumOutStreams();
folder.UnpackSizes.Reserve(numOutStreams);
for (CNum j = 0; j < numOutStreams; j++)
folder.UnpackSizes.Add(ReadNumber());
}
for (;;)
{
UInt64 type = ReadID();
if (type == NID::kEnd)
return;
if (type == NID::kCRC)
{
CBoolVector crcsDefined;
CRecordVector<UInt32> crcs;
ReadHashDigests(numFolders, crcsDefined, crcs);
for (i = 0; i < numFolders; i++)
{
CFolder &folder = folders[i];
folder.UnpackCRCDefined = crcsDefined[i];
folder.UnpackCRC = crcs[i];
}
continue;
}
SkipData();
}
}
开发者ID:0963682490,项目名称:omaha,代码行数:52,代码来源:7zIn.cpp
注:本文中的ReadNumber函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论