Ejemplo n.º 1
0
    Deferoxamine::Deferoxamine(double age, double height, double weight) : Antidote(age, height, weight) {
        string a = "Deferoxamine (iron toxicity) Antidote Algorithm ",
        b = string("For the treatment of acute iron toxicity.  ") + FDA + "\n\n",
        c = "\n (Mills KC, 1994) (Anderson, 1994) (Novartis, 2011)";
        insertToMap("ageLessThanThree", new Question(a + b + "Safety and effectiveness in pediatric patients under the age of " +
                                                     "3 years have not been established." + c));
        string *defOptions = new string[2];
        defOptions[0] =  "CV shock";
        defOptions[1] = "No CV complications";
        Question *isPatientCVShock = new Question("Is this patient in cardiovascular (CV) shock?");
        isPatientCVShock->setOptions(defOptions, 2);
        insertToMap("isPatientCVShock?", isPatientCVShock);
        insertToMap("give1GramIV", new Question(a + b + "Give 1gram IV every 4-8 hours if needed up to 6grams in 24 hours." + c));
        insertToMap("giveIVUpTo1", new Question(a + b + "Give " + toStr(weightkg * 40) + " mg to 1000mg IV every 4-8 hours if needed, up to " +
                                                "6 grams in 24 hours." + c));
        insertToMap("giveIVMore", new Question(a + b + "Give " + toStr(weightkg * 40) + " mg to " + toStr(weightkg * 90) + " mg IV every 4-8 hours if needed," +
                                               "up to 6 grams in 24 hours." + c));
        
        insertToMap("give1GramIM", new Question(a + b + "Give 1gram IM every 4-8 hours if needed up to 6grams in 24 hours." + c));
        insertToMap("giveIMUpTo1", new Question(a + b + "Give " + toStr(weightkg * 40) + " mg to 1000mg IM every 4-8 hours if needed, up to " +
                                                "6 grams in 24 hours." + c));
        insertToMap("giveIMMore", new Question(a + b + "Give " + toStr(weightkg * 40) + " mg to " + toStr(weightkg * 90) + " mg IM every 4-8 hours if needed, " +
                                               "up to 6 grams in 24 hours." + c));
        
        insertToMap("giveIV1Gram", new Question(a + b + "Initially, 1 g IV. Follow with 500 mg IM every 4 hours for 2 doses, " +
                                                "then 500 mg IM every 4 to 12 hours if needed up to a maximum of 6 grams " +
                                                "in 24 hours." + c));
        insertToMap("giveIM1Gram", new Question(a + b + "Initially, 1 g IM. Follow with 500 mg IM every 4 hours for 2 doses, " +
                                                "then 500 mg IM every 4 to 12 hours if needed up to a maximum of 6 grams " +
                                                "in 24 hours." + c));

        
    }
