include/EDoc/FunctionLoc.h

Go to the documentation of this file.
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_FUNCTIONLOC_H
00020 #define EDOC_FUNCTIONLOC_H
00021 
00022 #include "EDoc/DictionarySpecific.h"
00023 #include "EDoc/Location.h"
00024 
00025 #include <list>
00026 
00027 namespace EDoc
00028 {
00029    class Function;
00030    class Type;
00031    class PStack;
00032    
00033    //===========================================================================
00034    /** \brief Is a conglomerate of a reference to a Function object and a
00035     * Location in a source file.
00036     *
00037     * This can be used for a few purposes one of which is to store data for a
00038     * function call. This way the function that is being called is stored along
00039     * with the location in the source code from which the call is made for
00040     * debugging purposes.
00041     */
00042    class FunctionLoc : public DictionarySpecific
00043    {
00044    public:
00045 
00046       //------------------------------------------------------------------------
00047       /** \brief Create a new FunctionLoc given the dictionary, a function to 
00048        * reference and the location.
00049        */
00050       FunctionLoc(Dictionary& dict_in, Function* value_in, 
00051          const Location& loc_in);
00052 
00053       //------------------------------------------------------------------------
00054       /** \brief See CodeBlock::CodeBlock(Dictionary* dict_in=NULL)
00055        */
00056       FunctionLoc(Dictionary* dict_in=NULL);
00057 
00058       //------------------------------------------------------------------------
00059       /** \brief See CodeBlock::CodeBlock(const CodeBlock& right)
00060        */
00061       FunctionLoc(const FunctionLoc& right);
00062 
00063       //------------------------------------------------------------------------
00064       /** \brief See CodeBlock::CodeBlock(const CodeBlock& right, 
00065        * Dictionary& dict_in)
00066        */
00067       FunctionLoc(const FunctionLoc& right, Dictionary& dict_in);
00068 
00069       //------------------------------------------------------------------------
00070       /** \brief See CodeBlock::operator=()
00071        */
00072       FunctionLoc& operator=(const FunctionLoc& right);
00073 
00074       //------------------------------------------------------------------------
00075       /** \brief See CodeBlock::Read()
00076        */
00077       void Read(PersistenceIFace& file, IndexedDictionary& idict);
00078 
00079       //------------------------------------------------------------------------
00080       /** \brief See CodeBlock::Write()
00081        */
00082       void Write(PersistenceIFace& file) const;
00083 
00084       //------------------------------------------------------------------------
00085       /** \brief See DictionarySpecific::ReplaceReferences()
00086        */
00087       virtual size_t ReplaceReferences(PStack& stack, 
00088          void* remove, void* replace);
00089 
00090       //------------------------------------------------------------------------
00091       /** \brief See DictionarySpecific::Print()
00092        */
00093       virtual std::ostream& Print(std::ostream& out, 
00094          std::string prefix="") const;
00095 
00096       //------------------------------------------------------------------------
00097       /** \brief See DictionarySpecific::Validate()
00098        */
00099       virtual void Validate(PStack& stack, const Dictionary& dict_in) const;
00100 
00101       //------------------------------------------------------------------------
00102       /** \brief Equivilance operator (Works across dictionaries).
00103        */
00104       bool operator==(const FunctionLoc& right) const;
00105 
00106       //------------------------------------------------------------------------
00107       /** \brief Less than comparison so this can be used for std::map keys.
00108        *
00109        * Compares Location first then Function instances.
00110        */
00111       bool operator<(const FunctionLoc& right) const;
00112 
00113 
00114 
00115 
00116 
00117 
00118       //------------------------------------------------------------------------
00119       /** \brief A location in a source file.
00120        */
00121       Location loc;
00122 
00123       //------------------------------------------------------------------------
00124       /** \brief A reference to a Function.
00125        *
00126        * Note: As part of a propagating exception instance this value may be
00127        * NULL indicating that the propagating exception is an originating 
00128        * exception. So remember that this may have at some points a NULL value.
00129        */
00130       Function* value;
00131 
00132       //------------------------------------------------------------------------
00133       /** \brief When this object respresents a function call, then this flag
00134        * is true if the call is a "possible" call and not an explicit call.
00135        *
00136        * A possible call is one that results from a function pointer call or a
00137        * virtual function call.
00138        */
00139       bool possible;
00140 
00141 
00142 
00143       //------------------------------------------------------------------------
00144       // Public Temporary Data values.
00145       //------------------------------------------------------------------------
00146 
00147       //------------------------------------------------------------------------
00148       /** \brief USED ONLY FROM Dictionary::CalculatePropogatingExceptions()
00149        *
00150        * Data used by the CalculatePropogatingExceptions in order to
00151        * determine if a function loc object represents the current function
00152        * whose exception list is being calculated. This is really just temporary
00153        * data and does not belong here, but it is the simplest place to put it.
00154        */
00155       bool is_top_level;
00156       
00157       //------------------------------------------------------------------------
00158    };
00159    //===========================================================================
00160    typedef std::list<FunctionLoc> FuncLocList;
00161 }
00162 
00163 #endif // EDOC_FUNCTIONLOC_H

Generated on Tue Jan 20 18:26:07 2009 for EDoc-0.2.1 by  doxygen 1.5.1