Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

YCPCode.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |  
00003 |                      __   __    ____ _____ ____                      |  
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |  
00005 |                       \ V / _` \___ \ | |   __) |                    |  
00006 |                        | | (_| |___) || |  / __/                     |  
00007 |                        |_|\__,_|____/ |_| |_____|                    |  
00008 |                                                                      |  
00009 |                               core system                            | 
00010 |                                                        (C) SuSE GmbH |  
00011 \----------------------------------------------------------------------/ 
00012 
00013    File:       YCPCode.h
00014 
00015    Author:      Klaus Kaempf <kkaempf@suse.de>
00016    Maintainer:  Klaus Kaempf <kkaempf@suse.de>
00017 
00018    Wrappers for YCode data as YCPValue
00019 
00020 /-*/
00021 // -*- c++ -*-
00022 
00023 #ifndef YCPCode_h
00024 #define YCPCode_h
00025 
00026 
00027 #include "ycp/YCPValue.h"
00028 #include "ycp/YCode.h"
00029 #include "ycp/SymbolEntry.h"
00030 
00031 //---------------------------------------------------------------------------
00032 // YCPCode
00033 
00037 class YCPCodeRep : public YCPValueRep
00038 {
00039     YCodePtr m_code;
00040 
00041 protected:
00042     friend class YCPCode;
00043 
00047     YCPCodeRep();
00048     YCPCodeRep (YCodePtr c);
00049 
00053     ~YCPCodeRep();
00054 
00055 public:
00056     YCodePtr code() const;
00057 
00062     YCPOrder compare (const YCPCode &v) const;
00063 
00067     string toString() const;
00068 
00072     std::ostream & toStream (std::ostream & str) const;
00073 
00077     YCPValueType valuetype() const;
00078 
00082     YCPValue evaluate (bool cse = false) const;
00083 };
00084 
00085 
00092 class YCPCode : public YCPValue
00093 {
00094     DEF_COMMON(Code, Value);
00095 public:
00096     YCPCode() : YCPValue (new YCPCodeRep ()) {}
00097     YCPCode (YCodePtr code) : YCPValue (new YCPCodeRep (code)) {}
00098     YCPCode (std::istream & str);
00099 };
00100 
00101 
00102 //---------------------------------------------------------------------------
00103 // YCPBreak
00104 
00105 
00114 class YCPBreakRep : public YCPValueRep
00115 {
00116 protected:
00117     friend class YCPBreak;
00118 
00122     YCPBreakRep () {};
00123 
00127     ~YCPBreakRep() {}
00128 
00129 public:
00134     YCPOrder compare (const YCPBreak &v) const { return YO_EQUAL; }
00135 
00140     string toString() const { return "nil"; }
00141 
00145     std::ostream & toStream (std::ostream & str) const { return str; };
00146 
00150     YCPValueType valuetype() const { return YT_BREAK; }
00151 
00152 };
00153 
00160 class YCPBreak : public YCPValue
00161 {
00162     DEF_COMMON(Break, Value);
00163 public:
00164     YCPBreak() : YCPValue (new YCPBreakRep ()) {}
00165     YCPBreak (std::istream & str) : YCPValue (new YCPBreakRep ()) {}
00166 };
00167 
00168 
00169 //---------------------------------------------------------------------------
00170 // YCPReturn
00171 
00182 class YCPReturnRep : public YCPValueRep
00183 {
00184 protected:
00185     friend class YCPReturn;
00186 
00190     YCPReturnRep() {}
00191 
00195     ~YCPReturnRep() {}
00196 
00197 public:
00202     YCPOrder compare (const YCPReturn &v) const { return YO_EQUAL; }
00203 
00207     string toString() const { return "nil"; }
00208 
00212     std::ostream & toStream (std::ostream & str) const { return str; };
00213 
00217     YCPValueType valuetype() const { return YT_RETURN; }
00218 
00219 };
00220 
00227 class YCPReturn : public YCPValue
00228 {
00229     DEF_COMMON(Return, Value);
00230 public:
00231     YCPReturn() : YCPValue (new YCPReturnRep ()) {}
00232     YCPReturn(std::istream & str) : YCPValue (new YCPReturnRep ()) {}
00233 };
00234 
00235 
00236 //---------------------------------------------------------------------------
00237 // YCPEntry
00238 
00239 
00243 class YCPEntryRep : public YCPValueRep
00244 {
00245     SymbolEntryPtr m_entry;
00246 
00247 protected:
00248     friend class YCPEntry;
00249 
00253     YCPEntryRep ();
00254     YCPEntryRep (SymbolEntryPtr entry);
00255 
00259     ~YCPEntryRep() {}
00260 
00261 public:
00262     SymbolEntryPtr entry() const;
00263 
00268     YCPOrder compare (const YCPEntry &v) const;
00269 
00273     string toString() const;
00274 
00278     std::ostream & toStream (std::ostream & str) const;
00279 
00283     YCPValueType valuetype() const;
00284 
00288     YCPValue evaluate (bool cse = false) const;
00289 };
00290 
00291 
00298 class YCPEntry : public YCPValue
00299 {
00300     DEF_COMMON(Entry, Value);
00301 public:
00302     YCPEntry (SymbolEntryPtr entry) : YCPValue (new YCPEntryRep (entry)) {}
00303     YCPEntry (std::istream & str);
00304 };
00305 
00306 
00307 //---------------------------------------------------------------------------
00308 // YCPReference
00309 
00310 
00314 class YCPReferenceRep : public YCPValueRep
00315 {
00316     SymbolEntryPtr m_entry;
00317 
00318 protected:
00319     friend class YCPReference;
00320 
00324     YCPReferenceRep ();
00325     YCPReferenceRep (SymbolEntryPtr entry);
00326 
00330     ~YCPReferenceRep() {}
00331 
00332 public:
00333     SymbolEntryPtr entry() const;
00334 
00339     YCPOrder compare (const YCPReference &v) const;
00340 
00344     string toString() const;
00345 
00349     std::ostream & toStream (std::ostream & str) const;
00350 
00354     YCPValueType valuetype() const;
00355 
00359     YCPValue evaluate (bool cse = false) const;
00360 };
00361 
00362 
00369 class YCPReference : public YCPValue
00370 {
00371     DEF_COMMON(Reference, Value);
00372 public:
00373     YCPReference (SymbolEntryPtr entry) : YCPValue (new YCPReferenceRep (entry)) {}
00374     YCPReference (std::istream & str);
00375 };
00376 
00377 #endif   // YCPCode_h

Generated on Fri Nov 9 18:15:22 2007 for yast2-core by doxygen 1.3.6