00001 /******************************************************************************* 00002 00003 Copyright (C) 2007 by Brendon Costa 00004 00005 This library is free software; you can redistribute it and/or modify 00006 it under the terms of the "LGPL Like" License defined in the file COPYING 00007 that should have been distributed along with this source. 00008 00009 This library 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. 00012 00013 You should have received a copy of the "LGPL Like" License 00014 along with this library; see the file COPYING. if not, it can be 00015 obtained from the EDoc++ website: 00016 http://edoc.sourceforge.net/license.html 00017 00018 *******************************************************************************/ 00019 #ifndef EDOC_FUNCTIONTYPELOC_H 00020 #define EDOC_FUNCTIONTYPELOC_H 00021 00022 #include "EDoc/DictionarySpecific.h" 00023 #include "EDoc/Location.h" 00024 #include <list> 00025 00026 namespace EDoc 00027 { 00028 class FunctionType; 00029 class Type; 00030 class PStack; 00031 00032 //=========================================================================== 00033 /** \brief Is a conglomerate of a reference to a FunctionType object and a 00034 * Location in a source file. 00035 * 00036 * This can be used for a few purposes one of which is to store data for a 00037 * function pointer call. 00038 */ 00039 class FunctionTypeLoc : public DictionarySpecific 00040 { 00041 public: 00042 00043 //------------------------------------------------------------------------ 00044 /** \brief Create a new FunctionTypeLoc given the dictionary, a 00045 * function type to reference and the location. 00046 */ 00047 FunctionTypeLoc(Dictionary& dict_in, FunctionType* value_in, 00048 const Location& loc_in); 00049 00050 //------------------------------------------------------------------------ 00051 /** \brief See CodeBlock::CodeBlock(Dictionary* dict_in=NULL) 00052 */ 00053 FunctionTypeLoc(Dictionary* dict_in = NULL); 00054 00055 //------------------------------------------------------------------------ 00056 /** \brief See CodeBlock::CodeBlock(const CodeBlock& right) 00057 */ 00058 FunctionTypeLoc(const FunctionTypeLoc& right); 00059 00060 //------------------------------------------------------------------------ 00061 /** \brief See CodeBlock::CodeBlock(const CodeBlock& right, 00062 * Dictionary& dict_in) 00063 */ 00064 FunctionTypeLoc(const FunctionTypeLoc& right, Dictionary& dict_in); 00065 00066 //------------------------------------------------------------------------ 00067 /** \brief See CodeBlock::operator=() 00068 */ 00069 FunctionTypeLoc& operator=(const FunctionTypeLoc& right); 00070 00071 //------------------------------------------------------------------------ 00072 /** \brief See CodeBlock::Read() 00073 */ 00074 void Read(PersistenceIFace& file, IndexedDictionary& idict); 00075 00076 //------------------------------------------------------------------------ 00077 /** \brief See CodeBlock::Write() 00078 */ 00079 void Write(PersistenceIFace& file) const; 00080 00081 //------------------------------------------------------------------------ 00082 /** \brief See DictionarySpecific::ReplaceReferences() 00083 */ 00084 virtual size_t ReplaceReferences(PStack& stack, 00085 void* remove, void* replace); 00086 00087 //------------------------------------------------------------------------ 00088 /** \brief See DictionarySpecific::Print() 00089 */ 00090 virtual std::ostream& Print(std::ostream& out, 00091 std::string prefix="") const; 00092 00093 //------------------------------------------------------------------------ 00094 /** \brief See DictionarySpecific::Validate() 00095 */ 00096 virtual void Validate(PStack& stack, const Dictionary& dict_in) const; 00097 00098 //------------------------------------------------------------------------ 00099 /** \brief Equivilance operator (Works across dictionaries). 00100 */ 00101 bool operator==(const FunctionTypeLoc& right) const; 00102 00103 //------------------------------------------------------------------------ 00104 /** \brief Less than comparison so this can be used for std::map keys. 00105 * 00106 * Compares Location first then FunctionType instances. 00107 */ 00108 bool operator<(const FunctionTypeLoc& right) const; 00109 00110 00111 00112 00113 00114 00115 //------------------------------------------------------------------------ 00116 /** \brief A location in a source file. 00117 */ 00118 Location loc; 00119 00120 //------------------------------------------------------------------------ 00121 /** \brief A reference to a FunctionType. 00122 */ 00123 FunctionType* value; 00124 00125 }; 00126 //=========================================================================== 00127 typedef std::list<FunctionTypeLoc> FTypeLocList; 00128 } 00129 00130 #endif // EDOC_FUNCTIONTYPELOC_H