Exemplo n.º 1
0
int environment(sqlite3 *db, char *username, int isAdmin){
	int start_boolean = 0;
	char select;
	do{
		if( (select != '1') && (select != '6') ) clrscr();
		if(start_boolean){
			printf("What would you like to do now, %s? ",username);
		}
		else{
			printf("Hello there, %s.\n\n", username);
			listOptions();
			lineBreak();
			printf("What would you like to do, %s? ",username);
			start_boolean = 1;
		}
		select = charInput();
		if(select != '0') clrscr();
		selection(select, db, username, isAdmin);
	}while( select!='0' );
	lineBreak();
	printf("Bye, %s!\n", username);
	sleep(2);
	clrscr();
	return 0;
}
Exemplo n.º 2
0
 // file context dump:
 virtual boost::filesystem::fstream& dumpHeaderToFile(boost::filesystem::fstream& os) const {
   std::string timeLabel(makeTimeLabel());
   os << "# StartTime = " << timeLabel << " [UTC]" << lineBreak();
   posEndTime_   = os.tellg() + std::streamoff(14);
   os << "# EndTime   = " << timeLabel << " [UTC]" << lineBreak();
   std::ostringstream oss; dump_header(oss);
   os << oss.str();
   return os;
 }
Exemplo n.º 3
0
		void Writer::writeArray(Appender& appender, const Value& value, Size indent)
		{
			appender.append("[" + lineBreak());
			for (Size i = 0; i < value.getLength(); i++)
			{
				appender.append(space(indent + 1));
				write(appender, value.get(i), indent + 1);
				if (i + 1 != value.getLength())
				{
					appender.append(",");
				}
				appender.append(lineBreak());
			}
			appender.append(space(indent) + "]");
		}
Exemplo n.º 4
0
void reportWarning(char *format, va_list args)
/* Print warning to console and also to log files. */
{
vaReportFile(format, args, stdout, "###", lineBreak());
vaReportFile(format, args, errFile, "###", "\n");
fflush(errFile);
}
Exemplo n.º 5
0
void MeasureBase::cleanupLayoutBreaks(bool undo)
      {
      // remove unneeded layout breaks
      std::vector<Element*> toDelete;
      for (Element* e : el()) {
            if (e->isLayoutBreak()) {
                  switch (toLayoutBreak(e)->layoutBreakType()) {
                        case LayoutBreak::LINE:
                              if (!lineBreak())
                                    toDelete.push_back(e);
                              break;
                        case LayoutBreak::PAGE:
                              if (!pageBreak())
                                    toDelete.push_back(e);
                              break;
                        case LayoutBreak::SECTION:
                              if (!sectionBreak())
                                    toDelete.push_back(e);
                              break;
                        case LayoutBreak::NOBREAK:
                              if (!noBreak())
                                    toDelete.push_back(e);
                              break;
                        }
                  }
            }
      for (Element* e : toDelete) {
            if (undo)
                  score()->undoRemoveElement(e);
            else
                  _el.remove(e);
            }
      }
Exemplo n.º 6
0
		void Writer::writeObject(Appender& appender, const Value& value, Size indent)
		{
			appender.append("{" + lineBreak());
			auto propNames = value.getPropertyNames();
			for (Size i = 0; i < propNames.size(); i++)
			{
				const std::string& name = propNames[i];
				appender.append(space(indent + 1) + '"' + name + "\": ");
				write(appender, value.get(name), indent + 1);
				if (i + 1 != propNames.size())
				{
					appender.append(",");
				}
				appender.append(lineBreak());
			}
			appender.append(space(indent) + "}");
		}
Exemplo n.º 7
0
void currentTime(void){
	clrscr();
	time_t rawtime;
	struct tm * timeinfo;
	time (&rawtime);
	timeinfo = localtime (&rawtime);
	printf ("Current local time and date:\n%s", asctime(timeinfo));
	lineBreak();
}
Exemplo n.º 8
0
void MeasureBase::undoSetBreak(bool v, LayoutBreak::Type type)
      {
      switch (type) {
            case LayoutBreak::LINE:
                  if (lineBreak() == v)
                        return;
                  setLineBreak(v);
                  break;
            case LayoutBreak::PAGE:
                  if (pageBreak() == v)
                        return;
                  if (v && lineBreak())
                        setLineBreak(false);
                  setPageBreak(v);
                  break;
            case LayoutBreak::SECTION:
                  if (sectionBreak() == v)
                        return;
                  if (v && lineBreak())
                        setLineBreak(false);
                  setSectionBreak(v);
                  break;
            case LayoutBreak::NOBREAK:
                  if (noBreak() == v)
                        return;
                  if (v) {
                        setLineBreak(false);
                        setPageBreak(false);
                        setSectionBreak(false);
                        }
                  setNoBreak(v);
                  break;
            }

      if (v) {
            LayoutBreak* lb = new LayoutBreak(score());
            lb->setLayoutBreakType(type);
            lb->setTrack(-1);       // this are system elements
            lb->setParent(this);
            score()->undoAddElement(lb);
            }
      cleanupLayoutBreaks(true);
      }
