Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

 

 

(C++) Pause

 

Pause is a tool whose purpose it is to do nothing.

 

Pause is programmed in C++ using Qt Creator.

 

 

 

 

 

Downloads

 

 

 

 

 

 

Version history

 

Technical facts

 

Operating system(s) or programming environment(s)

IDE(s):

Project type:

C++ standard:

Compiler(s):

Libraries used:

 

 

 

 

 

Qt project file: ./ToolPause/ToolPause.pro

 

QT       += core
QT       -= gui
CONFIG   += console
CONFIG   -= app_bundle
TEMPLATE = app

INCLUDEPATH += \
    ../../Classes/CppAbout

SOURCES += main.cpp \
    pausemenudialog.cpp \
    ../../Classes/CppAbout/about.cpp

HEADERS += \
    pausemenudialog.h \
    ../../Classes/CppAbout/about.h

OTHER_FILES += \
    ../../Classes/CppAbout/Licence.txt

#
#
# Type of compile
#
#

CONFIG(release, debug|release) {
  DEFINES += NDEBUG NTRACE_BILDERBIKKEL
}

QMAKE_CXXFLAGS += -std=c++11 -Wall -Wextra -Weffc++

unix {
  QMAKE_CXXFLAGS += -Werror
}

#
#
# Boost
#
#

win32 {
  INCLUDEPATH += \
    ../../Libraries/boost_1_54_0
}

 

 

 

 

 

./ToolPause/main.cpp

 

//---------------------------------------------------------------------------
/*
Pause, tool to do nothing
Copyright (C) 2010-2013 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
// From http://www.richelbilderbeek.nl/ToolPause.htm
//---------------------------------------------------------------------------
#include "pausemenudialog.h"

#include <iostream>
#include <iterator>

int main(int argc, char* argv[])
{
  ribi::PauseMenuDialog::Execute(argc,argv);
  const std::vector<std::string> t = ribi::PauseMenuDialog::GetAbout().CreateAboutText();
  std::copy(t.begin(),t.end(),std::ostream_iterator<std::string>(std::cout,"\n"));
}

 

 

 

 

 

./ToolPause/pausemenudialog.h

 

//---------------------------------------------------------------------------
/*
Pause, tool to do nothing
Copyright (C) 2010-2013 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
// From http://www.richelbilderbeek.nl/ToolPause.htm
//---------------------------------------------------------------------------
#ifndef PAUSEMENUDIALOG_H
#define PAUSEMENUDIALOG_H

#include <string>
#include <vector>

#include "about.h"

namespace ribi {

struct PauseMenuDialog
{
  static void Execute(const int argc, const char * const argv[]) noexcept;
  static const About GetAbout() noexcept;
  static const std::string GetVersion() noexcept;
  static const std::vector<std::string> GetVersionHistory() noexcept;

  private:
  static void Wait(const double n_secs) noexcept;
};

} //~namespace ribi

#endif // PAUSEMENUDIALOG_H

 

 

 

 

 

./ToolPause/pausemenudialog.cpp

 

//---------------------------------------------------------------------------
/*
Pause, tool to do nothing
Copyright (C) 2010-2013 Richel Bilderbeek

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program.If not, see <http://www.gnu.org/licenses/>.
*/
//---------------------------------------------------------------------------
// From http://www.richelbilderbeek.nl/ToolPause.htm
//---------------------------------------------------------------------------
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"

#include "pausemenudialog.h"

#include <cassert>

#include <boost/lexical_cast.hpp>
#include <boost/timer.hpp>
#pragma GCC diagnostic pop

void ribi::PauseMenuDialog::Execute(const int argc, const char * const argv[]) noexcept
{
  assert(argc >= 1);
  if (argc == 1)
  {
    Wait(10.0);
  }
  else
  {
    try
    {
      const double t = boost::lexical_cast<double>(argv[1]);
      Wait(t);
    }
    catch (boost::bad_lexical_cast&)
    {
      Wait(10.0);
    }
  }
}

const ribi::About ribi::PauseMenuDialog::GetAbout() noexcept
{
  About a(
    "Richel Bilderbeek",
    "Pause",
    "tool to do nothing",
    "the 25th of May 2013",
    "2010-2012",
    "http://www.richelbilderbeek.nl/ToolPause.htm",
    GetVersion(),
    GetVersionHistory());
  //a.AddLibrary("AsciiArter version: " + AsciiArter::GetVersion());
  return a;
}

const std::string ribi::PauseMenuDialog::GetVersion() noexcept
{
  return "1.1";
}

const std::vector<std::string> ribi::PauseMenuDialog::GetVersionHistory() noexcept
{
  std::vector<std::string> v;
  v.push_back("2010-xx-xx: Version 1.0: initial version");
  v.push_back("2013-05-25: Version 1.1: added menu, conformized towards ProjectRichelBilderbeek");
  return v;
}

void ribi::PauseMenuDialog::Wait(const double n_secs) noexcept
{
  boost::timer t;
  while (t.elapsed() < n_secs) {}
}

 

 

 

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.

 

Valid XHTML 1.0 Strict

This page has been created by the tool CodeToHtml