commore  1.0.6-SNAPSHOT
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Symbol.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2006-2014 Raphael David / CANTOR
3 //
4 
5 #ifndef CMR_SYMBOL_INCLUDED
6 #define CMR_SYMBOL_INCLUDED
7 
8 #include "Commore.h"
9 #include "AString.h"
10 
11 
12 namespace commore
13 {
14  struct SymbolItem;
18  class CMREXD Symbol
19  {
20  friend class Tuple;
21  public:
22  Symbol();
26  Symbol(const AChar* name);
30  Symbol(const AString& name);
31  Symbol(const Symbol& name);
35  Symbol(size_t num);
36  Symbol& operator = (const Symbol&);
40  operator const AString& () const { return get_name(); }
44  operator const AChar* () const { return get_name(); }
48  operator size_t () const { return get_num(); }
49  ~Symbol();
50 
51  public:
55  const AString& get_name() const;
59  size_t get_num() const;
60 
64  bool operator == (const AChar* name) const { return get_name() == name; }
65  bool operator == (const AString& name) const { return get_name() == name; }
69  bool operator == (size_t num) const { return get_num() == num; }
73  bool operator != (const AChar* name) const { return get_name() != name; }
74  bool operator != (const AString& name) const { return get_name() != name; }
78  bool operator != (size_t num) const { return get_num() != num; }
82  bool operator == (const Symbol& symbol) const { return symb_ == symbol.symb_; }
86  bool operator != (const Symbol& symbol) const { return symb_ != symbol.symb_; }
90  bool operator < (const Symbol& symbol) const { return get_name() < symbol.get_name(); }
91  bool operator > (const Symbol& symbol) const { return get_name() > symbol.get_name(); }
92  int compare(const Symbol& s) const { return get_name().compare(s.get_name()); }
96  bool is_ident() const;
100  long read_xml(IBStream& i);
104  long write_xml(OBStream& o) const;
105 
106  private:
107  SymbolItem* symb_;
108  };
109 };
110 
112 
113 #endif
Definition: Tuple.h:29
Definition: AString.h:39
long CMREXD write_xml(const AString &sIn, OBStream &o)
Definition: AString.cpp:27
int compare(const Symbol &s) const
Definition: Symbol.h:92
Definition: Symbol.cpp:21
Definition: Symbol.h:18
CMREXD commore::OBStream & operator<<(commore::OBStream &o, const commore::Symbol &s)
Definition: Symbol.cpp:258
char AChar
Definition: Type.h:65
#define CMREXD
Definition: Compiler.h:22
bool operator==(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
Definition: HMap.h:148
long CMREXD read_xml(AString &sOut, IBStream &i)
Definition: AString.cpp:65
bool operator<(const pair< T1, T2 > &x, const pair< T1, T2 > &y)
Definition: HMap.h:155
Definition: IOBStream.h:166
Definition: IOBStream.h:29
const AString & get_name() const
Definition: Symbol.cpp:186