/[svn]/linuxsampler/trunk/src/scriptvm/common.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/scriptvm/common.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2884 by schoenebeck, Wed Jun 11 13:24:32 2014 UTC revision 2885 by schoenebeck, Fri Apr 22 15:37:45 2016 UTC
# Line 1  Line 1 
1  /*  /*
2   * Copyright (c) 2014 Christian Schoenebeck   * Copyright (c) 2014-2016 Christian Schoenebeck
3   *   *
4   * http://www.linuxsampler.org   * http://www.linuxsampler.org
5   *   *
# Line 9  Line 9 
9    
10  #include "common.h"  #include "common.h"
11  #include <iostream>  #include <iostream>
12    #include "editor/SourceToken.h"
13    
14  namespace LinuxSampler {  namespace LinuxSampler {
15    
# Line 31  namespace LinuxSampler { Line 32  namespace LinuxSampler {
32      void VMFunction::errMsg(const String& txt) {      void VMFunction::errMsg(const String& txt) {
33          std::cerr << "[ScriptVM] " << txt << std::endl;          std::cerr << "[ScriptVM] " << txt << std::endl;
34      }      }
35        
36        ///////////////////////////////////////////////////////////////////////
37        // class 'VMSourceToken'
38    
39        VMSourceToken::VMSourceToken() : m_token(NULL) {
40        }
41    
42        VMSourceToken::VMSourceToken(SourceToken* ct) : m_token(ct) {
43        }
44    
45        VMSourceToken::VMSourceToken(const VMSourceToken& other) {
46            if (other.m_token) {
47                m_token = new SourceToken;
48                *m_token = *other.m_token;
49            } else m_token = NULL;
50        }
51    
52        VMSourceToken::~VMSourceToken() {
53            if (m_token) {
54                delete m_token;
55                m_token = NULL;
56            }
57        }
58    
59        VMSourceToken& VMSourceToken::operator=(const VMSourceToken& other) {
60            if (m_token) delete m_token;
61            if (other.m_token) {
62                m_token = new SourceToken;
63                *m_token = *other.m_token;
64            } else m_token = NULL;
65            return *this;
66        }
67    
68        String VMSourceToken::text() const {
69            return (m_token) ? m_token->text() : "";
70        }
71    
72        int VMSourceToken::firstLine() const {
73            return (m_token) ? m_token->firstLine() : 0;
74        }
75    
76        int VMSourceToken::firstColumn() const {
77            return (m_token) ? m_token->firstColumn() : 0;
78        }
79    
80        bool VMSourceToken::isEOF() const {
81            return (m_token) ? m_token->isEOF() : true;
82        }
83    
84        bool VMSourceToken::isNewLine() const {
85            return (m_token) ? m_token->isNewLine() : false;
86        }
87    
88        bool VMSourceToken::isKeyword() const {
89            return (m_token) ? m_token->isKeyword() : false;
90        }
91    
92        bool VMSourceToken::isVariableName() const {
93            return (m_token) ? m_token->isVariableName() : false;
94        }
95    
96        bool VMSourceToken::isIdentifier() const {
97            return (m_token) ? m_token->isIdentifier() : false;
98        }
99    
100        bool VMSourceToken::isNumberLiteral() const {
101            return (m_token) ? m_token->isNumberLiteral() : false;
102        }
103    
104        bool VMSourceToken::isStringLiteral() const {
105            return (m_token) ? m_token->isStringLiteral() : false;
106        }
107    
108        bool VMSourceToken::isComment() const {
109            return (m_token) ? m_token->isComment() : false;
110        }
111    
112        bool VMSourceToken::isPreprocessor() const {
113            return (m_token) ? m_token->isPreprocessor() : false;
114        }
115    
116        bool VMSourceToken::isOther() const {
117            return (m_token) ? m_token->isOther() : true;
118        }
119    
120        bool VMSourceToken::isIntegerVariable() const {
121            return (m_token) ? m_token->isIntegerVariable() : false;
122        }
123    
124        bool VMSourceToken::isStringVariable() const {
125            return (m_token) ? m_token->isStringVariable() : false;
126        }
127    
128        bool VMSourceToken::isArrayVariable() const {
129            return (m_token) ? m_token->isArrayVariable() : false;
130        }
131    
132        bool VMSourceToken::isEventHandlerName() const {
133            return (m_token) ? m_token->isEventHandlerName() : false;
134        }
135    
136  } // namespace LinuxSampler  } // namespace LinuxSampler

Legend:
Removed from v.2884  
changed lines
  Added in v.2885

  ViewVC Help
Powered by ViewVC