本文整理汇总了C++中ds函数的典型用法代码示例。如果您正苦于以下问题:C++ ds函数的具体用法?C++ ds怎么用?C++ ds使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ds函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: ds
void RemoteClient::readHeader()
{
QDataStream ds(&m_buffer, QIODevice::ReadOnly);
qint32 type;
ds >> type;
ds >> m_msgSize;
switch (type)
{
case RemoteControl::Sync:
cmd = new RemoteControls::Sync(this);
break;
default:
m_sock->close();
return;
}
cmd->setManager(m_manager);
m_header = true;
}
开发者ID:aither64,项目名称:haveclip-core,代码行数:23,代码来源:RemoteClient.cpp
示例2: ds
void Server::handleData(QTcpSocket* socket, QByteArray data) {
QDataStream ds(&data, QIODevice::ReadWrite);
WhiteNetwork::Message type;
ds >> type;
if(type == WhiteNetwork::Message::RegisterClient) {
client_socket = socket;
qDebug() << "Client";
start_time = std::chrono::system_clock::now();
sendJobs();
}
else if(type == WhiteNetwork::Message::RegisterWorker) {
workers_sockets.push_back(socket);
qDebug() << "Worker";
}
else if(type == WhiteNetwork::Message::PixelsData) {
collectResult(ds);
}
else if(type == WhiteNetwork::Message::JobDone) {
sendJob(socket);
}
}
开发者ID:ghostec,项目名称:White2,代码行数:23,代码来源:Server.cpp
示例3: dr
bool ON_SpaceMorph::Ev1Der(
ON_3dPoint rst,
ON_3dPoint& xyz,
ON_3dVector& Dr,
ON_3dVector& Ds,
ON_3dVector& Dt
) const
{
// This is a quick estimate of the derivative.
// Space morphs that are used to deform smooth breps
// should override this function.
double d = 1.0e-6;
double e = 1.0/d;
ON_3dPoint P;
ON_3dPoint dr(rst.x+d,rst.y,rst.z);
ON_3dPoint ds(rst.x,rst.y+d,rst.z);
ON_3dPoint dt(rst.x,rst.y,rst.z+d);
P = MorphPoint(rst);
Dr = e*(MorphPoint(dr) - P);
Ds = e*(MorphPoint(ds) - P);
Dt = e*(MorphPoint(dt) - P);
return true;
}
开发者ID:Bastl34,项目名称:PCL,代码行数:23,代码来源:opennurbs_morph.cpp
示例4: file
void FQTermHttp::httpRead(qint64 done, qint64 total) {
QByteArray ba = netreply_->readAll();
QFile file(cacheFileName_);
if (file.open(QIODevice::ReadWrite | QIODevice::Append)) {
QDataStream ds(&file);
ds.writeRawData(ba, ba.size());
file.close();
}
if (total != 0) {
//m_pDialog->setProgress(done,total);
int p = done *100 / total;
if (p - lastPercent_ >= 10 && isPreview_ && QFileInfo(cacheFileName_).suffix().toLower() == "jpg") {
if (!previewEmitted) {
emit previewImage(cacheFileName_,true, false);
previewEmitted = true;
} else {
emit previewImage(cacheFileName_,false, false);
}
lastPercent_ = p;
}
emit percent(p);
}
}
开发者ID:ashang,项目名称:fqterm,代码行数:23,代码来源:fqterm_http.cpp
示例5: write_attribute
inline typename boost::enable_if<boost::mpl::and_<is_array<T>, boost::is_fundamental<typename T::value_type> >, void>::type
write_attribute(H5::H5Object const& object, std::string const& name, T const& value)
{
typedef typename T::value_type value_type;
enum { size = T::static_size };
H5::Attribute attr;
try {
H5XX_NO_AUTO_PRINT(H5::AttributeIException);
attr = object.openAttribute(name);
if (!has_type<T>(attr) || !has_extent<T>(attr)) {
// recreate attribute with proper type and size
object.removeAttr(name);
throw H5::AttributeIException();
}
}
catch (H5::AttributeIException const&) {
hsize_t dim[1] = { size };
H5::DataSpace ds(1, dim);
attr = object.createAttribute(name, ctype<value_type>::hid(), ds);
}
attr.write(ctype<value_type>::hid(), &*value.begin());
}
开发者ID:jb--,项目名称:h5xx,代码行数:23,代码来源:attribute.hpp
示例6: main
int main(int argv, char** args) {
QApplication app(argv, args);
QLocalSocket sock;
QObject::connect(&sock, &QLocalSocket::readyRead, [&sock]() {
qint64 bytesAvailable = sock.bytesAvailable();
QByteArray buffer = sock.readAll();
QDataStream ds(buffer);
while (bytesAvailable > 0) {
int num;
ds >> num;
qDebug("received %d", num);
bytesAvailable -= 4;
if (num == 1) {
sendData(sock, 2);
sendData(sock, -1);
} else if (num == 3) {
sendData(sock, -3);
}
}
});
开发者ID:shinichy,项目名称:qt-test,代码行数:23,代码来源:main.cpp
示例7: ds
Foam::scalar Foam::equationReader::getScalarSrcDictSourceDScalar
(
const equationReader * eqnReader,
const label equationIndex,
const label equationOperationIndex,
const label maxStoreIndex,
const label storageOffset
) const
{
dimensionedScalar ds("noSource", dimless, 0.0);
const equation& eqn(operator[](equationIndex));
const equationOperation& eqOp(eqn[equationOperationIndex]);
label zeroSourceIndex = mag(eqOp.sourceIndex()) - 1;
word varName(dictLookups_[eqOp.dictLookupIndex()]);
ITstream srcStrm
(
dictSources_[zeroSourceIndex].lookup(varName)
);
srcStrm >> ds;
return ds.value() * sign(eqOp.sourceIndex());
}
开发者ID:Marupio,项目名称:equationReader,代码行数:23,代码来源:equationReaderGetSourceScalarP.C
示例8: infoFile
bool QDSDataStore::add( const QUniqueId& id )
{
// Update info file (in an atomic fashion)
QDSLockedFile infoFile( infoFileName( id ) );
if ( !infoFile.exists() ) {
qLog(DataSharing) << "QDSDataStore::add - info file doesn't exist";
return false;
}
int refCount = 0;
int transCount = 0;
QString type;
if ( infoFile.openLocked( QIODevice::ReadWrite ) ) {
QDataStream ds(&infoFile);
ds >> refCount;
ds >> transCount;
ds >> type;
infoFile.seek( 0 );
ds << refCount + 1;
ds << transCount;
ds << type;
infoFile.close();
} else {
开发者ID:Camelek,项目名称:qtmoko,代码行数:23,代码来源:qdsdata.cpp
示例9: OpenImageGroup
/* decoded base64 stream to put on mysql row , file or network streams */
QList<SPics> OpenImageGroup( const QString datastream_base64 )
{
QList<SPics> li;
QByteArray xcode("");
xcode.append(datastream_base64);
quint32 magic, version;
QByteArray bytes(QByteArray::fromBase64(xcode)); /* decoded base64 string to QByteArray */
QBuffer buffer(&bytes);
if (!buffer.open(QIODevice::ReadOnly)) {
return li;
}
QDataStream ds(&buffer);
/* place header */
ds.setVersion(QDataStream::Qt_4_2);
ds >> magic;
if ( (quint32)SPics::MAGICNUMBER != magic ) {
qDebug() << "######## SPics::MAGICNUMBER not ok ";
buffer.close();
return li;
}
ds >> version;
if ( (quint32)SPics::VERSION != version ) {
qDebug() << "######## SPics::VERSION not ok ";
buffer.close();
return li;
}
SPics appoint;
/* place header */
while (!ds.atEnd()) {
ds >> appoint;
li.append(appoint);
}
buffer.close();
return li;
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:38,代码来源:_Image_Page_Struct.cpp
示例10: cmd_dynsym
/**
* Display the dynamic symbol table
*/
int cmd_dynsym()
{
elfshsect_t *sct;
elfsh_Sym *dynsym;
regex_t *tmp;
int num;
char logbuf[BUFSIZ];
PROFILER_IN(__FILE__, __FUNCTION__, __LINE__);
dynsym = elfsh_get_dynsymtab(world.curjob->curfile, &num);
if (dynsym == NULL)
RET(-1);
else
{
sct = elfsh_get_section_by_name(world.curjob->curfile,
ELFSH_SECTION_NAME_ALTDYNSYM,
NULL, NULL, &num);
if (!sct)
sct = elfsh_get_section_by_type(world.curjob->curfile, SHT_DYNSYM, 0,
NULL, NULL, &num);
if (!sct)
RET(-1);
num = num / sizeof(elfsh_Sym);
}
snprintf(logbuf, BUFSIZ - 1,
" [DYNAMIC SYMBOL TABLE]\n [Object %s]\n [Section %s]\n",
world.curjob->curfile->name, sct->name);
revm_output(logbuf);
FIRSTREGX(tmp);
PROFILER_ROUT(__FILE__, __FUNCTION__, __LINE__,
ds(world.curjob->curfile, sct,
num, tmp, elfsh_get_dynsymbol_name));
}
开发者ID:LucaBongiorni,项目名称:poly-engine,代码行数:40,代码来源:sym.c
示例11: main
int main(int argc, char **argv)
{
if (!parse_arg(argc, argv)) {
print_help(argc, argv);
return EXIT_FAILURE;
}
// libMesh::LibMeshInit init(argc, argv);
libMesh::LibMeshInit init(1, argv); // set argc to 1 to supress PETSc warnings.
Condor2Dataset ds(init.comm());
ds.PrintInfo();
ds.OpenDataFile(filename_in);
if (!ds.Valid()) {
fprintf(stderr, "Invalid input data.\n");
return EXIT_FAILURE;
}
VortexExtractor extractor;
extractor.SetDataset(&ds);
extractor.SetGaugeTransformation(!nogauge);
ds.LoadTimeStep(T0, 0);
extractor.ExtractFaces(0);
for (int t=T0+span; t<T0+T; t+=span) {
ds.LoadTimeStep(t, 1);
extractor.ExtractEdges();
extractor.ExtractFaces(1);
extractor.RotateTimeSteps();
// extractor.TraceOverTime();
// extractor.TraceVirtualCells();
// extractor.SaveVortexLines(filename_out);
}
return EXIT_SUCCESS;
}
开发者ID:ResearchEngr,项目名称:vortexfinder2,代码行数:37,代码来源:ex_condor2.cpp
示例12: ds
void kio_digikamdates::special(const QByteArray& data)
{
bool folders = (metaData("folders") == "true");
KUrl kurl;
QString filter;
QDataStream ds(data);
ds >> kurl;
kDebug() << "Entered kio_digikamdates::special";
Digikam::DatabaseParameters dbParameters(kurl);
QDBusConnection::sessionBus().registerService(QString("org.kde.digikam.KIO-digikamtags-%1")
.arg(QString::number(QCoreApplication::instance()->applicationPid())));
Digikam::DatabaseAccess::setParameters(dbParameters);
if (folders)
{
QMap<QDateTime, int> dateNumberMap = Digikam::DatabaseAccess().db()->getAllCreationDatesAndNumberOfImages();
QByteArray ba;
QDataStream os(&ba, QIODevice::WriteOnly);
os << dateNumberMap;
SlaveBase::data(ba);
}
else
{
Digikam::ImageLister lister;
lister.setListOnlyAvailable(metaData("listOnlyAvailableImages") == "true");
// send data every 200 images to be more responsive
Digikam::ImageListerSlaveBasePartsSendingReceiver receiver(this, 200);
lister.list(&receiver, kurl);
// send rest
receiver.sendData();
}
finished();
}
开发者ID:rickysarraf,项目名称:digikam,代码行数:37,代码来源:digikamdates.cpp
示例13: tr
QString QcepDatasetModel::indexDescription(const QModelIndex &index) const
{
if (index.isValid()) {
QcepDataObject* obj = static_cast<QcepDataObject*>(index.internalPointer());
if (obj) {
return tr("(%1,%2,\"%3\")")
.arg(index.row()).arg(index.column())
.arg(obj->get_Name());
} else {
QcepDatasetPtr ds(m_Dataset);
if (ds) {
return tr("(%1,%2,\"%3\")")
.arg(index.row()).arg(index.column())
.arg(ds->get_Name());
} else {
return "";
}
}
}
return tr("(%1,%2,null)").arg(index.row()).arg(index.column());
}
开发者ID:guyjennings,项目名称:qceplib,代码行数:24,代码来源:qcepdatasetmodel.cpp
示例14: main
int main()
{
mem_fun_name::value.reserve(100);
mem_fun_email::value.reserve(100);
benchmark::Person t;
t.set_id(100);
t.set_name("Name");
t.set_email("[email protected]");
aj::deserializer<> ds;
fas::nanospan start = fas::process_nanotime();
for (size_t i = 0; i < TOTAL_OP; ++i)
{
*( ds( fasproto_json(), t, fas::range(buffer) ) )='\0';
}
fas::nanospan finish = fas::process_nanotime();
std::cout << finish - start;
std::clog << std::endl
<< t.id() << std::endl
<< t.name() << std::endl
<< t.email() << std::endl;
return 0;
}
开发者ID:migashko,项目名称:faslib-sandbox,代码行数:24,代码来源:fasproto_do.cpp
示例15: ds
// constructor from data
void LagrangianDSTest::testBuildLagrangianDS5()
{
std::cout << "--> Test: constructor 5." <<std::endl;
std::string plugin = "TestPlugin:computeMass";
SP::DynamicalSystem ds(new LagrangianDS(13, *q0, *velocity0, plugin));
double time = 1.5;
ds->initialize("TimeStepping", time);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5A : ", Type::value(*ds) == Type::LagrangianDS, true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5B : ", ds->number() == 13, true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5D : ", std11::static_pointer_cast<LagrangianDS>(ds)->getNdof() == 3, true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5L : ", std11::static_pointer_cast<LagrangianDS>(ds)->getMass() == (*mass), true);
map<string, bool> isPl = ds->getIsPlugin();
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5M : ", isPl["mass"], true);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5Q : ", isPl["fExt"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5R : ", isPl["fInt"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5S : ", isPl["fGyr"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5T : ", isPl["jacobianFIntq"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5T : ", isPl["jacobianFIntVelocity"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5T : ", isPl["jacobianFGyrq"], false);
CPPUNIT_ASSERT_EQUAL_MESSAGE("testBuildLagrangianDS5T : ", isPl["jacobianFGyrVelocity"], false);
std::cout << "--> Constructor 5 test ended with success." <<std::endl;
}
开发者ID:bremond,项目名称:siconos,代码行数:25,代码来源:LagrangianDSTest.cpp
示例16: SaveRichDoc
QString SaveRichDoc( RichDoc e )
{
QByteArray bytes;
QBuffer buffer(&bytes);
if (!buffer.open(QIODevice::WriteOnly)) {
return QString();
}
QDataStream ds(&buffer);
/* place header */
ds.setVersion(QDataStream::Qt_4_2);
ds << (quint32)RichDoc::MAGICNUMBER;
ds << (quint32)RichDoc::VERSION;
/* place header */
ds << e.html;
ds << e.style;
QMapIterator<QString,SPics> i(e.resource);
while (i.hasNext()) {
i.next();
SPics record = i.value();
ds << record;
}
buffer.close();
return bytes.toBase64();
}
开发者ID:SorinS,项目名称:fop-miniscribus,代码行数:24,代码来源:_Image_Page_Struct.cpp
示例17: QStringLiteral
void TestQgsField::dataStream()
{
QgsField original;
original.setName( QStringLiteral( "name" ) );
original.setType( QVariant::Int );
original.setLength( 5 );
original.setPrecision( 2 );
original.setTypeName( QStringLiteral( "typename1" ) );
original.setComment( QStringLiteral( "comment1" ) );
original.setAlias( QStringLiteral( "alias" ) );
original.setDefaultValueExpression( QStringLiteral( "default" ) );
QByteArray ba;
QDataStream ds( &ba, QIODevice::ReadWrite );
ds << original;
QgsField result;
ds.device()->seek( 0 );
ds >> result;
QCOMPARE( result, original );
QCOMPARE( result.typeName(), original.typeName() ); //typename is NOT required for equality
QCOMPARE( result.comment(), original.comment() ); //comment is NOT required for equality
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:24,代码来源:testqgsfield.cpp
示例18: TQT_SLOT
void
KUniqueApplication::processDelayed()
{
if (dcopClient()->isSuspended())
{
// Try again later.
TQTimer::singleShot( 200, this, TQT_SLOT(processDelayed()));
return;
}
d->processingRequest = true;
while( !d->requestList.isEmpty() )
{
DCOPRequest *request = d->requestList.take(0);
TQByteArray replyData;
TQCString replyType;
if (request->fun == "newInstance()") {
dcopClient()->setPriorityCall(false);
TQDataStream ds(request->data, IO_ReadOnly);
TDECmdLineArgs::loadAppArgs(ds);
if( !ds.atEnd()) // backwards compatibility
{
TQCString asn_id;
ds >> asn_id;
setStartupId( asn_id );
}
s_handleAutoStarted = false;
int exitCode = newInstance();
d->firstInstance = false;
#if defined Q_WS_X11
if( s_handleAutoStarted )
TDEStartupInfo::handleAutoAppStartedSending(); // KDE4 remove?
#endif
TQDataStream rs(replyData, IO_WriteOnly);
rs << exitCode;
replyType = "int";
}
开发者ID:Fat-Zer,项目名称:tdelibs,代码行数:36,代码来源:kuniqueapplication.cpp
示例19: operator
R operator()(T& t, R r )
{
typedef typename T::aspect::template advice_cast<_deserializer_>::type deserializer;
deserializer ds;
//#warning: TODO: выбор объекта по типу range
raw_object obj;
r = ds(raw_object_json(), obj, r);
if ( ds && obj.is_valid() )
{
t.get_aspect().template get<_process_object_>()(t, obj);
}
else if ( obj.has_id() )
{
t.get_aspect().template get<_invalid_request_>()(t, obj.id );
}
else
{
t.get_aspect().template get<_invalid_request_>()(t);
}
return r;
}
开发者ID:migashko,项目名称:faslib-sandbox,代码行数:24,代码来源:ad_parse_object.hpp
示例20: _parse
/*
** Parse command line and setup argc and argv.
** Must be executed with es == psp
*/
_parse() {
char *ptr;
#asm
mov cl,es:[80h] ; get parameter string length
mov ch,0
push cx ; save it
inc cx
push cx ; 1st __alloc() arg
mov ax,1
push ax ; 2nd __alloc() arg
call __alloc ; allocate zeroed memory for args
add sp,4
mov [bp-2],ax ; ptr = addr of allocated memory
pop cx
push es ; exchange
push ds ; es (source)
pop es ; and
pop ds ; ds (destination)
mov si,81h ; source offset
mov di,[bp-2] ; destination offset
rep movsb ; move string
mov al,0
stosb ; terminate with null byte
push es
pop ds ; restore ds
#endasm
_vec[0]=_arg1; /* first arg = "*" */
while (*ptr) {
if(isspace(*ptr)) {++ptr; continue;}
if(_cnt < 20) _vec[_cnt++] = ptr;
while(*ptr) {
if(isspace(*ptr)) {*ptr = NULL; ++ptr; break;}
++ptr;
}
}
}
开发者ID:Paolo-Maffei,项目名称:PDP8-SmallC,代码行数:40,代码来源:csyslib.c
注:本文中的ds函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论