NCL Composer  0.1.5
 All Classes Functions Variables Pages
AttributeReferences.cpp
1 /* Copyright (c) 2011 Telemidia/PUC-Rio.
2  * All rights reserved. This program and the accompanying materials
3  * are made available under the terms of the Eclipse Public License v1.0
4  * which accompanies this distribution, and is available at
5  * http://www.eclipse.org/legal/epl-v10.html
6  *
7  * Contributors:
8  * Telemidia/PUC-Rio - initial API and implementation
9  */
10 #include "util/AttributeReferences.h"
11 
12 namespace composer {
13  namespace util {
14 
16  QString attr,
17  QString ref_element,
18  QString ref_attr,
19  REFERENCE_SCOPE scope)
20 {
21  this->element = element;
22  this->attr = attr;
23  this->ref_element = ref_element;
24  this->ref_attr = ref_attr;
25  this->scope = scope;
26 
27  initializeStringToScope();
28 }
29 
31  QString attr,
32  QString ref_element,
33  QString ref_attr,
34  QString scope)
35 {
36  this->element = element;
37  this->attr = attr;
38  this->ref_element = ref_element;
39  this->ref_attr = ref_attr;
40 
41  initializeStringToScope();
42 
43  if(stringToScope.contains(scope))
44  this->scope = stringToScope.value(scope);
45  else
46  {
47  this->scope = USERDEFINED_SCOPE;
48  this->userDefinedScope = scope;
49  }
50 }
51 
53 {
54  return this->element;
55 }
56 
58 {
59  return this->attr;
60 }
61 
63 {
64  return this->ref_element;
65 }
66 
68 {
69  return this->ref_attr;
70 }
71 
72 AttributeReferences::REFERENCE_SCOPE AttributeReferences::getScope()
73 {
74  return this->scope;
75 }
76 
77 void AttributeReferences::initializeStringToScope()
78 {
79  if(!stringToScope.size())
80  {
81  stringToScope.insert(QString("SAME"), SAME_SCOPE);
82  stringToScope.insert(QString("ANY"), ANY_SCOPE);
83  }
84 }
85 
87 {
88  return this->userDefinedScope;
89 }
90 
91 } } //end namespace