mirror of
https://github.com/lucaspalomodevelop/lpstd.git
synced 2026-03-13 07:29:38 +00:00
add exceptions
This commit is contained in:
parent
71cc0708ae
commit
4efa8bd9d4
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,2 +1,4 @@
|
||||
main.cpp
|
||||
*.exe
|
||||
*.exe
|
||||
*.out
|
||||
.vscode
|
||||
@ -2,7 +2,10 @@
|
||||
#ifndef __LPSTD_HPP__
|
||||
#define __LPSTD_HPP__
|
||||
|
||||
|
||||
#include "src/patterns/singleton.hpp"
|
||||
#include "src/testing/testing.hpp"
|
||||
// #include "src/faker/faker.hpp"
|
||||
#include "src/exceptions/exceptions.hpp"
|
||||
|
||||
#endif // __LPSTD_HPP__
|
||||
|
||||
7
src/exceptions/exceptions.hpp
Normal file
7
src/exceptions/exceptions.hpp
Normal file
@ -0,0 +1,7 @@
|
||||
#ifndef EXCEPTIONS_HPP
|
||||
#define EXCEPTIONS_HPP
|
||||
|
||||
#include "generic_exception.hpp"
|
||||
#include "notImplementedException.hpp"
|
||||
|
||||
#endif // EXCEPTIONS_HPP
|
||||
32
src/exceptions/generic_exception.hpp
Normal file
32
src/exceptions/generic_exception.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
#ifndef GENERIC_EXCEPTION_HPP
|
||||
#define GENERIC_EXCEPTION_HPP
|
||||
|
||||
#include <exception>
|
||||
#include <string>
|
||||
|
||||
namespace lpstd
|
||||
{
|
||||
|
||||
namespace exceptions
|
||||
{
|
||||
|
||||
class generic_exception : public std::exception
|
||||
{
|
||||
private:
|
||||
std::string message;
|
||||
|
||||
public:
|
||||
generic_exception(std::string message)
|
||||
{
|
||||
this->message = message;
|
||||
}
|
||||
const char *what() const throw()
|
||||
{
|
||||
return this->message.c_str();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
} // namespace lpstd::
|
||||
|
||||
#endif // GENERIC_EXCEPTION_HPP
|
||||
22
src/exceptions/notImplementedException.hpp
Normal file
22
src/exceptions/notImplementedException.hpp
Normal file
@ -0,0 +1,22 @@
|
||||
#ifndef NotImplementedException_HPP
|
||||
#define NotImplementedException_HPP
|
||||
|
||||
#include "generic_exception.hpp"
|
||||
|
||||
namespace lpstd
|
||||
{
|
||||
namespace exceptions
|
||||
{
|
||||
class NotImplementedException : public generic_exception
|
||||
{
|
||||
public:
|
||||
NotImplementedException() : generic_exception("Not implemented exception")
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace exceptions
|
||||
|
||||
} // namespace lpstd
|
||||
|
||||
#endif // NotImplementedException_HPP
|
||||
6
src/faker/faker.hpp
Normal file
6
src/faker/faker.hpp
Normal file
@ -0,0 +1,6 @@
|
||||
#ifndef FAKER_HPP
|
||||
#define FAKER_HPP
|
||||
|
||||
#include "./file.hpp"
|
||||
|
||||
#endif // FAKER_HPP
|
||||
27
src/faker/file.hpp
Normal file
27
src/faker/file.hpp
Normal file
@ -0,0 +1,27 @@
|
||||
#ifndef FAKER_FILE_HPP
|
||||
#define FAKER_FILE_HPP
|
||||
|
||||
#include <string>
|
||||
namespace lpstd
|
||||
{
|
||||
namespace faker
|
||||
{
|
||||
class file
|
||||
{
|
||||
public:
|
||||
std::string virtualPath;
|
||||
file()
|
||||
{
|
||||
this->virtualPath = "C:\\Users\\Public\\Documents\\lpstd\\faker\\file.txt";
|
||||
}
|
||||
std::ofstream get_ofStream()
|
||||
{
|
||||
std::ofstream file;
|
||||
file.open(this->virtualPath);
|
||||
return file;
|
||||
}
|
||||
};
|
||||
} // namespace faker
|
||||
} // namespace lpstd
|
||||
|
||||
#endif // FAKER_FILE_HPP
|
||||
Loading…
x
Reference in New Issue
Block a user