Ejemplo n.º 2
0
bool Question::operator < (const Question & that) const
{
    if(this->getQuestion() != that.getQuestion()) {
        return this->getQuestion() < that.getQuestion();
    }
    return this->getAnswer() < that.getAnswer();
}
Ejemplo n.º 3
0
bool Theme::selectFromDatabase( const SQLMgr &sqlManager, const qint64 questionsCount, const int answersCount )
{
    const QString tableName_questions( "Questions" );
    const QStringList selectedFields( { "question_id", "text", "question_type",
                                      "recomended_time", "caseSens", "stripSpace" } );

    SqlWhere _where( "theme_id = '" + _id + "'" );

    if( _where.isValid() )
    {
        QSqlQuery query = sqlManager.select( tableName_questions, selectedFields, _where, SqlOrderBy::RANDOM(), questionsCount );


        while( query.next() )
        {
            Question question = selectQuestion( query );
            QVector<Answer> answers = selectAnswers( sqlManager, answersCount, question.getId() );

            question.setAnswers( answers );
            pushQuestion( question );
        }

        return true;
    }
    return false;
}
Ejemplo n.º 4
0
int Question::initialize_print_all()
{
	const char* file_name = Configuration::configuration->get_q_file();
	ifstream in(file_name, ios::in | ios::binary);
	if (!in.is_open())
	{
		return FILE_OPEN_ERR;
	}
	TestingSystem::question_msg q_msg;
	string s;
	q_msg.set_id(-1);
	while (in.cur!= in.eof())
	{
		char c;
		in.read(&c, sizeof c);
		s += c;
		if (!q_msg.ParseFromString(s))
			q_msg.set_id(-1);
		else
		{
			Question q;
			q.initialize_obj(q_msg);
			q.print();
			s="";
		}
	}
	return SUCCESS;
}
Ejemplo n.º 5
0
void QuestionSetCubics::initQuestions( Question::List &questions )
{
  for( int b = 1; b <= 10; ++b ) {
    Question q;
    q.setQuestion( QString::number( b ) + " cube" );
    q.setAnswer( QString::number( b * b * b ) );
    questions.append( q );
  }
}
Ejemplo n.º 6
0
bool DialogueManager::displayQuestion() {
	if (_q->textIsNull()) return false;

	_balloonMan->setSingleBalloon(_q->_text, _ballonPos._questionBalloon.x, _ballonPos._questionBalloon.y, _q->balloonWinding(), BalloonManager::kNormalColor);
	_faceId = _gfx->setItem(_questioner, _ballonPos._questionChar.x, _ballonPos._questionChar.y);
	_gfx->setItemFrame(_faceId, _q->speakerMood());

	return true;
}
Ejemplo n.º 7
0
void BftpMaker::add()
{
    Question q;
    q.setText(tr("empty"));
    q.addAnswer(Answer(tr("empty"), false));
    q.addAnswer(Answer(tr("empty"), false));
    q.addAnswer(Answer(tr("empty"), false));
    _test.insertQuestion(++_currentQ, q);
    setQuestion(_currentQ);
}
Ejemplo n.º 8
0
bool Import::datamatrixToQuestions(){
    bool success = false;

    cout << "START READING DATA TO QUESTION OBJECTS" << endl;
// fills CSV Data from vector < vector <...> > datamatrix to questiondata objects.

    int m = dataMatrix[0].size();

    // check dimensions of datamatix
    if(m!=questionTypes.size()){


        cout << "ERROR: number of survey questions != number of questiontypes" << endl;

        QMessageBox msgBox;
        msgBox.setText("FEHLER: Der ausgewählte Ausstellungstyp passt nicht zur .CSV Datei.");
        msgBox.setInformativeText("Bitte richtigen Ausstellungstyp wählen.");
        msgBox.setDefaultButton(QMessageBox::Ok);
        int ret = msgBox.exec();

        success = false;
        return success;
    }

    int id=0;

    for(int i=0; i<m;++i){


        if(questionTypes[i].toInt()!=0){

            Question *tempQuestion = new Question;

            tempQuestion->setQuestiontype(questionTypes[i].toInt());
            tempQuestion->setQuestion(QString::fromStdString(dataMatrix[0][i]));
            tempQuestion->setSubquestion(QString::fromStdString(dataMatrix[1][i]));

            if(tempQuestion->getQuestionType()!=6)
                tempQuestion->setDataFromStdStringMatrix(dataMatrix,i);

            else
                tempQuestion->setTextAnswersFromStdStringMatrix(dataMatrix,i);

            if(tempQuestion->getQuestion()!="")
                ++id;


            tempQuestion->write_ID(id);      // a question and its subquestions share the same id

            questions.push_back(*tempQuestion);
            delete tempQuestion;
            }

        }

    success=true;
    return success;
}
Ejemplo n.º 9
0
void MainView::checkAnswer()
{
  if ( mQuestions.count() == 0 ) {
    kdError() << "checkAnswer(): no questions." << endl;
    return;
  }

  mReadyTimer.stop();

  Question q = *mCurrentQuestion;

  QString text = "<qt>";
  if ( mAnswerEdit->text() == q.answer() ) {
    text += i18n("Correct answer:");
    mResultView->incrementCurrentCount();
    mQuestions.remove( mCurrentQuestion );
  } else {
    text += "<font color=\"red\">" + i18n("Wrong answer.") + "</font><br>";
    text += i18n("Correct Answer:");
    mResultView->incrementWrongCount();
  }
  text += "<br>";
  text += q.question() + " = " + q.answer();
  text += "</qt>";

  mFeedbackText->setText( text );
  
  if ( mQuestions.count() == 0 ) {
    QString text = "<qt>";
    text += i18n("<b>Congratulation!</b><br/>");
    text += i18n("You answered all questions.<br/>");
    text += "<br/>";
    if ( mResultView->wrongCount() == 0 ) {
      text += i18n("You gave no wrong answers.");
    } else {
      text += i18n("You gave one wrong answer.",
        "You gave %n wrong answers", mResultView->wrongCount() );
    }
    text += "<br/>";
    text += mResultView->rating();
    text += "</qt>";
    
    KMessageBox::information( this, text );

    mQuestionLabel->setText( "" );
    mAnswerEdit->setText( "" );
    mAnswerEdit->setEnabled( false );
    mOkButton->setEnabled( false );
    mFeedbackText->setText( i18n("You won.") );
  } else {
    newQuestion();
  }
}
Ejemplo n.º 10
0
void OpenQuestionSet::mixStructureOfQuestion(Question &questionToMix)
{

    int sizeOf = questionToMix.getAnswerVector().size();
    std::uniform_int_distribution<int> distAns (0, sizeOf-1 );
   
    for (int i = 10 ; i >= 0 ; --i )
    {
        int random1 = distAns(mt);
        int random2 = distAns(mt);
        swap(questionToMix.getAnswerVector().at(random1), questionToMix.getAnswerVector().at(random2))  ;
    }
}
Ejemplo n.º 11
0
void OpenQuestionSet::openNewQuestion()
{
    Question q = allQuestionSet->getNewQuestioin();
    if (q.getQuestion().empty())
    {
        sizeOfOpenQuestion--;
    }
    else
    {
        openQuestion.push_back(q);
    }

}
Ejemplo n.º 12
0
void BftpMaker::prev()
{
    _test.removeQuestion(_currentQ);
    Question q;
    q.setText(textEdit->text());
    for (int i = 0; i < ansList.size(); i++) {
        q.addAnswer(ansList[i]->answer());
    }
    _test.insertQuestion(_currentQ, q);

    if (_currentQ != 0)
        setQuestion(--_currentQ);
}
Ejemplo n.º 13
0
void BftpMaker::next()
{
    _test.removeQuestion(_currentQ);
    Question q;
    q.setText(textEdit->text());
    for (int i = 0; i < ansList.size(); i++) {
        q.addAnswer(ansList[i]->answer());
    }
    _test.insertQuestion(_currentQ, q);

    if (_currentQ < _test.questions().size() - 1)
        setQuestion(++_currentQ);
}
void QuestionSetMultiplication::initQuestions( Question::List &questions )
{
  QValueList<int> rows = Prefs::multiplicationRows();
  QValueList<int>::ConstIterator it;
  for( it = rows.begin(); it != rows.end(); ++it ) {
    int a = *it;
    for( int b = 1; b <= 10; ++b ) {
      Question q;
      q.setQuestion( QString::number( b ) + " \xb7 " + QString::number( a ) );
      q.setAnswer( QString::number( a * b ) );
      questions.append( q );
    }
  }
}
Ejemplo n.º 15
0
void BftpMaker::setQuestion(int q)
{
    Question buf = _test.questions().at(q);
    textEdit->setText(QString(" "));
    textEdit->setText(buf.text());
    this->clearAnsList();
    for (int i = 0; i < buf.answers().size(); i++) {
        ansList.append(new AnswerEdit(buf.answers().at(i), i));
        ui->answers->addWidget(ansList.at(i));
        connect(ansList.at(i), &AnswerEdit::remove,
                this, &BftpMaker::removeAnswer);
    }
    testProgress->setText(QString::number(_currentQ + 1) + QString(QString("/") + QString::number(_test.questions().size())));
}
Ejemplo n.º 16
0
    CrotalidaeOvine::CrotalidaeOvine(double age, double height, double weight) : Antidote(age, height, weight) {
        
        string a = "Crotalidae (pit viper) Antivenin Algorithm\n",
        b = string("For the treatment of Crotalidae or pit viper envenomation.  ") + FDA + "\n\n",
        c = " (Protherics Inc., 2008)";

        string stringInfantsChildren = b + " Dosing for infants and children:\n\n" +
        "The dose of antivenin to be administered to infants and children is expected to be the same. " +
        "Initially 4-6 vials of crotalidae antivenin ovine should be administered at a rate " +
        "of 25-50 ml/hr for the first 10 minutes with careful observation of any signs of allergic " +
        "reaction.  If no signs exist, increase the rate to 250ml/hr.  After administration of " +
        "antivenin, observe for 1 hour.  If control of envenomation syndrome is not achieved, another " +
        "vials of antivenin may be administered until symptoms have resolved.  Additional doses of 2 vials " +
        "every 6 hours for up to 18 hours as needed.  To date no dose over 18 vials has been used." + c;
        string stringAdolescentAdult = b + " Dosing for adolescents and adults\n\n" +
        "Initially 4-6 vials of crotalidae antivenin ovine should be administered at a rate " +
        "of 25-50 ml/hr for the first 10 minutes with careful observation of any signs of allergic " +
        "reaction.  If no signs exist, increase the rate to 250ml/hr.  After administration of " +
        "antivenin, observe for 1 hour.  If control of envenomation syndrome is not achieved, another " +
        "vials of antivenin may be administered until symptoms have resolved.  Additional doses of 2 vials " +
        "every 6 hours for up to 18 hours as needed.  To date no dose over 18 vials has been used." + c;
        
        string reconsider = string("Please re-consider the use of crotalidae antiventin (ovine) as the equine ") +
        "derived antidote is no longer available in the U.S.";
        
        string *antiveninOptions = new string[2];
        antiveninOptions[0] = "Proceed";
        antiveninOptions[1] = "Exit";
        
        string stringProceedOrExit = string("This product is an ovine (sheep) derivative. ") +
        "Patients allergic to ovine products may have a severe reaction. " +
        "It is recommended that you proceed with Antivenin Crotalidae Ovine therapy " +
        "if the wound is life or limb threatening and provide care for anaphylaxis " +
        "if necessary." + c;
        
        Question *InfantsChildren = new Question(stringInfantsChildren);
        Question *AdolescentAdult = new Question(stringAdolescentAdult);
        Question *ProceedOrExit = new Question(stringProceedOrExit);
        Question *Exit = new Question("");
        ProceedOrExit->setOptions(antiveninOptions, 2);
        
        prompts.insert(strQuestionMapPair("InfantsChildren", InfantsChildren));
        prompts.insert(strQuestionMapPair("AdolescentAdult", AdolescentAdult));
        prompts.insert(strQuestionMapPair("ProceedOrExit", ProceedOrExit));
        prompts.insert(strQuestionMapPair("Exit", Exit));
        
    }
