-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
RC0.1
- Loading branch information
There are no files selected for viewing
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 () | ||
|
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 |
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 |
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 |
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 |
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 |