]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h
Check In tool source code based on Build tool project revision r1655.
[mirror_edk2.git] / BaseTools / Source / C / VfrCompile / Pccts / h / ATokPtr.h
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h b/BaseTools/Source/C/VfrCompile/Pccts/h/ATokPtr.h
new file mode 100644 (file)
index 0000000..75b4c86
--- /dev/null
@@ -0,0 +1,88 @@
+/* ATokPtr.h\r
+ *\r
+ * SOFTWARE RIGHTS\r
+ *\r
+ * We reserve no LEGAL rights to the Purdue Compiler Construction Tool\r
+ * Set (PCCTS) -- PCCTS is in the public domain.  An individual or\r
+ * company may do whatever they wish with source code distributed with\r
+ * PCCTS or the code generated by PCCTS, including the incorporation of\r
+ * PCCTS, or its output, into commerical software.\r
+ *\r
+ * We encourage users to develop software with PCCTS.  However, we do ask\r
+ * that credit is given to us for developing PCCTS.  By "credit",\r
+ * we mean that if you incorporate our source code into one of your\r
+ * programs (commercial product, research project, or otherwise) that you\r
+ * acknowledge this fact somewhere in the documentation, research report,\r
+ * etc...  If you like PCCTS and have developed a nice tool with the\r
+ * output, please mention that you developed it using PCCTS.  In\r
+ * addition, we ask that this header remain intact in our source code.\r
+ * As long as these guidelines are kept, we expect to continue enhancing\r
+ * this system and expect to make other tools available as they are\r
+ * completed.\r
+ *\r
+ * ANTLR 1.33\r
+ * Written by Russell Quong June 30, 1995\r
+ * Adapted by Terence Parr to ANTLR stuff\r
+ * Parr Research Corporation\r
+ * with Purdue University and AHPCRC, University of Minnesota\r
+ * 1989-2000\r
+ */\r
+\r
+#ifndef ATokPtr_h\r
+#define ATokPtr_h\r
+\r
+#include "pcctscfg.h"\r
+\r
+#include "pccts_stdio.h"\r
+\r
+PCCTS_NAMESPACE_STD\r
+\r
+// pointer to a reference counted object\r
+// robust in that an unused ANTLRTokenPtr can point to NULL.\r
+\r
+class ANTLRAbstractToken;\r
+\r
+class DllExportPCCTS ANTLRTokenPtr {\r
+public:\r
+    ANTLRTokenPtr(ANTLRAbstractToken *addr=NULL){ptr_ = addr; ref();}\r
+    ANTLRTokenPtr(const ANTLRTokenPtr &lhs)    {ptr_ = lhs.ptr_; lhs.ref();}\r
+    ~ANTLRTokenPtr();\r
+\r
+    // use ANTLRTokenPtr as a pointer to ANTLRToken\r
+//\r
+//  8-Apr-97   MR1     Make operator -> a const member function\r
+//                       as well as some other member functions\r
+//\r
+    ANTLRAbstractToken *operator-> () const { return ptr_; }           // MR1\r
+//\r
+//  7-Apr-97 133MR1\r
+//          Fix suggested by Andreas Magnusson\r
+//                     (Andreas.Magnusson@mailbox.swipnet.se)\r
+    void operator = (const ANTLRTokenPtr & lhs);                       // MR1\r
+    void operator = (ANTLRAbstractToken *addr);\r
+    int operator != (const ANTLRTokenPtr &q) const                     // MR1 // MR11 unsigned -> int\r
+       { return this->ptr_ != q.ptr_; }\r
+    int operator == (const ANTLRTokenPtr &q) const                     // MR1 // MR11 unsigned -> int\r
+       { return this->ptr_ == q.ptr_; }\r
+    int operator == (const ANTLRAbstractToken *addr) const      // MR11\r
+    { return this->ptr_ == addr; }\r
+    int operator != (const ANTLRAbstractToken *addr) const      // MR11\r
+    { return this->ptr_ != addr; }\r
+\r
+    void ref() const;\r
+    void deref();\r
+\r
+protected:\r
+    ANTLRAbstractToken *ptr_;\r
+};\r
+\r
+//typedef ANTLRTokenPtr _ANTLRTokenPtr;\r
+\r
+/*\r
+ * Since you cannot redefine operator->() to return one of the user's\r
+ * token object types, we must down cast.  This is a drag.  Here's\r
+ * a macro that helps.  template: "mytoken(a-smart-ptr)->myfield".\r
+ */\r
+#define mytoken(tk) ((ANTLRToken *)(tk.operator->()))\r
+\r
+#endif\r