void object::test<1>() { set_test_name("empty modules"); setCode(), "module Asia;"; parse(); ensure_success(); ensure_equals("module name 1", module->name.str, "Asia"); ensure("module name position 1", module->name.pos == sl::FilePosition("", 1, 8)); ensure("no declarations 1", module->decls.empty()); setCode(), " ", " module ", " Kasia;", " "; parse(); ensure_success(); ensure_equals("module name 2", module->name.str, "Kasia"); ensure("module name position 2", module->name.pos == sl::FilePosition("", 3, 5)); ensure("no declarations 2", module->decls.empty()); }
//-------------------------------------------------------------- void ofApp::keyPressed(int key){ switch (key){ case 's': if (show_fps == true){ show_fps = false; } else{ show_fps = true; } break; case 'f': ofToggleFullscreen(); break; case 'k': bKaleidoscope = !bKaleidoscope; break; case '2': if(bKaleidoscope == true){ KaleidoscopeSlices+=2; if (KaleidoscopeSlices >= 100) KaleidoscopeSlices = 100; } break; case '1': if(bKaleidoscope == true){ KaleidoscopeSlices-=2; if (KaleidoscopeSlices < 2) KaleidoscopeSlices = 2; } break; case OF_KEY_UP: nFrag++; if (nFrag >= frags.size()) nFrag = 0; cout << endl << "--------" << endl << " Loading Frag: "<< nFrag+1 << endl << "--------" << endl; setCode(frags[nFrag]); break; case OF_KEY_DOWN: nFrag--; if (nFrag < 0) nFrag = frags.size()-1; cout << endl << "--------" << endl << " Loading Frag: "<< nFrag+1 << endl << "--------" << endl; setCode(frags[nFrag]); break; case 'r': resolPantalla++; if (resolPantalla == 3) resolPantalla = 4; if (resolPantalla > 4) resolPantalla = 1; cout << resolPantalla << endl; pingPong.allocate( resolHoriz/resolPantalla, resolVert/resolPantalla, GL_RGB); pingPong.swap(); break; case 'h': if (bHideCursor == true){ bHideCursor = false; ofShowCursor(); } else{ bHideCursor = true; ofHideCursor(); } break; } }
void uSQL::SQLError::clear() { setCode(-1); setLine(-1); setOffset(-1); setMessage(""); }
VerifyAddingMsgPacket & VerifyAddingMsgPacket::operator =( const VerifyAddingMsgPacket & rhs ) { *((OutPacket *)this) = (OutPacket)rhs; m_BuddyTQQNum = rhs.getBuddyQQ(); setCode(rhs.getCode(), rhs.getCodeLength()); return *this; }
void CodeLineEdit::insertVariable(const QString &variable) { //If a validator is set this means that the insertion will fail //In this case, reset the content and set the code mode if(validator()) { if(!text().isEmpty() && QMessageBox::question(this, tr("Insert variable/resource"), tr("Inserting a variable or a resource will replace the current parameter value.\nAre you sure?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) != QMessageBox::Yes) return; setCode(true); setText(QString()); } //Temporarily remove the completer so that we don't get a popup QCompleter *currentCompleter = completer(); if(currentCompleter) { currentCompleter->setParent(0); setCompleter(0); } if(isCode()) insert(variable); else insert("$" + variable); if(currentCompleter) { currentCompleter->setParent(this); setCompleter(currentCompleter); } }
bool PacmanSetupInfoReader::error(const QString & err) { if (err.startsWith("error: no operation specified")) { setCode(-1); clearErrorStreamCache(); } return true; }
std::shared_ptr<cs5400::Shader<T>> make_shader(std::string path) { auto code = getCode(path); auto shader = std::make_shared<cs5400::Shader<T>>(); setCode(shader->getHandle(),code); return shader; }
void CodeLineEdit::setFromSubParameter(const SubParameter &subParameter) { if(mAllowTextCodeChange) setCode(subParameter.isCode()); setText(subParameter.value().toString()); }
// oF < 0.8.1 does not have ofShader::getShaderSource, so we just cut // out some of the necessary code from ofShader to get the source in the // same way as ofShader::load did in version a90a782 (2014, April 10th.) // // Note that in this legacy mode, we don't support shader includes (as // ofShader does in 0.8.1). bool ofxFXObject::load(string path){ string vertName = path + ".vert"; string fragName = path + ".frag"; string frag = ""; string vert = ""; if (fragName.empty() == false){ ofBuffer buffer = ofBufferFromFile(fragName); frag = buffer.getText(); } if (vertName.empty() == false){ ofBuffer buffer = ofBufferFromFile(vertName); vert = buffer.getText(); } if (frag.empty() && vert.empty()){ ofLog(OF_LOG_ERROR, "Could not load shader from file " + path); return false; } bool loaded = setCode(frag, vert); if (loaded) shaderFilePath = path; return loaded; }
void OAuth::authorizationReceivedCode(QString url) { QUrl mUrl(url); // if you sent State, expect it! if (!m_state.isEmpty()) if (QString(mUrl.queryItemValue(OAUTH_STATE)) != QString(m_state)) { qDebug() << "[OAuth.onAuthorizationReceived] State did not match! Received: " << mUrl.queryItemValue(OAUTH_STATE); // TODO emit signal with error! return; } if (mUrl.queryItemValue(OAUTH_CODE).size() == 0) { return; } setCode(mUrl.queryItemValue(OAUTH_CODE)); settingsSaveCode(code()); m_running = false; getNewAccessToken(); setIsLinked(true); emit closeBrowser(); }
Node<FunctionNode>::Link FunctionParser::function(bool isForeign) { if (isForeign) skip(); // Skip "foreign" Trace trace = current().trace; skip(); // Skip "function" or "method" std::string ident = ""; FunctionSignature::Arguments args {}; std::unique_ptr<TypeInfo> returnType; // Is not anon func if (accept(TT::IDENTIFIER)) { ident = current().data; skip(); } if (isForeign && ident.empty()) throw Error("SyntaxError", "Foreign functions can't be anonymous", trace); // Has arguments if (accept(TT::SQPAREN_LEFT)) { skip(); args = getSigArgs(); } // Has return type if (accept(TT::FAT_ARROW)) { skip(); returnType = std::make_unique<TypeInfo>(getTypeList()); } auto func = Node<FunctionNode>::make(ident, FunctionSignature(returnType == nullptr ? nullptr : *returnType, args), isForeign); func->setTrace(trace); // Only non-foreign functions have code bodies if (!isForeign) func->setCode(block(FUNCTION_BLOCK)); // Foreign declarations end in semicolon if (isForeign) expectSemi(); return func; }
void IdaFrontend::createSections(core::image::Image *image) { for (int i = 0; i < get_segm_qty(); i++) { segment_t *idaSegment = getnseg(i); assert(idaSegment != NULL); char segName[MAXSTR]; ssize_t segNameSize = get_segm_name(idaSegment, segName, sizeof(segName) - 1); if(segNameSize < 0) { segName[0] = '\0'; } else if(segNameSize > 0 && segName[0] == '_') { segName[0] = '.'; } auto section = std::make_unique<core::image::Section>( segName, checked_cast<ByteAddr>(idaSegment->startEA), checked_cast<ByteSize>(idaSegment->size()) ); section->setReadable(idaSegment->perm & SEGPERM_READ); section->setWritable(idaSegment->perm & SEGPERM_WRITE); section->setExecutable(idaSegment->perm & SEGPERM_EXEC); section->setCode(idaSegment->type == SEG_CODE); section->setData(idaSegment->type == SEG_DATA); section->setBss(idaSegment->type == SEG_BSS); section->setAllocated(section->isCode() || section->isData() || section->isBss()); section->setExternalByteSource(std::make_unique<IdaByteSource>()); image->addSection(std::move(section)); } }
IOBooksInfo::IOBooksInfo() { setCardNumber(""); setCode(""); setODate(""); setIDate(""); setNext(NULL); setPrev(NULL); }
void PacmanSetupInfoReader::onFinished(int code,QProcess::ExitStatus status) { if (pacman_conf.isEmpty() || pacman_cache_dir.isEmpty() || pacman_lock_file.isEmpty() || pacman_db_path.isEmpty()) { setCode(1); addToErrorStreamCache(tr("QPacman: Cannot correctly parse the pacman's output!!!\n")); } PacmanProcessReader::onFinished(code,status); }
/** * @brief genere un nouveau code de devis l'applique à la class et retourn la valeur * @return code */ QString proposal::generateNewCode() { //Generation du code // TYPE + DATE + ID QString typp = tr("DE"); setCode( typp + QDateTime::currentDateTime().toString("yyMM") + QString::number(getLastId()+1) ); return m_code; }
void OAuth::loadFromSettings() { setExpireDateTime(settingsLoadExpiresDateTime()); setRefreshToken(settingsLoadRefreshToken()); setAccessToken(settingsLoadAccessToken()); setAccountUsername(settingsLoadUsername()); setIsLinked(refreshToken().length() > 0); setCode(settingsLoadCode()); }
ErrorData::ErrorData(int code, Location ocurrence, const IvaString& msg) { setCode(code); ocurrence_ = ocurrence; type_ = ERROR_TYPE_NONE; str(msg); time_ = NULL; };
ErrorData::ErrorData(int code, Location ocurrence) { setCode(code); ocurrence_ = ocurrence; type_ = ERROR_TYPE_NONE; str(""); time_ = NULL; };
// Constructor for parser function Message::Message(XmlStreamReader& xml) : QObject(), m_timeStamp(), m_timeStampPresent( false ), m_code( 0 ), m_codePresent( false ), m_version( "1.0.0" ), // initialize fixed value m_versionPresent( true ), m_changed(true) { QXmlStreamAttributes attr = xml.attributes(); if ( attr.hasAttribute( "TimeStamp" ) ) { if ( !setTimeStamp( QDateTime::fromString(attr.value( "TimeStamp" ).toString(), Qt::ISODate)) ) xml.validationError( "error set TimeStamp = " + attr.value( "TimeStamp" ).toString() ); } if ( attr.hasAttribute( "Code" ) ) { if ( !setCode( attr.value( "Code" ).toString().toInt() ) ) xml.validationError( "error set Code = " + attr.value( "Code" ).toString() ); } if ( attr.hasAttribute( "Version" ) ) { if ( !setVersion( attr.value( "Version" ).toString() ) ) xml.validationError( "error set Version = " + attr.value( "Version" ).toString() ); } bool stop(false); while(!xml.atEnd() && !stop) { QXmlStreamReader::TokenType token = xml.readNext(); switch ( token ) { case QXmlStreamReader::EndElement: if ( xml.name() == "Message" ) stop = true; break; case QXmlStreamReader::StartElement: if ( xml.name() == "Argument" ) { QString val = xml.readElementText(); if ( xml.name() != "Argument" ) xml.raiseError( "tag mismatch Argument" ); else if ( !addArgument( val ) ) xml.validationError( "error add Argument" ); } else { xml.validationError( "unexpected element " + xml.name().toString() ); } break; default: break; } } }
SystemNotificationPacket & SystemNotificationPacket::operator =( const SystemNotificationPacket & rhs ) { *((InPacket *)this) = (InPacket)rhs; type = rhs.getType(); myQQ = rhs.getMyQQ(); fromQQ = rhs.getFromQQ(); message = rhs.getMessage(); setCode(rhs.getCode(), rhs.getCodeLength()); m_AllowReverse = rhs.allowReverse(); return *this; }
ReceivedQunIMJoinRequest & ReceivedQunIMJoinRequest::operator =( const ReceivedQunIMJoinRequest & rhs ) { externalID = rhs.getExtID(); sender = rhs.getSender(); type = rhs.getType(); message = rhs.getMessage(); commander = rhs.getCommander(); setCode(rhs.getCode(), rhs.getCodeLength()); setToken(rhs.getToken(), rhs.getTokenLength()); return *this; }
void object::test<4>() { set_test_name("bad function names"); setCode(), "module Asia;", "bad+x() -> void { }"; parse(); ensure_failure(1); setCode(), "module Asia;", "123() -> void { }"; parse(); ensure_failure(1); }
void StationScheduleModel::fetch(const QString &name, const QString &code) { DataProvider *provider = DataProvider::instance(); if (!error().isEmpty()) setError(QString()); m_departureSchedules.clear(); m_arrivalSchedules.clear(); provider->fetchStationSchedule(name, code); setName(name); setCode(code); }
Node<MethodNode>::Link TypeParser::method(Visibility vis, bool isStatic, bool isForeign) { Trace methTrace = current().trace; auto parsedAsFunc = function(isForeign); auto methNode = Node<MethodNode>::make(parsedAsFunc->getIdentifier(), parsedAsFunc->getSignature(), vis, isStatic); methNode->setTrace(methTrace); if (isForeign) { expectSemi(); } else { methNode->setCode(Node<BlockNode>::staticPtrCast(parsedAsFunc->removeChild(0))); } return methNode; }
bool InteractiveInterpreter::canEvaluate() { int yyaction = 0; int yytoken = -1; int yytos = -1; setCode(m_code, 1); m_tokens.append(T_FEED_JS_PROGRAM); do { if (++yytos == m_stateStack.size()) m_stateStack.resize(m_stateStack.size() * 2); m_stateStack[yytos] = yyaction; again: if (yytoken == -1 && action_index[yyaction] != -TERMINAL_COUNT) { if (m_tokens.isEmpty()) yytoken = lex(); else yytoken = m_tokens.takeFirst(); } yyaction = t_action(yyaction, yytoken); if (yyaction > 0) { if (yyaction == ACCEPT_STATE) { --yytos; return true; } yytoken = -1; } else if (yyaction < 0) { const int ruleno = -yyaction - 1; yytos -= rhs[ruleno]; yyaction = nt_action(m_stateStack[yytos], lhs[ruleno] - TERMINAL_COUNT); } } while (yyaction); const int errorState = m_stateStack[yytos]; if (t_action(errorState, T_AUTOMATIC_SEMICOLON) && canInsertAutomaticSemicolon(yytoken)) { yyaction = errorState; m_tokens.prepend(yytoken); yytoken = T_SEMICOLON; goto again; } if (yytoken != EOF_SYMBOL) return true; return false; }
void OAuth::authorizationReceivedToken(QString url) { QUrl tmp(url); QUrl mUrl("?" + tmp.fragment()); // all info is in fragment, we have to transform it to be able to read // if you sent State, expect it! if (!m_state.isEmpty()) if (QString(mUrl.queryItemValue(OAUTH_STATE)) == QString(m_state)) { qDebug() << "[OAuth.onAuthorizationReceived] State did not match! Received: " << mUrl.queryItemValue(OAUTH_STATE); // TODO emit signal with error! return; } if (mUrl.queryItemValue(OAUTH_ACCESS_TOKEN).size() == 0) { return; } if (mUrl.queryItemValue(OAUTH_EXPIRES_IN).size() == 0) { return; } if (mUrl.queryItemValue(OAUTH_TOKEN_TYPE).size() == 0) { return; } // in some cases refresh token will not be received /*if (mUrl.queryItemValue(OAUTH_REFRESH_TOKEN).size() == 0) { return; }*/ setAccessToken(mUrl.queryItemValue(OAUTH_ACCESS_TOKEN)); setExpiresIn(mUrl.queryItemValue(OAUTH_EXPIRES_IN).toInt()); setTokenType(mUrl.queryItemValue(OAUTH_TOKEN_TYPE)); setRefreshToken(mUrl.queryItemValue(OAUTH_REFRESH_TOKEN)); setCode(mUrl.queryItemValue(OAUTH_CODE)); settingsSaveCode(code()); settingsSaveAccessToken(accessToken()); settingsSaveRefreshToken(refreshToken()); // Not considered important? if (mUrl.queryItemValue(OAUTH_ACCOUNT_USERNAME).size() > 0) { setAccountUsername(mUrl.queryItemValue(OAUTH_ACCOUNT_USERNAME)); settingsSaveUsername(accountUsername()); } setIsLinked(true); emit closeBrowser(); m_running = false; }
/** \brief Construct an abstract code. */ xtAbstractCode::xtAbstractCode() : xtStorable() { _data = new xtAbstractCodePrivate(this); setCode(QVariant()); setPropertyP("code", QVariant(true), xtlib::RequiredRole); setPropertyP("code", QVariant("Code"), xtlib::LabelRole); setPropertyP("code", QVariant::fromValue(xtFieldData("code", xtFieldData::String)), xtlib::FieldRole); setPropertyP("code", QVariant::fromValue(_data->notEmpty), xtlib::CheckerRole); setDescription(QVariant()); setPropertyP("description", QVariant("Description"), xtlib::LabelRole); setPropertyP("description", QVariant::fromValue(xtFieldData("descrip", xtFieldData::String)), xtlib::FieldRole); }
Book::Book(const string& aName, int aCode, double aPrice, int aRating, const string& aComment, const string& aAuthor, const string& aTitle, const string& aIsbn) : author(aAuthor), title(aTitle), isbn(aIsbn) // eigene Attribute { setName(aName); // Attribute der Basisklasse setCode(aCode); setPrice(aPrice); setRating(aRating); setComment(aComment); }
void ActivityItem::setProperty(QString role,QVariant value) { QHash<int, QByteArray> names = roleNames(); if(role == names[CodeRole]) setCode(value.toString()); else if(role == names[NameRole]) setName(value.toString()); else if(role == names[IconRole]) setIcon(value.toString()); else if(role == names[CStateRole]) setCState(value.toString()); else if(role == names[BackgroundRole]) setBackgrounds(value.toStringList()); else if(role == names[OrderRole]) setOrder(value.toInt()); }
bool ofxFXObject::load( string path ){ ofShader code_loader; code_loader.load(path); string frag = code_loader.getShaderSource(GL_FRAGMENT_SHADER); string vert = code_loader.getShaderSource(GL_VERTEX_SHADER); if (frag.empty() && vert.empty()){ ofLog(OF_LOG_ERROR, "Could not load shader from file " + path); return false; } bool loaded = setCode(frag, vert); if (loaded) shaderFilePath = path; return loaded; }