/[ascend]/trunk/pygtk/symchar.cpp
ViewVC logotype

Annotation of /trunk/pygtk/symchar.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 532 - (hide annotations) (download) (as text)
Mon Apr 24 02:23:08 2006 UTC (14 years, 1 month ago) by johnpye
File MIME type: text/x-c++src
File size: 1247 byte(s)
Removed 'interface' directory in trunk/pygtk/interface (moved everything up a level)
Made corresponding changes to SCons* and spec files.
1 johnpye 132 #include <stdexcept>
2     using namespace std;
3    
4     #include "symchar.h"
5    
6     /*
7     SymChar::SymChar(){
8     throw runtime_error("Can't create empty SymChar");
9     }
10     */
11     SymChar::SymChar(const SymChar &old) : sc(old.sc){
12     // nothing else
13     }
14    
15     SymChar::SymChar(const string &name){
16     sc = AddSymbol(name.c_str());
17     }
18    
19    
20     SymChar::SymChar(const char *name){
21     sc = AddSymbol(name);
22     }
23    
24     SymChar::SymChar(const symchar *hash) : sc(sc){
25     cerr << "CREATING SymChar from symchar*, '" << toString() << "'" << endl;
26     // nothing else
27     }
28    
29     SymChar::SymChar(const struct InstanceName &in) {
30    
31     //cerr << "Symchar(InstanceName) called" << endl;
32    
33     if(InstanceNameType(in) == IntArrayIndex){
34     char n[50];
35     snprintf(n,50,"%d",InstanceIntIndex(in));
36     sc = AddSymbol(n);
37     }else{
38     sc = InstanceNameStr(in);
39     }
40    
41     if(sc==NULL){
42     throw runtime_error("Invalid name in SymChar::SymChar(InstanceName)");
43     }
44     //cerr << "CREATING SymChar from InstanceName, '" << getName() << "'" << endl;
45     }
46    
47     const char *
48     SymChar::toString() const{
49     return SCP(sc);
50     }
51    
52     bool
53     SymChar::operator==(const SymChar &other) const{
54     if(sc == other.sc)return true;
55     return false;
56     }
57    
58     const symchar *
59     SymChar::getInternalType() const{
60     return sc;
61     }
62    
63     ostream& operator << (ostream& os, const SymChar& s){
64     return os << s.toString();
65     }

john.pye@anu.edu.au
ViewVC Help
Powered by ViewVC 1.1.22