Skip to content
This repository has been archived by the owner on Sep 4, 2020. It is now read-only.

Commit

Permalink
Merge pull request #5 from bertof/Develop/main
Browse files Browse the repository at this point in the history
RC0.1
  • Loading branch information
bertof authored Mar 16, 2017
2 parents 0d17899 + ddc75d2 commit 9452a3d
Show file tree
Hide file tree
Showing 39 changed files with 1,449 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/rang"]
path = lib/rang
url = https://github.com/agauniyal/rang.git
1 change: 1 addition & 0 deletions .idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions .idea/WPS-pin-generator.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/dictionaries/pily.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
cmake_minimum_required(VERSION 3.7)
project(WPS_pin_generator)

set(CMAKE_CXX_STANDARD 11)

set(Boost_USE_STATIC_LIBS OFF)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost 1.58.0 COMPONENTS filesystem date_time)

if (Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})

set(SOURCE_FILES main.cpp Pin/Pin.h Generator/bertofGenerator/Generator.h Exceptions/NotImplementedException.h Generator/bertofGenerator/Generator.cpp Logger/ScreenLogger/ScreenLogger.h Logger/ScreenLogger/ScreenLogger.cpp Exceptions/InvalidInputException.h Generator/GeneratorInerface.h Logger/Logger.cpp Logger/Logger.h Logger/TextLogger/TextLogger.cpp Logger/TextLogger/TextLogger.h Logger/DoubleLogger/DoubleLogger.cpp Logger/DoubleLogger/DoubleLogger.h Graphics/SplashScreen/SplashScreen.cpp Graphics/SplashScreen/SplashScreen.h InputHandling/InputHandler.cpp InputHandling/InputHandler.h Graphics/HelpScreen/HelpScreen.cpp Graphics/HelpScreen/HelpScreen.h Graphics/Info/Info.cpp Graphics/Info/Info.h Exceptions/HelpScreenException.h Exceptions/AuthorsScreenException.h Graphics/AuthorsScreen/AuthorsScreen.cpp Graphics/AuthorsScreen/AuthorsScreen.h)
add_executable(WPS_pin_generator ${SOURCE_FILES})


target_link_libraries(WPS_pin_generator ${Boost_LIBRARIES})
endif ()

45 changes: 45 additions & 0 deletions Exceptions/AuthorsScreenException.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// Created by pily on 15/03/17.
//

#ifndef WPS_PIN_GENERATOR_AUTHORSCREENEXCEPTION_H
#define WPS_PIN_GENERATOR_AUTHORSCREENEXCEPTION_H

#include <string>
#include <exception>

class AuthorsScreenException : public std::exception {
public:
/** Constructor (C string)
* @param message C-style string error message.
* The string contents are copied upon construction.
* Hence, responsibility for deleting the char* lies
* with the caller.
*/
explicit AuthorsScreenException(const char *message) : errorMessage_(message) {}

/** Constructor (C++ STL string)
* @param message The error message.
*/
explicit AuthorsScreenException(const std::string &message = "Authors screen showed") : errorMessage_(message) {}

/** Destructor
* Virtual to allow subclassing
*/
virtual ~AuthorsScreenException() throw() {}

/** Returns a pointer to the (constant) error description.
*
* @return
*/
const char *what() const throw() {
return errorMessage_.c_str();
}

private:
/** Saved error message
*/
std::string errorMessage_;
};

#endif //WPS_PIN_GENERATOR_AUTHORSCREENEXCEPTION_H
45 changes: 45 additions & 0 deletions Exceptions/HelpScreenException.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//
// Created by pily on 14/03/17.
//

#ifndef WPS_PIN_GENERATOR_HELPSCREENEXCEPTION_H
#define WPS_PIN_GENERATOR_HELPSCREENEXCEPTION_H

#include <exception>
#include <string>

