File indexing completed on 2026-06-02 08:43:50
0001 #ifndef FILE_EXCEPTION_TYPE_H
0002 #define FILE_EXCEPTION_TYPE_H
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013 #include <string>
0014
0015 namespace ElemUtils {
0016
0017
0018
0019
0020
0021
0022
0023
0024 struct FileExceptionType {
0025
0026 template<typename T>
0027 operator T() const;
0028
0029 public:
0030 enum Type {
0031 DEFAULT, UNREADABLE
0032 };
0033 Type t_;
0034 FileExceptionType(Type t) :
0035 t_(t) {
0036 }
0037 operator Type() const {
0038 return t_;
0039 }
0040
0041 std::string toString() {
0042 switch (t_) {
0043 case UNREADABLE:
0044 return "UNREADABLE";
0045 break;
0046 default:
0047 return "default";
0048 }
0049 }
0050
0051 static FileExceptionType fromString(const std::string &type) {
0052 if (type == "UNREADABLE") {
0053 return UNREADABLE;
0054 }
0055
0056 return DEFAULT;
0057 }
0058 };
0059
0060 }
0061
0062 #endif