void HebrewKeyboardData::initMiddleKeySymbolCode() { const QChar chs[] = {'~', '<', '>', '|', '`', QChar(0x00A3), QChar(0x00A5), QChar(0x00A7), QChar(0x00A9), }; for (int i = 0; i < 9; i++) { ODataPtr dd(createData(chs[i])); middle_symbol_codes_.push_back(dd); } }
void HebrewKeyboardData::initBottomKeyCode() { const QChar chs[] = {'+', '-', '.', '"', ','}; for (int i=0; i<5; i++) { ODataPtr dd(createData(QString(chs[i]))); bottom_codes_.push_back(dd); } bottom_codes_.push_back(ODataPtr(createSpaceData())); bottom_codes_.push_back(ODataPtr(createBackspaceData())); const QChar chs_next[] = {'\'', ';'}; for (int i=0; i<2; i++) { ODataPtr dd(createData(QString(chs_next[i]))); bottom_codes_.push_back(dd); } bottom_codes_.push_back(ODataPtr(createEnterData())); }
//print stack. You have to print from the stack. You can not call a print function from dlinklist void printStack(struct stack *s) { // struct data* tDta = NULL; struct stack *tS = createStack(); while(!isEmptyStack(s)) { struct data* tDta = top(s); printData(tDta); pushStack(tS,createData(tDta->v1,tDta->v2)); popStack(s); } while(!isEmptyStack(tS)) { struct data* tDta = top(tS); pushStack(s,createData(tDta->v1,tDta->v2)); popStack(tS); } cleanStack(tS); }
void DownloadProxy::didFail(const ResourceError& error, const IPC::DataReference& resumeData) { if (!m_processPool) return; m_resumeData = createData(resumeData); m_processPool->downloadClient().didFail(m_processPool.get(), this, error); // This can cause the DownloadProxy object to be deleted. m_downloadProxyMap.downloadFinished(this); }
void PolishKeyboardData::initRightKeySymbolCode() { const QChar chs[] = {'_', '"', ',', QChar(0x00AD), '\'', ';', QChar(0x00AB), QChar(0x00BB)}; for (int i = 0; i < 8; i++) { ODataPtr dd(createData(QString(chs[i]))); right_symbol_codes_.push_back(dd); } right_symbol_codes_.push_back(ODataPtr(createEnterData())); }
void HebrewKeyboardData::initBottomKeyShiftCode() { const QChar chs[] = {'\\', '/', '[', ']', '='}; for (int i=0; i<5; i++) { ODataPtr dd(createData(QString(chs[i]))); bottom_shift_codes_.push_back(dd); } bottom_shift_codes_.push_back(ODataPtr(createSpaceData())); bottom_shift_codes_.push_back(ODataPtr(createBackspaceData())); const QChar chs_next[] = {'?', ':'}; for (int i=0; i<2; i++) { ODataPtr dd(createData(QString(chs_next[i]))); bottom_shift_codes_.push_back(dd); } bottom_shift_codes_.push_back(ODataPtr(createEnterData())); }
void printHeap(heap *h){ data **listCor = (data**)malloc(sizeof(data*)*10); int i = 0; while(h->root){ if(i>9){ popBack(h->q->ll); break; } leaf *rootleaf = removeRoot(h); #if DEBUG printf("removing data %f at %d \n",rootleaf->d->distance,i); #endif listCor[i] = createData(rootleaf->d->valx,rootleaf->d->valy); listCor[i]->distance = calculateDistance(listCor[i]->valx,listCor[i]->valy); if(h->root == rootleaf){ free(h->root->d); free(h->root); h->root = NULL; } else { free(rootleaf->d); free(rootleaf); } popBack(h->q->ll); i++; } for(i = 9;i>=0;i--){ printf(" %.2f %.2f %.2f \n",listCor[i]->distance,listCor[i]->valx,listCor[i]->valy); data *d = createData(listCor[i]->valx,listCor[i]->valy); d->distance = calculateDistance(d->valx,d->valy); addLeaf(h,d); free(listCor[i]); } free(listCor); }
ODataPtr OGroup::addData(Alembic::Util::uint64_t iNumData, const Alembic::Util::uint64_t * iSizes, const void ** iDatas) { ODataPtr child = createData(iNumData, iSizes, iDatas); if (child) { // flip top bit for data so we can easily distinguish between it and // a group mData->childVec.push_back(child->getPos() | 0x8000000000000000ULL); } return child; }
//![0] void SourceWidget::startDrag() { mimeData = new MimeData; connect(mimeData, SIGNAL(dataRequested(QString)), this, SLOT(createData(QString)), Qt::DirectConnection); QDrag *drag = new QDrag(this); drag->setMimeData(mimeData); drag->setPixmap(QPixmap(":/images/drag.png")); drag->exec(Qt::CopyAction); }
void RussianKeyboardData::initBottomKeyCode() { const QChar chs[] = {'.', ',', QChar(0x0437), QChar(0x0445), QChar(0x0434), ' '}; for (int i=0; i<6; i++) { ODataPtr dd(createData(QString(chs[i]))); bottom_codes_.push_back(dd); } ODataPtr dd(createBackspaceData()); bottom_codes_.push_back(dd); const QChar chs_next[] = {QChar(0x0436), QChar(0x044D)}; for (int i=0; i<2; i++) { ODataPtr dd(createData(QString(chs_next[i]))); bottom_codes_.push_back(dd); } bottom_codes_.push_back(ODataPtr(createEnterData())); }
void chooseSortTest(int len) { cout << " chooseSort" << endl; int* arr= createData(len); int start = clock(); insertSort(arr,len); int end = clock(); if (check(arr,len)) { cout << "sort successful! time:" << (end - start) << endl << endl; } }
bool operator==(const std::wstring& other) const { createData(); if ( (int)other.length() == length() ) { for(int i=0; i<length(); ++i) if ((*mString)[i] != other[i]) return false; return true; } else return false; }
void RussianKeyboardData::initBottomKeyShiftCode() { const QChar chs[] = {'\'', QChar(0x0445).toUpper(), QChar(0x044A).toUpper(), QChar(0x0451).toUpper(), QChar(0x0437).toUpper()}; for (int i=0; i<5; i++) { ODataPtr dd(createData(QString(chs[i]))); bottom_shift_codes_.push_back(dd); } bottom_shift_codes_.push_back(ODataPtr(createSpaceData())); ODataPtr dd(createBackspaceData()); bottom_shift_codes_.push_back(dd); const QChar chs_next[] = {QChar(0x0436).toUpper(), QChar(0x044D).toUpper()}; for (int i=0; i<2; i++) { ODataPtr dd (createData(QString(chs_next[i]))); bottom_shift_codes_.push_back(dd); } bottom_shift_codes_.push_back(ODataPtr(createEnterData())); }
bool CTcpDumpNode::data(QString gate_name, const CConstDataPointer &data) { // No need to track gates. Q_UNUSED(gate_name); if(data->getType() == "file") { QSharedPointer<const CFileData> file = data.staticCast<const CFileData>(); QSharedPointer<CTcpDumpData> tcpdump = QSharedPointer<CTcpDumpData>( static_cast<CTcpDumpData *>(createData("tcpdump"))); setProgress(0); tcpdump->setNodeReporter(this); tcpdump->parse(file->getBytes()); <<<<<<< HEAD
/*** * remove node from the front of the list and return the data element */ data *popBack(dlinklist *ll) { if(!checkEmpty(ll)) return NULL; data *returndata; if(ll->head == ll->tail) { node *deltemp =ll->head; ll->head = NULL; ll->tail = NULL; returndata = createData(deltemp->dataPtr->val); free(deltemp->dataPtr); free(deltemp); } else { node *deltemp = ll->tail; ll->tail = ll->tail->prev; ll->tail->next = NULL; returndata = createData(deltemp->dataPtr->val); free(deltemp->dataPtr); free(deltemp); } #if DEBUG printf(">>==============Node pop'd from back ================<<\n"); #endif return returndata; }
void PolishKeyboardData::initBottomKeyCode() { const QChar chs[] = {Polish_Character[1][1], Polish_Character[2][1], Polish_Character[3][1], Polish_Character[4][1], Polish_Character[5][1]}; for (int i=0; i<5; i++) { ODataPtr dd(createData(QString(chs[i]))); bottom_codes_.push_back(dd); } bottom_codes_.push_back(ODataPtr(createSpaceData())); bottom_codes_.push_back(ODataPtr(createBackspaceData())); const QChar chs_next[] = {Polish_Character[7][1], Polish_Character[8][1], Polish_Character[6][1]}; //{}; for (int i=0; i<3; i++) { ODataPtr dd(createData(QString(chs_next[i]))); bottom_codes_.push_back(dd); } //dd = createEnterData(); //bottom_codes_.push_back(dd); }
void HebrewKeyboardData::initLeftKeySymbolCode() { const QString chs[] = {"...", "{", "}", "www.", ",", "_", QString(QChar(0x00B9)), QString(QChar(0x00B2)), QString(QChar(0x00B3)), }; for (int i = 0; i < 9; i++) { ODataPtr dd(createData(chs[i])); if (chs[i].size() > 2) { dd->insert(TAG_FONT_SIZE, 16); } left_symbol_codes_.push_back(dd); } }
void Map::resetMap(int level,GameScene* parent){ curLevel = level; distance = 0; countDistance = false; startCur = false; curDis = 0; mapUp = false; if(&mapData == NULL){ mapData = vector<int>(); }else{ mapData.clear(); } createData(level); initMap(GameData::getLevel()); addMap(parent); }
int TestUndelete::execute() { bool lSuccess = true; if (MVTApp::startStore()) { mSession = MVTApp::startSession(); MVTApp::mapURIs(mSession, "TestUndelete.prop.", sNumProps, mPropIDs); createMeta(); createData(); doTest() ; mSession->terminate(); MVTApp::stopStore(); } else { TVERIFY(!"Unable to start store"); } return lSuccess?0:1; }
QSharedPointer<CTableData> CMawiLabelsNode::createTable() { QSharedPointer<CTableData> table_data( static_cast<CTableData*>(createData("table"))); // Set the contents of each table we will use. table_data->addHeader("number"); table_data->addHeader("type"); table_data->addHeader("value"); table_data->addHeader("from"); table_data->addHeader("to"); table_data->addHeader("src_ip"); table_data->addHeader("src_port"); table_data->addHeader("dst_ip"); table_data->addHeader("dst_port"); return table_data; }
bool CTcpStreamExtractorNode::start() { // Get some user parameters. QVariant payload_size = getConfig().getParameter("payload_size")->value; // Create a new Data Structure that will hold all data streams. m_tcp_streams = QSharedPointer<CTcpStreamsData>( static_cast<CTcpStreamsData *>(createData("tcpstreams"))); m_tcp_streams->setMaxPayloadSize(payload_size.toUInt()); if(!m_tcp_streams.isNull()) { return true; } else { return false; } }
/** createTask : add a task to task queue @head : the task queue ready to be inserted @url : new task's url **/ void createTask(cs_task_queue *head, char *url) { cs_task_t *task = (cs_task_t*)malloc(sizeof(cs_task_t)); PANIC(task); task->url = url; /*需要先新建一个存放数据的地方*/ task->data = createData(); cs_task_queue *queue = (cs_task_queue*)malloc(sizeof(cs_task_queue)); PANIC(queue); queue->task = task; queue->next = head; queue->prev = head->prev; queue->next->prev = queue; queue->prev->next = queue; return; }
node* searchLinklist(linklist* ll,float v){ int nodeCount = 0; data* tmpD = createData(0,0,0.0); node* tmpN = createNode(tmpD); for(tmpN = ll->head;tmpN != NULL;tmpN = tmpN->next){ nodeCount++; if(tmpN->dta->f1 == v){ printf("\n%.3f was located in node #%d\n\n",v,nodeCount); return tmpN; } } printf("\nProgram unable to locate %.3f\n\n",v); free(tmpN); return NULL; }
heap* getData(char *file){ FILE* input_file = fopen(file,"r"); if(input_file == NULL){ printf("Error opening input file %s\n",file); exit(1); } float inputx = 0.0; float inputy = 0.0; heap *newheap = createHeap(); int i = 0; while(fscanf(input_file, "%f", &inputx) != EOF){ fscanf(input_file, "%f", &inputy); data *d= createData(inputx,inputy); d->distance = calculateDistance(d->valx,d->valy); if(i>9){ if(d->distance < newheap->root->d->distance){ leaf *removeleaf = removeRoot(newheap); #if DEBUG printf("deleted : %f and inserted : %f -- \n",removeleaf->d->distance,d->distance); #endif popBack(newheap->q->ll); free(removeleaf->d); free(removeleaf); addLeaf(newheap,d); } else { #if DEBUG printf("Skipped : %f => ",d->distance); printf("deleting ...... \n"); #endif free(d); } } else { #if DEBUG printf("inserted : %f -- \n",d->distance); #endif addLeaf(newheap,d); } i++; } fclose(input_file); return newheap; }
bool DrawProfiler::loadSystemProperties() { bool changed = false; ProfileType newType = loadRequestedProfileType(); if (newType != mType) { mType = newType; if (mType == kNone) { destroyData(); } else { createData(); } changed = true; } bool showDirty = property_get_bool(PROPERTY_DEBUG_SHOW_DIRTY_REGIONS, false); if (showDirty != mShowDirtyRegions) { mShowDirtyRegions = showDirty; changed = true; } return changed; }
bool FrameInfoVisualizer::consumeProperties() { bool changed = false; ProfileType newType = Properties::getProfileType(); if (newType != mType) { mType = newType; if (mType == ProfileType::None) { destroyData(); } else { createData(); } changed = true; } bool showDirty = Properties::showDirtyRegions; if (showDirty != mShowDirtyRegions) { mShowDirtyRegions = showDirty; changed = true; } return changed; }
int main() { Data data; { Test test; std::cout << test.getData().integer << std::endl; data = test.getData(); } std::cout << data.integer << std::endl; data.integer = 3; std::cout << data.integer << std::endl; std::cout << createData().integer << std::endl; }
bool operator==(const String& other) const { if ( empty() && other.empty() ) return true; if ( empty() && !other.empty() ) return false; if ( !empty() && other.empty() ) return false; createData(); if (mString == other.mString) return true; else if ( other.length() == length() ) { return memcmp( ptr(), other.ptr(), sizeof(wchar_t)*length() ) == 0; } else return false; }
void RepeatedTimeData::updateRepetitions(bool forceUpdate) { RepeatedTimeDataParams* _params=dynamic_cast<RepeatedTimeDataParams*>(getDataParameters()); Q_ASSERT(_params); //Get the total time available for all the repetitions (including the first and orginal one) qreal _availableDuration=_params->maxDuration()-_params->t0()+_params->blankTime(); //Calculate one shot duration qreal _singleShotDuration=_params->duration()+_params->blankTime(); quint64 repetitions=qFloor(_availableDuration/(_singleShotDuration)); if(repetitions!=m_repetitions || forceUpdate) { m_repetitions=repetitions; PRINT_DEBUG_LEVEL(ErrorMessage::DEBUG_NOT_SO_IMPORTANT,ErrorMessage::DEBUG(Q_FUNC_INFO,"m_repetitions _availableDuration(%1)/_singleShotDuration(%2)=%3 repetitions (m_repetitions=%4)") .arg(_availableDuration) .arg(_singleShotDuration) .arg(_availableDuration/_singleShotDuration) .arg(m_repetitions)); //recall an update createData(); } else { PRINT_DEBUG_LEVEL(ErrorMessage::DEBUG_NOT_SO_IMPORTANT,ErrorMessage::DEBUG(Q_FUNC_INFO,"m_repetitions=%1 doesn't change").arg(m_repetitions)); } }
dlinklist *readData(char *filename,int addDirection) { FILE* input_file = fopen(filename,"r"); if(input_file == NULL) { printf("Error opening input file %s\n",filename); exit(1); } float value = 0.0; #if DEBUG printf(">>===============Creating dLinklist=================<<\n"); #endif dlinklist *newdlinklist = createlinklist(); while(fscanf(input_file, "%f", &value) != EOF) { data *newData = createData(value); addFront(newdlinklist,newData); } fclose(input_file); #if DEBUG printf(">>==============dLinklist Created=================<<\n\n"); #endif return newdlinklist; }