class HelpScreenException : public std::exception {
public:
/** Constructor (C string)
* @param message C-style string error message.
* The string contents are copied upon construction.
* Hence, responsibility for deleting the char* lies
* with the caller.
*/
explicit HelpScreenException(const char *message) : errorMessage_(message) {}

/** Constructor (C++ STL string)
* @param message The error message.
*/
explicit HelpScreenException(const std::string &message = "Help screen showed") : errorMessage_(message) {}

/** Destructor
* Virtual to allow subclassing
*/
virtual ~HelpScreenException() throw() {}

/** Returns a pointer to the (constant) error description.
*
* @return
*/
const char *what() const throw() {
return errorMessage_.c_str();
}

private:
/** Saved error message
*/
std::string errorMessage_;
};

#endif //WPS_PIN_GENERATOR_HELPSCREENEXCEPTION_H
46 changes: 46 additions & 0 deletions Exceptions/InvalidInputException.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//
// Created by pily on 11/02/17.
//

#ifndef WPS_PIN_GENERATOR_INVALIDINPUTEXCEPTION_H
#define WPS_PIN_GENERATOR_INVALIDINPUTEXCEPTION_H

#include <exception>
#include <string>

class InvalidInputException : public std::exception {
public:

/** Constructor (C string)
* @param message C-style string error message.
* The string contents are copied upon construction.
* Hence, responsibility for deleting the char* lies
* with the caller.
*/
explicit InvalidInputException(const char *message) : errorMessage_(message) {}

/** Constructor (C++ STL string)
* @param message The error message.
*/
explicit InvalidInputException(const std::string &message = "Input passed is not valid") : errorMessage_(message) {}

/** Destructor
* Virtual to allow subclassing
*/
virtual ~InvalidInputException() throw() {}

/** Returns a pointer to the (constant) error description.
*
* @return
*/
const char *what() const throw() {
return errorMessage_.c_str();
}

private:
/** Saved error message
*/
std::string errorMessage_;
};

#endif //WPS_PIN_GENERATOR_INVALIDINPUTEXCEPTION_H
49 changes: 49 additions & 0 deletions Exceptions/NotImplementedException.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
//
// Created by pily on 11/02/17.
//

#ifndef WPS_PIN_GENERATOR_NOTIMPLEMENTEDEXCEPTION_H
#define WPS_PIN_GENERATOR_NOTIMPLEMENTEDEXCEPTION_H

#include <exception>
#include <string>

class NotImplementedException : public std::exception {
public:
/** Constructor (C strings).
* @param message C-style string error message.
* The string contents are copied upon construction.
* Hence, responsibility for deleting the char* lies
* with the caller.
*/
explicit NotImplementedException(const char *message) :
errorMessage_(message) {
}

/** Constructor (C++ STL strings).
* @param message The error message.
*/
explicit NotImplementedException(const std::string &message = "Function not implemented") :
errorMessage_(message) {}

/** Destructor.
* Virtual to allow for subclassing.
*/
virtual ~NotImplementedException() throw() {}

/** Returns a pointer to the (constant) error description.
* @return A pointer to a const char*. The underlying memory
* is in posession of the Exception object. Callers must
* not attempt to free the memory.
*/
virtual const char *what() const throw() {
return errorMessage_.c_str();
}

protected:
/** Error message.
*/
std::string errorMessage_;
};

#endif //WPS_PIN_GENERATOR_NOTIMPLEMENTEDEXCEPTION_H
30 changes: 30 additions & 0 deletions Generator/GeneratorInerface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
//
// Created by pily on 11/02/17.
//

#ifndef WPS_PIN_GENERATOR_GENERATORINERFACE_H
#define WPS_PIN_GENERATOR_GENERATORINERFACE_H

#include <vector>
#include "../Pin/Pin.h"

class GeneratorInterface {
public:
/** Method called to generate a pin
* @param s string of the mac address
* @return non empty vector of valid Pins
*/
virtual std::vector<Pin> generatePin(const std::string &s) const =0;

/** Method called to return the author of the generator
* @return
*/
virtual std::string author() const =0;

/** Method called to return the version of the generator
* @return
*/
virtual std::string version() const =0;
};

#endif //WPS_PIN_GENERATOR_GENERATORINERFACE_H
Loading

0 comments on commit 9452a3d

Please sign in to comment.