OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
locals.hpp
Go to the documentation of this file.
1 #ifndef COMPILER_LOCALS_H_INCLUDED
2 #define COMPILER_LOCALS_H_INCLUDED
3 
4 #include <vector>
5 #include <string>
6 #include <iosfwd>
7 
8 namespace Compiler
9 {
11 
12  class Locals
13  {
14  std::vector<std::string> mShorts;
15  std::vector<std::string> mLongs;
16  std::vector<std::string> mFloats;
17 
18  std::vector<std::string>& get (char type);
19 
20  public:
21 
22  char getType (const std::string& name) const;
24 
25  int getIndex (const std::string& name) const;
27 
28  bool search (char type, const std::string& name) const;
29 
32  int searchIndex (char type, const std::string& name) const;
33 
34  const std::vector<std::string>& get (char type) const;
35 
36  void write (std::ostream& localFile) const;
38 
39  void declare (char type, const std::string& name);
41 
42  void clear();
44  };
45 }
46 
47 #endif
char getType(const std::string &name) const
's': short, 'l': long, 'f': float, ' ': does not exist.
Definition: locals.cpp:55
void write(std::ostream &localFile) const
write declarations to file.
Definition: locals.cpp:84
std::vector< std::string > mShorts
Definition: locals.hpp:14
void clear()
remove all declarations.
Definition: locals.cpp:104
std::vector< std::string > mLongs
Definition: locals.hpp:15
int getIndex(const std::string &name) const
return index for local variable name (-1: does not exist).
Definition: locals.cpp:69
void declare(char type, const std::string &name)
declares a variable.
Definition: locals.cpp:99
std::vector< std::string > mFloats
Definition: locals.hpp:16
Local variable declarations.
Definition: locals.hpp:12
int searchIndex(char type, const std::string &name) const
Definition: locals.cpp:25
bool search(char type, const std::string &name) const
Definition: locals.cpp:38
const char * name
Definition: crashcatcher.cpp:59