Zhenkai Zhu | 43eb273 | 2012-12-28 00:48:26 -0800 | [diff] [blame] | 1 | #ifndef CCNX_CONTENT_OBJECT_H |
| 2 | #define CCNX_CONTENT_OBJECT_H |
| 3 | |
Zhenkai Zhu | 43eb273 | 2012-12-28 00:48:26 -0800 | [diff] [blame] | 4 | #include "ccnx-wrapper.h" |
Zhenkai Zhu | 974c5a6 | 2012-12-28 14:15:30 -0800 | [diff] [blame] | 5 | #include "ccnx-common.h" |
Zhenkai Zhu | cb2d0dd | 2013-01-03 14:10:48 -0800 | [diff] [blame] | 6 | #include "ccnx-name.h" |
Zhenkai Zhu | 43eb273 | 2012-12-28 00:48:26 -0800 | [diff] [blame] | 7 | |
| 8 | using namespace std; |
| 9 | |
| 10 | namespace Ccnx { |
| 11 | |
| 12 | struct MisformedContentObjectException : virtual boost::exception, virtual exception { }; |
| 13 | |
Zhenkai Zhu | 0d8f5d5 | 2012-12-30 12:54:07 -0800 | [diff] [blame] | 14 | class ParsedContentObject |
Zhenkai Zhu | 43eb273 | 2012-12-28 00:48:26 -0800 | [diff] [blame] | 15 | { |
| 16 | public: |
| 17 | ParsedContentObject(const unsigned char *data, size_t len); |
| 18 | ParsedContentObject(const Bytes &bytes); |
| 19 | ParsedContentObject(const ParsedContentObject &other); |
| 20 | virtual ~ParsedContentObject(); |
| 21 | |
| 22 | Bytes |
Zhenkai Zhu | bad089c | 2012-12-28 10:28:27 -0800 | [diff] [blame] | 23 | content() const; |
Zhenkai Zhu | 43eb273 | 2012-12-28 00:48:26 -0800 | [diff] [blame] | 24 | |
Alexander Afanasyev | dbc0671 | 2013-01-08 18:30:28 -0800 | [diff] [blame] | 25 | BytesPtr |
| 26 | contentPtr() const; |
| 27 | |
Zhenkai Zhu | cb2d0dd | 2013-01-03 14:10:48 -0800 | [diff] [blame] | 28 | Name |
Zhenkai Zhu | bad089c | 2012-12-28 10:28:27 -0800 | [diff] [blame] | 29 | name() const; |
Zhenkai Zhu | 43eb273 | 2012-12-28 00:48:26 -0800 | [diff] [blame] | 30 | |
Zhenkai Zhu | 9f2ef6f | 2013-01-04 21:46:08 -0800 | [diff] [blame] | 31 | private: |
| 32 | void |
| 33 | init(const unsigned char *data, size_t len); |
| 34 | |
Zhenkai Zhu | 43eb273 | 2012-12-28 00:48:26 -0800 | [diff] [blame] | 35 | protected: |
Zhenkai Zhu | 9061180 | 2013-01-04 21:30:24 -0800 | [diff] [blame] | 36 | ccn_parsed_ContentObject m_pco; |
| 37 | ccn_indexbuf *m_comps; |
| 38 | Bytes m_bytes; |
Zhenkai Zhu | 43eb273 | 2012-12-28 00:48:26 -0800 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | typedef boost::shared_ptr<ParsedContentObject> PcoPtr; |
| 42 | |
| 43 | } |
| 44 | |
| 45 | #endif // CCNX_CONTENT_OBJECT_H |