Ejemplo n.º 17
0
void getQuestionInfo()
{
    QFile file("Question_Info.txt");
    int i=1;
    if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
    {
        //QMessageBox::critical(NULL, QObject::tr("提示"), QObject::tr("文件不存在,无法打开文件"));
        //create the file
    }
    else
    {
        QString line,title,time,createid,content;
        QTextStream in(&file);
        while(!in.atEnd())
        {
            line = in.readLine().replace(QString("\n"),QString(""));
            if(i%5==0)
            {
                content = line;
                QuestionReadyToAdd.setBasicContent(content);
                SumQuestionList.push_back(QuestionReadyToAdd);
            }
            else if(i%5==1)
            {
                QuestionReadyToAdd.setBasicInfoId(i);
            }
            else if(i%5==2)
            {
                createid = line;
                QuestionReadyToAdd.setCreatUserId(createid);
            }
            else if(i%5==3)
            {
                time = line;
                QuestionReadyToAdd.setCreatTime(time);
            }
            else
            {
                title=line;
                QuestionReadyToAdd.setQuestionTitle(title);
            }
            i = (i+1)%5;
    }
    file.close();
   }
}
Ejemplo n.º 18
0
void MainWindow::changeQuestion(Question question)
{
    ui->question->setText(question.getQuestion());
    currentQuestion = question;
    ui->answer->setText("");
    ui->right->setHidden(true);
    ui->wrong->setHidden(true);
    ui->showAnswer->setHidden(false);
}
Ejemplo n.º 19
0
/**
	*This function builds a packet that presents a question according to the protocol.
	*Input: Index of question.
	*Output: Question packet as the protocol.
**/
string Game::buildQuestionPacket(int questionNo)
{
	Question * q = _questions[questionNo];
	
	int len, i;
	string packet, str;
	string * answers = q->getAnswers();
	packet = to_string(SEND_QUESTION);
	
	str = q->getQuestion();
	len = str.size();
	packet += Helper::getPaddedNumber(len, 3) + str;

	for (i = 0; i < 4; i++)
	{
		str = answers[i];
		len = str.size();
		packet += Helper::getPaddedNumber(len, 3) + str;
	}

	return packet;
}
Ejemplo n.º 20
0
    Physostigmine::Physostigmine(double age, double height, double weight) : Antidote(age, height, weight) {
        a = "Physostigmine Antidote Algorithm \n",
        b = string("As a secondary treatment of anticholinergic syndrome.  ") + FDA + "\n\n",
        c = "";//getRef();
        Question *physWarning = new Question(a+b+
                                             "Warning: Physostigmine Salicylate Injection should not be used in the " +
                                             "presence of asthma, gangrene, diabetes, cardiovascular disease, mechanical " +
                                             "obstruction of the intestine or urogenital tract or any vagotonic state, " +
                                             "and in patients receiving choline esters and depolarizing neuromuscular " +
                                             "blocking agents (decamethonium, succinylcholine).Patient must have normal " +
                                             "QRS on ECG to receive physostigmine.");
        physWarning->setType("warning");
        insertToMap("physWarning", physWarning);
        
        Question *physChildWarning = new Question(a+b+
                                                  "Administration of physostigmine in children should reserved for " +
                                                  "life-threatening conditions.");
        physChildWarning->setType("warning");
        insertToMap("physChildWarning", physChildWarning);
        
        string physChild = a+b+
        "Recommended dosage is "+toStr(physCalcChild())+"mg (0.02 mg/kg max 2mg) of physostigmine intramuscularly or by " +
        "slow intravenous injection, no more than 0.5 mg per minute. If the toxic " +
        "effects persist, and there is no sign of cholinergic effects, the dosage may " +
        "be repeated at 5 to 10 minute intervals until a therapeutic effect is " +
        "obtained or a maximum of 2 mg dosage is attained."+c;
        insertToMap("physChild", physChild);
        
        string physAdult = a+b+
        "Adult dosing: When administering IV give no faster than 1mg/minute to avoid " +
        "adverse events.  Recommended dosage 0.5-2mg IV,IM.  May repeat every 10-30 " +
        "minutes until desired response."+c;
        insertToMap("physAdult", physAdult);

        
    }
