lib: changed Usb::Error exception to deal in libusb_errcode instead of system
[barry/progweb.git] / src / j_jdwp.h
blob4c3d9b3d1ed31d572c170851639fc1600cd3c6b4
1 ///
2 /// \file j_jdwp.h
3 /// JDWP classes
4 ///
6 /*
7 Copyright (C) 2009, Nicolas VIVIEN
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRYJDWP_JDWP_H__
23 #define __BARRYJDWP_JDWP_H__
25 #include "error.h"
27 namespace Barry {
29 // forward declarations
30 class Data;
32 namespace JDWP {
34 /// \addtogroup exceptions
35 /// @{
37 /// Thrown on low level JDWP errors.
38 class BXEXPORT Error : public Barry::Error
40 int m_errcode;
42 public:
43 Error(const std::string &str);
44 Error(int errcode, const std::string &str);
46 // can return 0 in some case, if unknown error code
47 int errcode() const { return m_errcode; }
50 class BXEXPORT Timeout : public Error
52 public:
53 Timeout(const std::string &str) : Error(str) {}
54 Timeout(int errcode, const std::string &str)
55 : Error(errcode, str) {}
58 /// @}
62 class JDWP
64 private:
65 int m_lasterror;
67 protected:
69 public:
70 JDWP();
71 ~JDWP();
73 bool Read(int socket, Barry::Data &data, int timeout = -1);
74 bool Write(int socket, const Barry::Data &data, int timeout = -1);
75 bool Write(int socket, const void *data, size_t size, int timeout = -1);
78 }} // namespace Barry::JDWP
80 #endif