File: ELObjPropVal.h

package info (click to toggle)
openjade 1.4devel1-20.1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 6,636 kB
  • sloc: cpp: 90,082; sh: 10,847; ansic: 2,365; lisp: 894; perl: 604; makefile: 443; sed: 93
file content (90 lines) | stat: -rw-r--r-- 2,561 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright (c) 1999 Matthias Clasen
// See the file copying.txt for copying permission.

#ifndef ELObjPropVal_INCLUDED
#define ELObjPropVal_INCLUDED 1

#include "Node.h"
#include "ELObj.h"

#ifdef DSSSL_NAMESPACE
namespace DSSSL_NAMESPACE {
#endif

class ELObjPropertyValue : public PropertyValue {
public:
  ELObjPropertyValue(Interpreter &interp, bool rcs) : interp_(&interp), rcs_(rcs), obj(0) { }
  void set(const NodePtr &nd) {
    obj = new (*interp_) NodePtrNodeListObj(nd);
  }
  void set(const NodeListPtr &nl) {
    obj = new (*interp_) NodeListPtrNodeListObj(nl);
  }
  void set(const NamedNodeListPtr &nnl) {
    obj = new (*interp_) NamedNodeListPtrNodeListObj(nnl);
  }
  void set(bool b) {
    if (b)
      obj = interp_->makeTrue();
    else
      obj = interp_->makeFalse();
  }
 void set(GroveChar c) {
    obj = interp_->makeChar(c);
  }
  void set(GroveString s) {
    obj = new (*interp_) StringObj(s.data(), s.size());
  }
  void set(ComponentName::Id id) {
    const char *s = rcs_ ? ComponentName::rcsName(id) : ComponentName::sdqlName(id);
    obj = interp_->makeSymbol(interp_->makeStringC(s));
  }
  void set(const GroveStringListPtr &gsListPtr) {
    PairObj *head = new (*interp_) PairObj(0, 0);
    ELObjDynamicRoot protect(*interp_, head);
    PairObj *tail = head;
    ConstGroveStringListIter sgListIter(*gsListPtr);
    while (!sgListIter.done()) {
      StringObj *gs = new (*interp_) StringObj(sgListIter.cur().data(), sgListIter.cur().size());
      tail->setCdr(gs);
      PairObj *tem = new (*interp_) PairObj(gs, 0);
      tail->setCdr(tem);
      tail = tem;
      sgListIter.next();
    }
    tail->setCdr(interp_->makeNil());
    obj = head->cdr();
  }
  void set(const ComponentName::Id *names) {
    PairObj *head = new (*interp_) PairObj(0, 0);
    ELObjDynamicRoot protect(*interp_, head);
    PairObj *tail = head;
    for (int i = 0; names[i] != ComponentName::noId; i++) {
      const char *s = (rcs_
                       ? ComponentName::rcsName(names[i])
                       : ComponentName::sdqlName(names[i]));
      SymbolObj *sym = interp_->makeSymbol(interp_->makeStringC(s));
      tail->setCdr(sym); // in case we ever gc symbols
      PairObj *tem = new (*interp_) PairObj(sym, 0);
      tail->setCdr(tem);
      tail = tem;
    }
    tail->setCdr(interp_->makeNil());
    obj = head->cdr();
  }
  void set(long l) {
    obj = interp_->makeInteger(l);
  }
  ELObj *obj;
private:
  Interpreter *interp_;
  bool rcs_;
};

#ifdef DSSSL_NAMESPACE
}
#endif

#endif /* not ELObjPropVal_INCLUDED */