Ejemplo n.º 21
0
void EngineerExam::parseQuestions(QString filename) {
    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
    db.setDatabaseName(filename);
    if (!db.open()) {
	qCritical() << trUtf8("Nie można otworzyć bazy danych!");
    }

    QSqlTableModel question;
    question.setTable("Question");
    question.select();

    QSqlTableModel answers;
    answers.setTable("Answer");
    answers.select();

    QStringList qsl;

    int i = 0;
    while (question.canFetchMore()) {
	question.fetchMore();
	for (; i < question.rowCount(); ++i) {
	    qsl.clear();

	    quint32 id = question.record(i).value("Id").toUInt();
	    QString text = question.record(i).value("Text").toString();
	    Question q;
	    q.setId(id);
	    q.setQuestion(text);

	    answers.setFilter(QString("`id_Question` = %1").arg(id));
	    QString a1 = answers.record(0).value("Text").toString();
	    QString a2 = answers.record(1).value("Text").toString();
	    QString a3 = answers.record(2).value("Text").toString();
	    qsl << a1 << a2 << a3;

	    bool correct1 = answers.record(0).value("IsTrue").toBool();
	    bool correct2 = answers.record(1).value("IsTrue").toBool();
	    bool correct3 = answers.record(2).value("IsTrue").toBool();

	    if (correct1) {
		q.setCorrectAnswer(0);
	    } else if (correct2) {
		q.setCorrectAnswer(1);
	    } else if (correct3) {
		q.setCorrectAnswer(2);
	    }
	    q.setAnswers(qsl);
	    tmpList.append(q);
	}
    }
}
Ejemplo n.º 22
0
Question Theme::selectQuestion( const QSqlQuery &query ) const
{ // reject into new method.  Question makeQuestion(const QSqlQueru &query)
    using namespace Tables::Question::Field;
    Question issue;

    QString id = query.value( query.record().indexOf( QUESTION_ID ) ).toString(),
        text = query.value( query.record().indexOf( TEXT ) ).toString(),
        type = query.value( query.record().indexOf( QUESTION_TYPE ) ).toString();
    bool caseSens = query.value( query.record().indexOf( CASE_SENS ) ).toBool(),
        stripSpace = query.value( query.record().indexOf( STRIP_SPACE ) ).toBool();

    QTime time = query.value( query.record().indexOf( RECOMENDED_TIME ) ).toTime();

    issue.setId( id );
    issue.setText( text );
    issue.setType( type );
    issue.setTime( time );
    issue.setCaseSensitivity( caseSens );
    issue.setStripSpaces( stripSpace );
    return issue;
}
Ejemplo n.º 23
0
int main(int argc, char *argv[]) {

  Question* myQ = new Question;

  myQ->track(5);
  myQ->track(7);
  myQ->track(47);
  myQ->track(15);
  myQ->track(192);
  myQ->track(245);
  myQ->track(13);
  myQ->track(2);
  myQ->track(91);
  myQ->track(623);
  myQ->track(542);
  myQ->track(929);
  myQ->track(935);
  myQ->track(651);

  std::cout << "2 is of rank " << myQ->getRankOfNumber(2) << "\n";
  std::cout << "5 is of rank " << myQ->getRankOfNumber(5) << "\n";
  std::cout << "7 is of rank " << myQ->getRankOfNumber(7) << "\n";
  std::cout << "13 is of rank " << myQ->getRankOfNumber(13) << "\n";

  return 0;
}
Ejemplo n.º 24
0
    BlackWidow::BlackWidow(double age, double height, double weight) : Antidote(age, height, weight) {
        string a = "Black Widow envenomation Algorithm.\n",
        b = string("For the treatment of Black Widow (Latrodectus mactans) envenomation.  ") + FDA + "\n\n",
        c = "\n(Merck & Co., Inc. , 2014)";
        
        string stringSystemicReaction = string(" As with any administration of serum products, support for ") +
        "systemic reaction should be made ready prior to administration";
        string stringSerumSickness = string(" Patients should be observed for serum sickness for an average ") +
        "of 8 to 12 days following administration of antivenin.";
        string stringNeonate = a + b + string("Safety and efficacy has not been established in neonates. ") +
        "Please consult neonatologist for dosing instructions.";
        string stringInfantChildren = a + b +
        string("Prior to therapeutic administration a skin test should be performed ") +
        "to determine sensitivity to antivenin serum.  Inject a 1:10 dilution of  " +
        "antivenin serum intradermally.  If there is no reaction after 10 minutes, " +
        "proceed with antivenin administration.\n\nAntivenin administration in children:\n\n" +
        "Intravenous administration is preferred method in children.  Administer " +
        "entire reconstituted vial (2.5 ml) of antivenin in 10ml to 50ml of Normal Saline " +
        "over 15 minutes.  Symptoms should subside in 1 to 3 hours.";
        string stringAdolescent = a + b +
        string("Prior to therapeutic administration a skin test should be performed ") +
        "to determine sensitivity to antivenin serum.  Inject a 1:10 dilution of  " +
        "antivenin serum intradermally.  If there is no reaction after 10 minutes, " +
        "proceed with antivenin administration.\n\nAntivenin administration in adolescents:\n\n" +
        "Intravenous administration is preferred method in children.  Administer " +
        "entire reconstituted vial (2.5 ml) of antivenin in 10ml to 50ml of Normal Saline " +
        "over 15 minutes.  Symptoms should subside in 1 to 3 hours.";
        string stringElderly = a + b +
        string("Prior to therapeutic administration a skin test should be performed ") +
        "to determine sensitivity to antivenin serum.  Inject a 1:10 dilution of  " +
        "antivenin serum intradermally.  If there is no reaction after 10 minutes, " +
        "proceed with antivenin administration.\n\nAntivenin administration in adolescents:\n\n" +
        "Intravenous administration is preferred method in the elderly.  Administer " +
        "entire reconstituted vial (2.5 ml) of antivenin in 10ml to 50ml of Normal Saline " +
        "over 15 minutes.  Symptoms should subside in 1 to 3 hours.";
        string stringAdultNatural = a + b +
        string("For a healthy patient aged 16 to 60, it is recommended that the patient not receive ") +
        "antivenin serum and only pain symptoms should be treated.  Healthly patients aged " +
        "16 to 60 should receive antivenin only when envenomation symptoms are moderate to severe.";
        string stringAdult = a + b +
        string("Prior to therapeutic administration a skin test should be performed ") +
        "to determine sensitivity to antivenin serum.  Inject a 1:10 dilution of  " +
        "antivenin serum intradermally.  If there is no reaction after 10 minutes, " +
        "proceed with antivenin administration.\n\n" +
        "Intravenous administration adults: " +
        "Administer entire reconstituted vial (2.5 ml) of antivenin in 10ml to 50ml of " +
        "Normal Saline over 15 minutes.  Symptoms should subside in 1 to 3 hours. " +
        "Intramuscular administration adults: " +
        "Reconstitute antivenin vial with diluent supplied in kit.  Administer " +
        "intramuscularly to the anterolateral thigh.  Placement of dose allows tourniquet " +
        "to be applied in the event of systemic reaction.";
        
        string stringSeverity = "Describe the severity of bite. ";
        string *antiveninOptions = new string[2];
        antiveninOptions[0] = "Severe";
        antiveninOptions[1] = "Mild";
        
        Question *severity = new Question(stringSeverity);
        severity->setType("options");
        severity->setOptions(antiveninOptions, 2);
        prompts.insert(strQuestionMapPair("severity", severity));
        
        Question *age0 = new Question(stringNeonate + stringSystemicReaction + stringSerumSickness + c);
        prompts.insert(strQuestionMapPair("age0", age0));
        
        Question *ageLessThen12 = new Question(stringInfantChildren + stringSystemicReaction + stringSerumSickness + c);
        prompts.insert(strQuestionMapPair("ageLessThen12", ageLessThen12));
        
        Question *age12To16 = new Question(stringAdolescent + stringSystemicReaction + stringSerumSickness + c);
        prompts.insert(strQuestionMapPair("age12To16", age12To16));
        
        Question *ageGreaterThen60 = new Question(b + stringElderly + stringSystemicReaction + stringSerumSickness + c);
        prompts.insert(strQuestionMapPair("ageGreaterThen60", ageGreaterThen60));
        
        Question *age16To60Severe = new Question(stringAdult + stringSystemicReaction + stringSerumSickness + c);
        prompts.insert(strQuestionMapPair("age16To60Severe", age16To60Severe));
        
        Question *age16To60Mild = new Question(stringAdultNatural + c);
        prompts.insert(strQuestionMapPair("age16To60Mild", age16To60Mild));

        
    }
