Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

Import.h

Go to the documentation of this file.
00001 /*---------------------------------------------------------*- c++ -*---\
00002 |                                                                      |
00003 |                      __   __    ____ _____ ____                      |
00004 |                      \ \ / /_ _/ ___|_   _|___ \                     |
00005 |                       \ V / _` \___ \ | |   __) |                    |
00006 |                        | | (_| |___) || |  / __/                     |
00007 |                        |_|\__,_|____/ |_| |_____|                    |
00008 |                                                                      |
00009 |                               core system                            |
00010 |                                          Copyright (C) SuSE Linux AG |
00011 \----------------------------------------------------------------------/
00012 
00013    File:        Import.h
00014 
00015    Author:      Klaus Kaempf <kkaempf@suse.de>
00016    Maintainer:  Klaus Kaempf <kkaempf@suse.de>
00017 
00018 /-*/
00019 // -*- c++ -*-
00020 
00021 #ifndef Import_h
00022 #define Import_h
00023 
00024 #include <string>
00025 #include <stack>
00026 using std::string;
00027 
00028 #include "ycp/YCode.h"
00029 #include "ycp/SymbolTable.h"
00030 #include "ycp/SymbolEntry.h"
00031 
00032 class SymbolEntry;
00033 class Y2Namespace;
00034 
00035 class Import {
00036     // track tables of nested imports, no need to track their usage
00037 
00038     static int m_disable_tracking;
00039     static std::stack <std::pair <string, SymbolTable *> > m_table_stack;
00040 public:
00041     static void disableTracking ();
00042     static void enableTracking ();
00043 
00044 public:
00045     // module block pointer, pointer to constructor
00046     // map of name : module_entry
00047     typedef std::map<std::string, Y2Namespace *> module_map;
00048 
00049 
00050 protected:
00051     static module_map m_active_modules;
00052 
00053     Ustring m_name;
00054 
00055     // iterator to share the module state on multiple imports
00056     module_map::iterator m_module;
00057 
00058 public:
00059     Import ();
00060 
00061     // load module by name. If block != 0, it's already loaded
00062     //   name_space is non-const since it might get evaluated
00063     Import (const string &name, Y2Namespace *name_space = 0);
00064     ~Import ();
00065 
00066     int import (const string &name, Y2Namespace *preloaded_namespace = 0);              // delayed import, use in case default constructor was used
00067 
00068     string name () const;
00069     Y2Namespace *nameSpace () const;            // return NULL on failure
00070 };
00071 
00072 #endif   // Import_h

Generated on Fri Nov 9 18:15:22 2007 for yast2-core by doxygen 1.3.6