/docs/MyDocs

To get this branch, use:
bzr branch http://darksoft.org/webbzr/docs/MyDocs

« back to all changes in this revision

Viewing changes to Development/parsers/test/parser_vars.hpp

  • Committer: Suren A. Chilingaryan
  • Date: 2009-04-09 03:21:08 UTC
  • Revision ID: csa@dside.dyndns.org-20090409032108-w4edamdh4adrgdu3
import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <map>
 
2
#include <string>
 
3
 
 
4
 
 
5
class Variables {
 
6
 private:    
 
7
    std::map<std::string, double> vars;
 
8
 
 
9
 public:
 
10
    Variables() {}
 
11
    ~Variables() {}
 
12
 
 
13
    void Set(const char *var, double value) {
 
14
        vars[var] = value;
 
15
    }
 
16
    
 
17
    double Get(const char *var) {
 
18
        std::map<std::string, double>::iterator i = vars.find(var);
 
19
        if (i == vars.end()) return 0;
 
20
        return i->second;
 
21
    }
 
22
};