Ejemplo n.º 25
0
void ReplayMenu::ChangeReplay()
{
  const std::string *name = replay_lbox->GetSelectedFile();
  selected = NULL;
  if (!name) {
    ClearReplayInfo();
    return;
  }

  // Get info from Replay:: and fill in here
  FILE *in = fopen(name->c_str(), "rb");
  if (!in) {
    Question question;
    std::string err = "Error: file ";
    err += *name;
    err += " not found";
    question.Set(err, true, 0);
    question.Ask();
    return; /* File deleted meanwhile ? */
  }

  ReplayInfo *info = ReplayInfo::ReplayInfoFromFile(in);
  fclose(in);

  if (!info)
    return; /* Bad problem */

  // Below gets risky to analyze so error out
  if (!info->IsValid()) {
    const std::string& err = info->GetLastError();

    // Clean current state
    ClearReplayInfo();

    Question question;
    fprintf(stderr, "Error: %s\n", err.c_str());
    question.Set(err, true, 0);
    question.Ask();

    delete info;
    return;
  }

  // Version
  std::string text = info->GetVersion();
  version_lbl->SetText(text);

  // Date
  time_t      t        = info->GetDate();
  struct tm * timeinfo = localtime(&t);
  char buffer[20];
  strftime(buffer, sizeof(buffer), "%Y-%m-%d %HH%Mm%S", timeinfo);
  date_lbl->SetText(buffer);

  // Duration
  Uint32 time = (info->GetMillisecondsDuration()+500)/1000;
  char   temp[32];
  snprintf(temp, 32, "%um%us", time/60, time%60);
  text = temp;
  duration_lbl->SetText(text);

  // Comment
  text = info->GetComment();
  comment_lbl->SetText(text);

  // Teams
  teams_lbox->Clear();
  for (uint i=0; i<info->GetTeams().size(); i++) {
    printf("Adding %s\n", info->GetTeams()[i].id.c_str());
    teams_lbox->AddWidget(new Label(info->GetTeams()[i].id, 0, Font::FONT_MEDIUM));
  }
  teams_lbox->Pack();
  teams_lbox->NeedRedrawing();

  delete info;
  selected = name;
}
Ejemplo n.º 26
0
/**
 * Charge les différantes informations de l'univers passé en paramètre.
 * @param u Objet univers dans lequel placer les informations.
 */
