yast2-core
Import.h
Go to the documentation of this file.
1 /*---------------------------------------------------------*- c++ -*---\
2 | |
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
8 | |
9 | core system |
10 | Copyright (C) SuSE Linux AG |
11 \----------------------------------------------------------------------/
12 
13  File: Import.h
14 
15  Author: Klaus Kaempf <kkaempf@suse.de>
16  Maintainer: Klaus Kaempf <kkaempf@suse.de>
17 
18 /-*/
19 // -*- c++ -*-
20 
21 #ifndef Import_h
22 #define Import_h
23 
24 #include <string>
25 #include <stack>
26 using std::string;
27 
28 #include "ycp/YCode.h"
29 #include "ycp/SymbolTable.h"
30 #include "ycp/YSymbolEntry.h"
31 
32 class SymbolEntry;
33 class Y2Namespace;
34 
36 class Import {
37  // track tables of nested imports, no need to track their usage
38 
39  static int m_disable_tracking;
40  static std::stack <std::pair <string, SymbolTable *> > m_table_stack;
41 public:
42  static void disableTracking ();
43  static void enableTracking ();
44 
45 public:
46  // module block pointer, pointer to constructor
47  // map of name : module_entry
48  typedef std::map<std::string, Y2Namespace *> module_map;
49 
50 
51 protected:
52  static module_map m_active_modules;
53 
55 
56  // iterator to share the module state on multiple imports
57  module_map::iterator m_module;
58 
59 public:
60  Import ();
61 
62  // load module by name. If block != 0, it's already loaded
63  // name_space is non-const since it might get evaluated
64  Import (const string &name, Y2Namespace *name_space = 0);
65  ~Import ();
66 
67  int import (const string &name, Y2Namespace *preloaded_namespace = 0); // delayed import, use in case default constructor was used
68 
69  string name () const;
70  Y2Namespace *nameSpace () const; // return NULL on failure
71 };
72 
73 #endif // Import_h
static void disableTracking()
Definition: Import.cc:155
Definition: SymbolEntry.h:41
module_map::iterator m_module
Definition: Import.h:57
static std::stack< std::pair< string, SymbolTable * > > m_table_stack
Definition: Import.h:40
string name() const
Definition: Import.cc:190
instantiate to import a module
Definition: Import.h:36
~Import()
Definition: Import.cc:58
Unique strings.
Definition: Ustring.h:124
static int m_disable_tracking
Definition: Import.h:39
std::map< std::string, Y2Namespace * > module_map
Definition: Import.h:48
Import()
Definition: Import.cc:42
Y2Namespace * nameSpace() const
Definition: Import.cc:197
Definition: Y2Namespace.h:43
static module_map m_active_modules
Definition: Import.h:52
static void enableTracking()
Definition: Import.cc:166
Ustring m_name
Definition: Import.h:54

Generated on a sunny day for yast2-core by doxygen 1.8.8