Exemplo n.º 9
0
bool MeasureBase::readProperties(XmlReader& e)
      {
      const QStringRef& tag(e.name());
      if (tag == "LayoutBreak") {
            LayoutBreak* lb = new LayoutBreak(score());
            lb->read(e);
            bool doAdd = true;
            switch (lb->layoutBreakType()) {
                  case LayoutBreak::LINE:
                        if (lineBreak())
                              doAdd = false;
                        break;
                  case LayoutBreak::PAGE:
                        if (pageBreak())
                              doAdd = false;
                        break;
                  case LayoutBreak::SECTION:
                        if (sectionBreak())
                              doAdd = false;
                        break;
                  case LayoutBreak::NOBREAK:
                        if (noBreak())
                              doAdd = false;
                        break;
                  }
            if (doAdd) {
                  add(lb);
                  cleanupLayoutBreaks(false);
                  }
            else
                  delete lb;
            }
      else if (tag == "StaffTypeChange") {
            StaffTypeChange* stc = new StaffTypeChange(score());
            stc->setTrack(e.track());
            stc->setParent(this);
            stc->read(e);
            add(stc);
            }
      else if (Element::readProperties(e))
            ;
      else
            return false;
      return true;
      }
Exemplo n.º 10
0
ParagraphFragment::ParagraphFragment(KShape *shape, const QTextBlock &textBlock, KParagraphStyle *style)
        : m_shape(shape)
{
    QTextLayout *layout = textBlock.layout();

    m_isSingleLine = (layout->lineCount() == 1);

    // border rectangle left and right
    m_border.setLeft(0.0);
    m_border.setRight(shape->size().width());

    // first line rectangle
    m_firstLine = layout->lineAt(0).rect();
    m_firstLine.setRight(m_border.right() - style->rightMargin());

    // counter rectangle
    KTextBlockData *blockData = static_cast<KTextBlockData*>(textBlock.userData());
    if (blockData != NULL) {
        m_counter = QRectF(blockData->counterPosition(), QSizeF(blockData->counterWidth() - blockData->counterSpacing(), m_firstLine.height()));
    }

    // following lines rectangle
    if (!m_isSingleLine) {
        m_followingLines = QRectF(layout->lineAt(1).rect().topLeft(), layout->lineAt(layout->lineCount() - 1).rect().bottomRight());
    } else {
        m_followingLines = m_firstLine;
    }

    // border rectangle top and bottom
    m_border.setTop(m_firstLine.top() - style->topMargin());
    m_border.setBottom(m_isSingleLine ? m_firstLine.bottom() + style->bottomMargin() : m_followingLines.bottom() + style->bottomMargin());

    // TODO: the lines overlap slightly so right now we simply
    // calculate the mean of the two y-values, should be handled properly
    if (!m_isSingleLine) {
        qreal lineBreak((m_firstLine.bottom() + m_followingLines.top()) / 2.0);
        m_firstLine.setBottom(lineBreak);
        m_counter.setBottom(lineBreak);
        m_followingLines.setTop(lineBreak);
    }
}
 inline VerEx & br() {
     return lineBreak();
 }
Exemplo n.º 12
0
void CCopasiMessage::handler(const bool & /* _throw */)
{
  std::string Text = mText;

  switch (mType)
    {
    case RAW:
      mText = "";
      break;

    case TRACE:
      mText = ">TRACE ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case COMMANDLINE:
    case WARNING:
      mText = ">WARNING ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case ERROR:
      mText = ">ERROR ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case EXCEPTION:
      mText = ">EXCEPTION ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case RAW_FILTERED:
      mText = ">RAW(filtered) ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case TRACE_FILTERED:
      mText = ">TRACE(filtered) ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case COMMANDLINE_FILTERED:
      mText = ">COMMANDLINE(filtered) ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case WARNING_FILTERED:
      mText = ">WARNING(filtered) ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case ERROR_FILTERED:
      mText = ">ERROR(filtered) ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;

    case EXCEPTION_FILTERED:
      mText = ">EXCEPTION(filtered) ";
      mText += LocalTimeStamp();
      mText += "<\n";
      break;
    }

  mText += Text;

  if (mType != RAW) lineBreak();

  // Remove the message: No more messages.
  if (mMessageDeque.size() == 1 &&
      mMessageDeque.back().getNumber() == MCCopasiMessage + 1)
    getLastMessage();

  mMessageDeque.push_back(*this);

  // All messages are printed to std::cerr
  if (COptions::compareValue("Verbose", true) &&
      mNumber != MCCopasiMessage + 1)
    {
      std::cerr << mText << std::endl;

#ifdef COPASI_DEBUG
      DebugFile << mText << std::endl;
#endif // COPASI_DEBUG
    }

  if (mType == EXCEPTION)
    throw CCopasiException(*this);
}