void Chargeur::charger(Univers *u, std::string nom) throw(std::string)
{
    std::string buffer;
    std::string worldName;
    std::string zoneName;
    std::string questionName;
    //On déclare/ouvre le dossier de base.
    Dossier d;
    d.openT(nom);
    //On ouvre le fichier de propriétés
    ifstream proprioF((nom + "/.Proprietes").c_str(), ios::in);

    if (!proprioF)
    {
        throw(std::string("Impossible de trouver le fichier de propriétés"));
    }
    //On recupère le monde de départ
    getline(proprioF,buffer);
    u->setMondeDepart(buffer);
    //On recupère la zone de départ
    getline(proprioF,buffer);
    u->setZoneDepart(buffer);
    //On recupère la question de départ
    getline(proprioF,buffer);
    u->setQuestionDepart(buffer);
    //On ferme le fichier
    proprioF.close();
    //On itère sur le contenu du dossier
    while (d.hasNext())
    {
        worldName = d.next();

        /* On enlève de la liste des dossiers cachés
         * qui pourraient poser problème (par exemple, .svn)
         */
        if (worldName[0] != '.')
        {
            //On ajoute le monde à la liste des mondes
            u->addMonde(Monde());

            Monde &m = u->dernier();
            m.setNomMonde(worldName);
            /*
             * On ouvre le monde
             */
            Dossier dworld;
            dworld.openT(nom + "/" + worldName);
            while (dworld.hasNext())
            {
                //On ouvre la zone
                zoneName = dworld.next();
                if (zoneName[0] != '.')
                {
                    //On ajoute la zone
                    m.addZone(Zone(m.nbZones(),zoneName));
                    //On ouvre la zone
                    Dossier dzone;
                    dzone.openT(nom + "/" + worldName + "/" + zoneName);
                    while (dzone.hasNext())
                    {
                        questionName = dzone.next();
                        //On recupère le nom de la question.

                        if (questionName[0] != '.')
                        {
                            Zone &z = m.dernier();

                            std::string chemin = nom + "/" + worldName + "/" + zoneName + "/" + questionName;

                            //On ouvre le fichier de question en lecture
                            ifstream fichier(chemin.c_str(), ios::in);

                            if(fichier)  // si l'ouverture a réussi
                            {

                                //On déclare une question
                                Question Q;
                                //On change son nom
                                Q.setNom(questionName);
                                //On déclare une proposition
                                Proposition P;
                                //on recupere la ligne courante du fichier
                                getline(fichier,buffer);
                                //on met en place l'intitulé de la question
                                Q.setIntituleQuest(buffer);

                                //On recupere le libelle de la proposition
                                getline(fichier,buffer);

                                //On recupere l'ensemble des proposition
                                while( buffer != "" )
                                {
                                    P = Proposition();

                                    //On met en place le libelle de la proposition
                                    P.setLibelleProp(buffer);

                                    //On recupere nombre de point de proposition
                                    getline(fichier,buffer);
                                    //On met en place le nombre de points de la proposition
                                    P.setPointProp(atof(buffer.c_str()));

                                    //on recupere la reponse à la proposition
                                    getline(fichier,buffer);
                                    //on met en place la reponse a la proposition
                                    P.setReponse(buffer);


                                    //On recupere nombre de point minimum de la proposition
                                    getline(fichier,buffer);
                                    //On met en place le nombre de points minimum de la proposition
                                    P.setPointMin(atof(buffer.c_str()));

                                    //On recupere le nombre de point maximum de proposition
                                    getline(fichier,buffer);
                                    //On met en place le nombre de points maximum de la proposition
                                    P.setPointMax(atof(buffer.c_str()));

                                    //On recupere l'eventuel lien vers un autre monde
                                    getline(fichier,buffer);
                                    //Onmet en place le lien vers le monde
                                    P.setLienMonde(buffer);


                                    getline(fichier,buffer);

                                    while(buffer != "")
                                    {

                                        //on ajout les lien vers les zones
                                        P.addLienZone(buffer);
                                        getline(fichier,buffer);


                                    }

                                    //On ajoute la proposition à la liste de question
                                    Q.addProp(P);
                                    //On recupère la proposition de la nouvelle question
                                    getline(fichier,buffer);

                                }


                                //On ajoute la question à la dernière zone
                                z.addQuestion(Q);


                            }
                            else
                            {
                                throw(std::string("Impossible de charger le fichier !"));
                            }


                        }

                    }

                }
            }
        }
    }
}
Ejemplo n.º 27
0
Question::Question(const Question& Q): Object(Q.getID()) , title(Q.title) , contents(Q.contents) { };
Ejemplo n.º 28
0
bool Question::operator == (const Question & that) const
{
    return this->getQuestion() == that.getQuestion() && this->getAnswer() == that.getAnswer();
}
Ejemplo n.º 29
0
/**
 *@fn MainWindow::on_lineEdit_9_textChanged()
 *@brief Blokowanie i odblokowywanie elementów
*/
void MainWindow::on_pushButton_3_clicked()
{

    if(sprawdzElementy())
    {
        QMessageBox msgBox(QMessageBox::Warning,"","Popraw dane",QMessageBox::Ok);
        msgBox.setWindowTitle("Uwaga!");
        msgBox.exec();
        return;
    }
    pytanie = ui->lineQuestion->text();
    for (int i = 0; i < 9; ++i)
    {
        if (wskazniki[i]->isChecked())
            prawidlowa = i;
    }
    ilosc = 9;
    for (int i = 0; i < 9; ++i)
    {
        if(elementy[i]->text()!="")
            odpowiedzi[i] = elementy[i]->text();
        else
        {
            ilosc = i;
            break;
        }
    }
    if (ilosc == 0)
    {
        --iter;
        loadQuestion(iter);
        return;
    }
    int i;
    for (i = 0; i < 9; ++i)
    {
        if(wskazniki[i]->isChecked())
            break;
    }
    if (i == 9)
    {
        QMessageBox msgBox(QMessageBox::Warning,"","Zaznacz prawidłową odpowiedź",QMessageBox::Ok);
        msgBox.setWindowTitle("Uwaga!");
        msgBox.exec();
        return;
    }

    Question *q = new Question();
    q->setQuest(pytanie);
    q->right_ans=prawidlowa;
    q->count=ilosc;
    for (int i = 0; i < ilosc; ++i)
        q->ans[i]=odpowiedzi[i];
    if (iter >= t.test.size())
        t.test.append(*q);
    else
        t.test[iter]=*q;
    --iter;
    loadQuestion(iter);
    if (iter  == 0)
    {
        ui->pushButton_3->setDisabled(true);
    }
    if (t.test[iter].right_ans > -1)
    {
      wskazniki[t.test[iter].right_ans]->setChecked(true);
    }
}
Ejemplo n.º 30
0
/**
 *@fn MainWindow::~MainWindow()
 *@brief Destruktor klasy MainWindow
*/
void MainWindow::on_pushButton_clicked()
{
    if(ui->lineQuestion->text()=="")
    {
        QMessageBox msgBox(QMessageBox::Warning,"","Nie podałeś pytania",QMessageBox::Ok);
        msgBox.setWindowTitle("Uwaga!");
        msgBox.exec();
        return;
    }

    int i;
    for (i = 0; i < 9; ++i)
    {
        if(wskazniki[i]->isChecked())
        {
            prawidlowa = i;
            break;
        }
    }
    if (i == 9)
    {
        QMessageBox msgBox(QMessageBox::Warning,"","Zaznacz prawidłową odpowiedź",QMessageBox::Ok);
        msgBox.setWindowTitle("Uwaga!");
        msgBox.exec();
        return;
    }

    if(sprawdzElementy())
    {
        QMessageBox msgBox(QMessageBox::Warning,"","Popraw dane",QMessageBox::Ok);
        msgBox.setWindowTitle("Uwaga!");
        msgBox.exec();
        return;
    }
    ui->pushButton_3->setDisabled(false);
    pytanie = ui->lineQuestion->text();
    ilosc = 9;
    for (int i = 0; i < 9; ++i)
    {
        if(elementy[i]->text()!="")
            odpowiedzi[i] = elementy[i]->text();
        else
        {
            ilosc = i;
            break;
        }
    }

    Question *q = new Question();
    q->setQuest(pytanie);
    q->right_ans=prawidlowa;
    q->count=ilosc;
    for (int i = 0; i < ilosc; ++i)
        q->ans[i]=odpowiedzi[i];
    if (iter >= t.test.size())
        t.test.append(*q);
    else
        t.test[iter]=*q;
    if(iter == t.test.size()-1)
    {

            nowePytanie();
            elementy[0]->setText("");
            elementy[1]->setText("");
            elementy[2]->setText("");
            elementy[3]->setText("");
            elementy[4]->setText("");
            elementy[5]->setText("");
            elementy[6]->setText("");
            elementy[7]->setText("");
            elementy[8]->setText("");

            ui->lineQuestion->setText("");
            ++iter;
            ui->pushButton_2->setDisabled(false);
    }
    else
    {
        loadQuestion(++iter);
        if (t.test[iter].right_ans > -1)
        {
          wskazniki[t.test[iter].right_ans]->setChecked(true);
          ui->pushButton_2->setDisabled(false);
        }
    }
}