00001 /*---------------------------------------------------------------------\ 00002 | | 00003 | __ __ ____ _____ ____ | 00004 | \ \ / /_ _/ ___|_ _|___ \ | 00005 | \ V / _` \___ \ | | __) | | 00006 | | | (_| |___) || | / __/ | 00007 | |_|\__,_|____/ |_| |_____| | 00008 | | 00009 | core system | 00010 | (C) SuSE GmbH | 00011 \----------------------------------------------------------------------/ 00012 00013 File: YCPByteblock.h 00014 00015 Author: Mathias Kettner <kettner@suse.de> 00016 Maintainer: Thomas Roelz <tom@suse.de> 00017 00018 /-*/ 00019 // -*- c++ -*- 00020 00021 #ifndef YCPByteblock_h 00022 #define YCPByteblock_h 00023 00024 00025 #include "YCPValue.h" 00026 00027 00031 class YCPByteblockRep : public YCPValueRep 00032 { 00036 const unsigned char *bytes; 00037 00041 long len; 00042 00043 protected: 00044 friend class YCPByteblock; 00045 00052 YCPByteblockRep(const unsigned char *bytes, long len); 00053 00058 YCPByteblockRep (bytecodeistream & str, long len); 00059 00063 ~YCPByteblockRep(); 00064 00065 public: 00069 const unsigned char *value() const; 00070 00074 long size() const; 00075 00082 string toString() const; 00083 00087 std::ostream & toStream (std::ostream & str) const; 00088 00092 YCPOrder compare(const YCPByteblock& s) const; 00093 00097 YCPValueType valuetype() const; 00098 }; 00099 00100 00107 class YCPByteblock : public YCPValue 00108 { 00109 DEF_COMMON(Byteblock, Value); 00110 public: 00111 YCPByteblock(const unsigned char *r, long l) : YCPValue(new YCPByteblockRep(r, l)) {} 00112 YCPByteblock(bytecodeistream & str); 00113 }; 00114 00115 00116 #endif // YCPByteblock_h