00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef YSymbolEntry_h
00023 #define YSymbolEntry_h
00024
00025 #include <y2util/Ustring.h>
00026 #include <y2util/RepDef.h>
00027
00028 #include <y2/SymbolEntry.h>
00029
00030 #include "ycp/YCPValue.h"
00031 #include "ycp/Type.h"
00032 #include "ycp/StaticDeclaration.h"
00033 #include "ycp/YCode.h"
00034
00035 #include <stack>
00036
00037 class Y2Namespace;
00038
00039 DEFINE_DERIVED_POINTER (YSymbolEntry, SymbolEntry);
00040
00041 class YSymbolEntry : public SymbolEntry {
00042 REP_BODY (YSymbolEntry);
00043
00056 union payload {
00057 Y2Namespace *m_namespace;
00058 declaration_t *m_decl;
00059 SymbolTable *m_table;
00060 } m_payload;
00061
00062
00063
00064
00065
00066
00067
00068 YCodePtr m_code;
00069
00070 public:
00071
00072 YSymbolEntry (const Y2Namespace* name_space, unsigned int position, const char *name, category_t cat, constTypePtr type, YCodePtr payload = 0);
00073
00074
00075 YSymbolEntry (const char *name, constTypePtr type, declaration_t *payload, const Y2Namespace *name_space = 0);
00076
00077
00078 YSymbolEntry (const char *name, constTypePtr type, SymbolTable *payload);
00079
00080
00081 YSymbolEntry (const char *filename);
00082
00083 YSymbolEntry (bytecodeistream & str, const Y2Namespace *name_space = 0);
00084
00085
00086 void setCode (YCodePtr code);
00087 YCodePtr code () const;
00088
00089
00090 virtual bool onlyDeclared () const;
00091
00092
00093 void setDeclaration (declaration_t *decl);
00094 declaration_t *declaration () const;
00095
00096
00097 void setTable (SymbolTable *table);
00098 SymbolTable *table() const;
00099
00100
00101 Y2Namespace *payloadNamespace () const;
00102 void setPayloadNamespace (Y2Namespace *name_space);
00103
00104 virtual string toString (bool with_type = true) const;
00105 std::ostream & toStream (std::ostream & str) const;
00106 std::ostream & toXml (std::ostream & str, int indent ) const;
00107 };
00108
00109 #endif // YSymbolEntry_h