Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

IdOpTruncate.cxx

Go to the documentation of this file.
00001 // $Header: /nfs/slac/g/glast/ground/cvs/xmlUtil/src/id/IdOpTruncate.cxx,v 1.2 2001/09/25 21:43:04 jrb Exp $
00002 
00003 #include "xmlUtil/id/IdOpTruncate.h"
00004 #include "xml/Dom.h"
00005 
00006 namespace xmlUtil {
00007 
00008   IdOpTruncate::IdOpTruncate(DOM_Element trunc) {
00009     // Get values of attributes "start" and "beyond", save
00010     start = xml::Dom::getAttribute(trunc, "start");
00011     std::string beyondVal = xml::Dom::getAttribute(trunc, "beyond");
00012     beyond = (beyondVal.compare(std::string("true")) == 0);
00013   }
00014 
00015   NamedId * IdOpTruncate::convert(const NamedId& inputId) {
00016     // Check that inputId has a "start" field.  
00017     int nToCopy;
00018     if ((nToCopy = inputId.hasField(start)) < 0) return 0;
00019 
00020     if (beyond) ++nToCopy;
00021     NamedId *newId = new NamedId(inputId, nToCopy);
00022     return newId;
00023   }
00024 
00025 }

Generated on Wed Oct 16 14:02:48 2002 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001