本文整理汇总了C++中KstDataSourcePtr::writeUnlock方法的典型用法代码示例。如果您正苦于以下问题:C++ KstDataSourcePtr::writeUnlock方法的具体用法?C++ KstDataSourcePtr::writeUnlock怎么用?C++ KstDataSourcePtr::writeUnlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstDataSourcePtr
的用法示例。
在下文中一共展示了KstDataSourcePtr::writeUnlock方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: samplesPerFrame
KJS::Value KstBindDataSource::samplesPerFrame(KJS::ExecState *exec, const KJS::List& args) {
if (args.size() != 1) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError, "Requires exactly one argument.");
exec->setException(eobj);
return KJS::Number(0);
}
if (args[0].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Number(0);
}
KstDataSourcePtr s = makeSource(_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Number(0);
}
s->writeLock();
int rc = s->samplesPerFrame(args[0].toString(exec).qstring());
s->writeUnlock();
return KJS::Number(rc);
}
示例2: frameCount
KJS::Value KstBindDataSource::frameCount(KJS::ExecState *exec, const KJS::List& args) {
QString field;
if (args.size() == 1) {
if (args[0].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Number(0);
}
field = args[0].toString(exec).qstring();
} else if (args.size() != 0) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError, "Requires at most one argument.");
exec->setException(eobj);
return KJS::Number(0);
}
KstDataSourcePtr s = makeSource(_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Number(0);
}
s->writeLock();
int rc = s->frameCount(field);
s->writeUnlock();
return KJS::Number(rc);
}
示例3: isValidField
KJS::Value KstBindDataSource::isValidField(KJS::ExecState *exec, const KJS::List& args) {
if (args.size() != 1) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError, "Requires exactly one argument.");
exec->setException(eobj);
return KJS::Boolean(false);
}
if (args[0].type() != KJS::StringType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Boolean(false);
}
KstDataSourcePtr s = makeSource(_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Boolean(false);
}
s->writeLock();
bool rc = s->isValidField(args[0].toString(exec).qstring());
s->writeUnlock();
return KJS::Boolean(rc);
}
示例4: while
const QString& KstIfaceImpl::loadVector(const QString& file, const QString& field) {
KstDataSourcePtr src;
/* generate or find the kstfile */
KST::dataSourceList.lock().writeLock();
KstDataSourceList::Iterator it = KST::dataSourceList.findFileName(file);
if (it == KST::dataSourceList.end()) {
src = KstDataSource::loadSource(file);
if (!src || !src->isValid()) {
KST::dataSourceList.lock().writeUnlock();
return QString::null;
}
if (src->frameCount() < 1) {
KST::dataSourceList.lock().writeUnlock();
return QString::null;
}
KST::dataSourceList.append(src);
} else {
src = *it;
}
src->writeLock();
KST::dataSourceList.lock().writeUnlock();
KST::vectorList.lock().readLock();
QString vname = "V" + QString::number(KST::vectorList.count() + 1);
while (KST::vectorTagNameNotUnique(vname, false)) {
vname = "V" + QString::number(KST::vectorList.count() + 1);
}
KST::vectorList.lock().readUnlock();
KstVectorPtr p = new KstRVector(src, field, vname, 0, -1, 0, false, false);
KST::addVectorToList(p);
src->writeUnlock();
if (p) {
_doc->forceUpdate();
_doc->setModified();
return p->tagName();
}
return QString::null;
}
示例5: changeFile
KJS::Value KstBindDataVector::changeFile(KJS::ExecState *exec, const KJS::List& args) {
KstRVectorPtr v = makeDataVector(_d);
if (!v) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Undefined();
}
if (args.size() != 1) {
KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError, "Requires exactly one argument.");
exec->setException(eobj);
return KJS::Undefined();
}
if (args[0].type() != KJS::ObjectType) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Undefined();
}
KstBindDataSource *imp = dynamic_cast<KstBindDataSource*>(args[0].toObject(exec).imp());
if (!imp) {
KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
exec->setException(eobj);
return KJS::Undefined();
}
#define makeSource(X) dynamic_cast<KstDataSource*>(const_cast<KstObject*>(X.data()))
KstDataSourcePtr s = makeSource(imp->_d);
if (!s) {
KJS::Object eobj = KJS::Error::create(exec, KJS::GeneralError);
exec->setException(eobj);
return KJS::Undefined();
}
v->writeLock();
s->writeLock();
v->changeFile(s);
s->writeUnlock();
v->writeUnlock();
#undef makeSource
return KJS::Undefined();
}
示例6: editSingleObjectRV
bool KstVectorDialogI::editSingleObjectRV(KstVectorPtr vcPtr) {
KstRVectorPtr rvp = kst_cast<KstRVector>(vcPtr);
KstDataSourcePtr file;
if (_fileNameDirty) {
/* if there is not an active KstFile, create one */
KST::dataSourceList.lock().writeLock();
KstDataSourceList::Iterator it = KST::dataSourceList.findReusableFileName(_w->FileName->url());
if (it == KST::dataSourceList.end()) {
file = KstDataSource::loadSource(_w->FileName->url());
if (!file || !file->isValid()) {
KST::dataSourceList.lock().writeUnlock();
KMessageBox::sorry(this, i18n("The file could not be opened."));
return false;
}
if (file->isEmpty()) {
KST::dataSourceList.lock().writeUnlock();
KMessageBox::sorry(this, i18n("The file does not contain data."));
return false;
}
KST::dataSourceList.append(file);
} else {
file = *it;
}
KST::dataSourceList.lock().writeUnlock();
} else {
KstRVectorList vcList = kstObjectSubList<KstVector,KstRVector>(KST::vectorList);
for (uint i = 0; i < _editMultipleWidget->_objectList->count(); i++) {
if (_editMultipleWidget->_objectList->isSelected(i)) {
// get the pointer to the object
KstRVectorList::Iterator vcIter = vcList.findTag(_editMultipleWidget->_objectList->text(i));
if (vcIter == vcList.end()) {
return false;
}
KstRVectorPtr rvp = *vcIter;
rvp->readLock();
file = rvp->dataSource();
rvp->readUnlock();
}
}
}
file->writeLock();
if (rvp) {
QString pField;
if (_fileNameDirty) {
pField = _w->Field->currentText();
if (!file->isValidField(pField)) {
KMessageBox::sorry(this, i18n("The requested field is not defined for the requested file."));
file->writeUnlock();
return false;
}
} else {
pField = rvp->field();
}
int f0 = 0, n = 0;
if (_f0Dirty) {
if (_w->_kstDataRange->isStartRelativeTime()) {
f0 = file->sampleForTime(_w->_kstDataRange->f0Value());
} else if (_w->_kstDataRange->isStartAbsoluteTime()) {
bool ok = false;
f0 = file->sampleForTime(_w->_kstDataRange->f0DateTimeValue(), &ok);
if (!ok) {
file->writeUnlock();
KMessageBox::sorry(this, i18n("The requested field or file could not use the specified date."));
return false;
}
} else {
f0 = int(_w->_kstDataRange->f0Value());
}
}
if (_nDirty) {
if (_w->_kstDataRange->isRangeRelativeTime()) {
double nValStored = _w->_kstDataRange->nValue();
if (_w->_kstDataRange->CountFromEnd->isChecked()) {
int frameCount = file->frameCount(_w->Field->currentText());
double msCount = file->relativeTimeForSample(frameCount - 1);
n = frameCount - 1 - file->sampleForTime(msCount - nValStored);
} else {
double fTime = file->relativeTimeForSample(f0);
n = file->sampleForTime(fTime + nValStored) - file->sampleForTime(fTime);
}
} else {
n = int(_w->_kstDataRange->nValue());
}
}
// use existing requested start and number of frames if not dirty
rvp->readLock();
if (!_f0Dirty) {
f0 = rvp->reqStartFrame();
}
if (!_nDirty) {
n = rvp->reqNumFrames();
}
// other parameters for multiple edit
bool pCountFromEnd, pReadToEnd, pDoSkip, pDoFilter;
int pSkip;
if (_countFromEndDirty) {
//.........这里部分代码省略.........