CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DDLSAX2ExpressionHandler.cc
Go to the documentation of this file.
1 /***************************************************************************
2  DDLSAX2ExpressionHandler.cc - description
3  -------------------
4  begin : Mon Feb 25, 2002
5  email : case@ucdhep.ucdavis.edu
6  ***************************************************************************/
7 
8 /***************************************************************************
9  * *
10  * DDDParser sub-component of DDD *
11  * *
12  ***************************************************************************/
13 
17 
19 
21 
22 #include <iostream>
23 #include <vector>
24 #include <string>
25 
26 // ---------------------------------------------------------------------------
27 // DDLSAX2Handler: Constructors and Destructor
28 // ---------------------------------------------------------------------------
31 {}
32 
34 {}
35 
36 // This does most of the work, it sets and determines whether it is
37 // in a ConstantsSection element, and if so, to process all the
38 // constants accordingly.
39 void
41  const XMLCh* const localname,
42  const XMLCh* const qname,
43  const Attributes& attrs )
44 {
45  ++elementCount_;
46  attrCount_ += attrs.getLength();
47 
48  pElementName = StrX(qname).localForm();
49 
50  if (pElementName == "Constant")
51  {
53  DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: start ") + pElementName);
54  unsigned int numAtts = attrs.getLength();
55  std::string varName, varValue;
56  for (unsigned int i = 0; i < numAtts; ++i)
57  {
58  std::string myattname(StrX(attrs.getLocalName(i)).localForm());
59  std::string myvalue(StrX(attrs.getValue(i)).localForm());
60 
61  std::string myQName(StrX(attrs.getQName(i)).localForm());
62  DCOUT_V('P', std::string("DetectorDescription/Parser/interface/DDLSAX2ExpressionHandler: ") + "getLocalName = " + myattname + " getValue = " + myvalue + " getQName = " + myQName);
63 
64  // attributes unit and quantity are not used right now.
65  if (myattname == "name")
66  varName = myvalue;
67  else if (myattname == "value")
68  varValue = myvalue;
69  }
70  // DDLParser* beingParsed = DDLParser::instance();
71  // std::string nmspace = getnmspace(extractFileName( beingParsed->getCurrFileName()));
73  ev.set(nmspace_, varName, varValue);
74  }
75 }
76 
77 void
78 DDLSAX2ExpressionHandler::endElement( const XMLCh* const uri,
79  const XMLCh* const localname,
80  const XMLCh* const qname )
81 {}
int i
Definition: DBlmapReader.cc:9
DDLSAX2ExpressionHandler(DDCompactView &cpv)
virtual void set(const std::string &ns, const std::string &name, const std::string &valueExpr)=0
put a new variable named &#39;namespace:name&#39; into the dictionary of the evaluator
type of data representation of DDCompactView
Definition: DDCompactView.h:81
unsigned int elementCount_
DDLSAX2FileHandler is the SAX2 Handler for XML files found in the configuration file.
static value_type & instance()
Interface of an Expression Evaluator.
std::string nmspace_
const char * localForm() const
Definition: StrX.h:66
void endElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname)
#define DCOUT_V(M_v_Y, M_v_S)
Definition: DDdebug.h:54
void startElement(const XMLCh *const uri, const XMLCh *const localname, const XMLCh *const qname, const Attributes &attrs)
def qname
Definition: asciidump.py:315
std::map< std::string, int > elementTypeCounter_
Definition: StrX.h:32
unsigned int attrCount_
XERCES_CPP_NAMESPACE::Attributes Attributes