00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef YCPCode_h
00024 #define YCPCode_h
00025
00026
00027 #include "ycp/YCPValue.h"
00028 #include "ycp/YCode.h"
00029 #include "y2/SymbolEntry.h"
00030
00031
00032
00033
00034 class YCPBreak;
00035 class YCPReturn;
00036
00040 class YCPCodeRep : public YCPValueRep
00041 {
00042 YCodePtr m_code;
00043
00044 protected:
00045 friend class YCPCode;
00046
00050 YCPCodeRep();
00051 YCPCodeRep (YCodePtr c);
00052
00056 ~YCPCodeRep();
00057
00058 public:
00059 YCodePtr code() const;
00060
00065 YCPOrder compare (const YCPCode &v) const;
00066
00070 string toString() const;
00071
00075 std::ostream & toStream (std::ostream & str) const;
00076 std::ostream & toXml (std::ostream & str, int indent ) const;
00077
00081 YCPValueType valuetype() const;
00082
00086 YCPValue evaluate (bool cse = false) const;
00087 };
00088
00089
00096 class YCPCode : public YCPValue
00097 {
00098 DEF_COMMON(Code, Value);
00099 public:
00100 YCPCode() : YCPValue (new YCPCodeRep ()) {}
00101 YCPCode (YCodePtr code) : YCPValue (new YCPCodeRep (code)) {}
00102 YCPCode (bytecodeistream & str);
00103 };
00104
00105
00106
00107
00108
00109
00118 class YCPBreakRep : public YCPValueRep
00119 {
00120 protected:
00121 friend class YCPBreak;
00122
00126 YCPBreakRep () {};
00127
00131 ~YCPBreakRep() {}
00132
00133 public:
00138 YCPOrder compare (const YCPBreak &) const { return YO_EQUAL; }
00139
00144 string toString() const { return "nil"; }
00145
00149 std::ostream & toStream (std::ostream & str) const { return str; };
00150 std::ostream & toXml (std::ostream & str, int indent ) const;
00151
00155 YCPValueType valuetype() const { return YT_BREAK; }
00156
00157 };
00158
00165 class YCPBreak : public YCPValue
00166 {
00167 DEF_COMMON(Break, Value);
00168 public:
00169 YCPBreak() : YCPValue (new YCPBreakRep ()) {}
00170 YCPBreak (bytecodeistream &) : YCPValue (new YCPBreakRep ()) {}
00171 };
00172
00173
00174
00175
00176
00187 class YCPReturnRep : public YCPValueRep
00188 {
00189 protected:
00190 friend class YCPReturn;
00191
00195 YCPReturnRep() {}
00196
00200 ~YCPReturnRep() {}
00201
00202 public:
00207 YCPOrder compare (const YCPReturn &) const { return YO_EQUAL; }
00208
00212 string toString() const { return "nil"; }
00213
00217 std::ostream & toStream (std::ostream & str) const { return str; };
00218 std::ostream & toXml (std::ostream & str, int indent ) const;
00219
00223 YCPValueType valuetype() const { return YT_RETURN; }
00224
00225 };
00226
00233 class YCPReturn : public YCPValue
00234 {
00235 DEF_COMMON(Return, Value);
00236 public:
00237 YCPReturn() : YCPValue (new YCPReturnRep ()) {}
00238 YCPReturn(bytecodeistream &) : YCPValue (new YCPReturnRep ()) {}
00239 };
00240
00241
00242
00243
00244
00245
00249 class YCPEntryRep : public YCPValueRep
00250 {
00251 SymbolEntryPtr m_entry;
00252
00253 protected:
00254 friend class YCPEntry;
00255
00259 YCPEntryRep ();
00260 YCPEntryRep (SymbolEntryPtr entry);
00261
00265 ~YCPEntryRep() {}
00266
00267 public:
00268 SymbolEntryPtr entry() const;
00269
00274 YCPOrder compare (const YCPEntry &v) const;
00275
00279 string toString() const;
00280
00284 std::ostream & toStream (std::ostream & str) const;
00285 std::ostream & toXml (std::ostream & str, int indent ) const;
00286
00290 YCPValueType valuetype() const;
00291
00295 YCPValue evaluate (bool cse = false) const;
00296 };
00297
00298
00305 class YCPEntry : public YCPValue
00306 {
00307 DEF_COMMON(Entry, Value);
00308 public:
00309 YCPEntry (SymbolEntryPtr entry) : YCPValue (new YCPEntryRep (entry)) {}
00310 YCPEntry (bytecodeistream & str);
00311 };
00312
00313
00314
00315
00316
00317
00321 class YCPReferenceRep : public YCPValueRep
00322 {
00323 SymbolEntryPtr m_entry;
00324
00325 protected:
00326 friend class YCPReference;
00327
00331 YCPReferenceRep ();
00332 YCPReferenceRep (SymbolEntryPtr entry);
00333
00337 ~YCPReferenceRep() {}
00338
00339 public:
00340 SymbolEntryPtr entry() const;
00341
00346 YCPOrder compare (const YCPReference &v) const;
00347
00351 string toString() const;
00352
00356 std::ostream & toStream (std::ostream & str) const;
00357 std::ostream & toXml (std::ostream & str, int indent ) const;
00358
00362 YCPValueType valuetype() const;
00363
00367 YCPValue evaluate (bool cse = false) const;
00368 };
00369
00370
00377 class YCPReference : public YCPValue
00378 {
00379 DEF_COMMON(Reference, Value);
00380 public:
00381 YCPReference (SymbolEntryPtr entry) : YCPValue (new YCPReferenceRep (entry)) {}
00382 };
00383
00384 #endif // YCPCode_h