uclabel.h

Go to the documentation of this file.
00001 /*
00002 Copyright (C) 2002 The Exult Team
00003 
00004 This program is free software; you can redistribute it and/or
00005 modify it under the terms of the GNU General Public License
00006 as published by the Free Software Foundation; either version 2
00007 of the License, or (at your option) any later version.
00008 
00009 This program is distributed in the hope that it will be useful,
00010 but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 GNU General Public License for more details.
00013 
00014 You should have received a copy of the GNU General Public License
00015 along with this program; if not, write to the Free Software
00016 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00017 */
00018 
00019 #ifndef INCL_UCLABEL
00020 #define INCL_UCLABEL
00021 
00022 #include <string>
00023 #include <vector>
00024 
00025 class Uc_label
00026 {
00027  private:
00028   std::string name;     // This will be the key.
00029   std::vector<int> references; // jumps in the output to this label
00030                                         // contains absolute offsets
00031   int offset;  // location of the label
00032   bool valid;
00033  public:
00034   Uc_label(std::string n) : name(n), offset(0), valid(false)
00035     { }
00036   Uc_label(std::string n, int o) : name(n), offset(o), valid(true)
00037     { }
00038 
00039   std::string& get_name() { return name; }
00040   std::vector<int>& get_references() { return references; }
00041   int get_offset() const { return offset; }
00042   bool is_valid() const { return valid; }
00043 
00044   bool set_offset(int o)
00045   {
00046     if (valid)
00047       return false;
00048     valid = true;
00049     offset = o;
00050   }
00051 
00052   void add_reference(int offset)
00053   {
00054     references.push_back(offset);
00055   }
00056 };
00057 
00058 
00059 #endif

Generated on Mon Jul 9 14:42:51 2007 for ExultEngine by  doxygen 1.5.1