EvEmu  0.8.4
11 September 2021
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
PyExceptions.h
Go to the documentation of this file.
1 /*
2  ------------------------------------------------------------------------------------
3  LICENSE:
4  ------------------------------------------------------------------------------------
5  This file is part of EVEmu: EVE Online Server Emulator
6  Copyright 2006 - 2021 The EVEmu Team
7  For the latest information visit https://evemu.dev
8  ------------------------------------------------------------------------------------
9  This program is free software; you can redistribute it and/or modify it under
10  the terms of the GNU Lesser General Public License as published by the Free Software
11  Foundation; either version 2 of the License, or (at your option) any later
12  version.
13 
14  This program is distributed in the hope that it will be useful, but WITHOUT
15  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
17 
18  You should have received a copy of the GNU Lesser General Public License along with
19  this program; if not, write to the Free Software Foundation, Inc., 59 Temple
20  Place - Suite 330, Boston, MA 02111-1307, USA, or go to
21  http://www.gnu.org/copyleft/lesser.txt.
22  ------------------------------------------------------------------------------------
23  Author: Bloody.Rabbit
24 */
25 
26 #ifndef __PY_EXCEPTIONS_H__INCL__
27 #define __PY_EXCEPTIONS_H__INCL__
28 
29 #include "python/PyRep.h"
30 
40 {
41 public:
42  PyException( PyRep* except );
43  PyException( const PyException& oth );
44  ~PyException();
45 
46  PyException& operator=( const PyException& oth );
47 
49 };
50 
60 : public PyObjectEx_Type1
61 {
62 public:
63  GPSTransportClosed( const char* reason );
64  GPSTransportClosed( std::string& reason );
65 
72  void AddKeyword( const char* name, PyRep* value );
73 
74 
75  PyDict* GetReasonArgs() const;
76 protected:
77 
78  static PyTuple* _CreateArgs( const char* reason );
79  static PyDict* _CreateKeywords( const char* reason );
80 };
81 
86 {
111 };
112 
122 : public PyException
123 {
124 public:
125  UserError (const char* exceptionType);
126 
138  UserError& AddFormatValue (const char* name, PyRep* value);
139 
148  UserError& AddDateTime (const char* name, time_t date);
149 
158  UserError& AddDate (const char* name, time_t date);
159 
168  UserError& AddTime (const char* name, time_t time);
169 
180  UserError& AddTimeShort (const char* name, time_t time);
181 
192  UserError& AddA (const char* name, const char* value);
193 
202  UserError& AddThe (const char* name, const char* value);
203 
213  UserError& AddUELocalization (const char* name, const char* strKey, PyDict* args = nullptr);
214 
226  UserError& AddList (const char* name, PyList* listEntries, const char* separator = nullptr);
227 
236  UserError& AddOwnerName (const char* name, uint32 ownerID);
237 
246  UserError& AddOwnerNick (const char* name, uint32 ownerID);
247 
256  UserError& AddLocationName (const char* name, uint32 locationID);
257 
266  UserError& AddTypeName (const char* name, uint32 typeID);
267 
276  UserError& AddTypeDescription (const char* name, uint32 typeID);
277 
286  UserError& AddTypeList (const char* name, PyList* typeIDs);
287 
296  UserError& AddBlueprintTypeName (const char* name, uint32 bpTypeID);
297 
306  UserError& AddGroupName (const char* name, uint32 groupID);
307 
316  UserError& AddGroupDescription (const char* name, uint32 groupID);
317 
326  UserError& AddCategoryName (const char* name, uint32 categoryID);
327 
336  UserError& AddCategoryDescription (const char* name, uint32 categoryID);
337 
346  UserError& AddAmount (const char* name, int quantity);
347 
356  UserError& AddAmount (const char* name, uint quantity);
357 
366  UserError& AddAmount (const char* name, double quantity);
367 
376  UserError& AddISK (const char* name, double isk);
377 
386  UserError& AddAUR (const char* name, double aur);
387 
396  UserError& AddDistance (const char* name, double distance);
397 
407  UserError& AddTypeIDAndQuantity (const char* name, uint32 typeID, int quantity);
408 
409 protected:
413  static const char* EXCEPTION_NAME;
414 
421  void AddKeyword( const char* name, PyRep* value );
422 
435  UserError& AddParameterKeyword (const char* name, UserError_ParameterIDs type, PyRep* value, PyRep* value2 = nullptr);
436 
437  PyDict* _GetTupleKeywords() const;
438  PyDict* _GetDictKeywords() const;
439 
440  PyTuple* _CreateArgs( const char* msg );
441  PyDict* _CreateKeywords( const char* msg );
442 
445 };
453 class CustomError : public UserError
454 {
455 public:
461  CustomError(const char* message, ...);
462 private:
463  static const char* EXCEPTION_NAME;
464 };
465 
466 #endif /* !__PY_EXCEPTIONS_H__INCL__ */
Base Python wire object.
Definition: PyRep.h:66
UserError & AddTimeShort(const char *name, time_t time)
Shorthand method for adding the given time as a time string in the message (without minutes) ...
Python's dictionary.
Definition: PyRep.h:719
UserError & AddThe(const char *name, const char *value)
Shorthand method for adding "the" before the beginning of the value.
UserError & AddCategoryName(const char *name, uint32 categoryID)
Shorthand method for adding a category's name.
UserError & AddTypeIDAndQuantity(const char *name, uint32 typeID, int quantity)
Shorthand method for adding type ID and quantity.
UserError & AddTypeName(const char *name, uint32 typeID)
Shorthand method for adding a type's name.
UserError(const char *exceptionType)
UserError & AddGroupDescription(const char *name, uint32 groupID)
Shorthand method for adding a group's description.
UserError & AddFormatValue(const char *name, PyRep *value)
Fluent version of the protected AddKeyword, allows for adding a keyword to the exception.
UserError & AddDistance(const char *name, double distance)
Shorthand method for adding distance in a easy to read unit.
Python tuple.
Definition: PyRep.h:567
Advanced version of UserError that allows to send a full custom message.
Definition: PyExceptions.h:453
static PyTuple * _CreateArgs(const char *reason)
PyTuple * _CreateArgs(const char *msg)
UserError & AddOwnerNick(const char *name, uint32 ownerID)
Shorthand method for adding an owner's nick (first name without surname)
PyDict * _GetDictKeywords() const
void AddKeyword(const char *name, PyRep *value)
Adds keyword to exception.
UserError & AddISK(const char *name, double isk)
Shorthand method for adding an ISK amount.
CustomError(const char *message,...)
* args
UserError & AddTime(const char *name, time_t time)
Shorthand method for adding the given date time as a time string in the message.
UserError & AddGroupName(const char *name, uint32 groupID)
Shorthand method for adding a group's name.
UserError & AddParameterKeyword(const char *name, UserError_ParameterIDs type, PyRep *value, PyRep *value2=nullptr)
Adds a keyword to exception.
UserError & AddAmount(const char *name, int quantity)
Shorthand method for adding a quantity value.
Base class for exceptions that can be converted to python objects.
Definition: PyExceptions.h:39
GPSTransportClosed(const char *reason)
UserError_ParameterIDs
Enumeration that indicates what parameters can be sent along with an UserError.
Definition: PyExceptions.h:85
PyDict * GetReasonArgs() const
UserError & AddTypeDescription(const char *name, uint32 typeID)
Shorthand method for adding a type's description.
UserError & AddOwnerName(const char *name, uint32 ownerID)
Shorthand method for adding an owner's name.
PyException(PyRep *except)
static PyDict * _CreateKeywords(const char *reason)
UserError & AddAUR(const char *name, double aur)
Shorthand method for adding an AUR amount.
static const char * EXCEPTION_NAME
Definition: PyExceptions.h:463
UserError & AddUELocalization(const char *name, const char *strKey, PyDict *args=nullptr)
Shorthand method for adding a string in the client's translations.
PyTuple * m_args
Definition: PyExceptions.h:443
UserError & AddA(const char *name, const char *value)
Shorthand method for adding "a" before the beginning of the value.
PyDict * _GetTupleKeywords() const
Python object "ccp_exceptions.UserError".
Definition: PyExceptions.h:121
unsigned __int32 uint32
Definition: eve-compat.h:50
UserError & AddDateTime(const char *name, time_t date)
Shorthand method for adding the given date-time as a datetime string in the message.
UserError & AddCategoryDescription(const char *name, uint32 categoryID)
Shorthand method for adding a category's description.
UserError & AddList(const char *name, PyList *listEntries, const char *separator=nullptr)
Shorthand method for adding a list of format parameters.
Wrapper class for PyObjectEx of type 1.
Definition: PyRep.h:911
PyDict * _CreateKeywords(const char *msg)
PyDict * m_keywords
Definition: PyExceptions.h:444
PyRep * ssException
Definition: PyExceptions.h:48
UserError & AddTypeList(const char *name, PyList *typeIDs)
Shorthand method for adding a list of types' names.
Python object "exceptions.GPSTransportClosed".
Definition: PyExceptions.h:59
void AddKeyword(const char *name, PyRep *value)
Adds keyword to exception.
UserError & AddBlueprintTypeName(const char *name, uint32 bpTypeID)
Shorthand method for adding a blueprint's type name.
PyException & operator=(const PyException &oth)
Python list.
Definition: PyRep.h:639
static const char * EXCEPTION_NAME
Definition: PyExceptions.h:413
UserError & AddLocationName(const char *name, uint32 locationID)
Shorthand method for adding a location's name.
UserError & AddDate(const char *name, time_t date)
Shorthand method for adding the given date time as a date string in the message.