Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members

LCD_DocumentUtil.hh

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 // $Id: LCD_DocumentUtil.hh,v 1.10 2004/02/03 12:45:21 uid561 Exp $
00003 // ----------------------------------------------------------------------------
00004 //
00005 // -*-c++-*-
00006 // LCD_DocumentUtil -- static utilities which more logically would
00007 // belong with an element wrapper class
00008 
00009 #ifndef LCD_DOCUMENTUTIL_H
00010 #define LCD_DOCUMENTUTIL_H
00011 
00012 #include "xercesc/dom/deprecated/DOM_Document.hpp"
00013 #include "xercesc/dom/deprecated/DOM_Element.hpp"
00014 #include "xercesc/dom/deprecated/DOMString.hpp"
00015 
00016 // Attribute values are always returned as strings -- in fact, as unicode
00017 // strings.  So supply translation routines to get from DOMString
00018 // to double, int unsigned int, and char.
00019 class LCD_DocumentUtil {
00020 private:
00021   // For now and probably forever all unicode characters are actually
00022   // just ascii, so squeeze out extra byte to get "regular" characters
00023   static bool  squash(const XERCES_CPP_NAMESPACE::DOMString& domstr,
00024                       char *squashed,
00025                       int bufLen = m_MAX_STR_LEN);
00026 public:
00027   static bool convertValue(const XERCES_CPP_NAMESPACE::DOMString& strVal,
00028                            double *val);
00029   static bool convertValue(const XERCES_CPP_NAMESPACE::DOMString& strVal,
00030                            int *val);
00031   static bool convertValue(const XERCES_CPP_NAMESPACE::DOMString& strVal,
00032                            unsigned int *val);
00033   static bool convertValue(const XERCES_CPP_NAMESPACE::DOMString& strVal,
00034                            bool *val);
00035 
00036   // Get first descendant element of specified elt. with specified tag name
00037   static XERCES_CPP_NAMESPACE::DOM_Element
00038   firstDesc(const XERCES_CPP_NAMESPACE::DOM_Element ancestor,
00039             const XERCES_CPP_NAMESPACE::DOMString& tagName);
00040 
00041   static XERCES_CPP_NAMESPACE::DOM_Element
00042   firstDesc(const XERCES_CPP_NAMESPACE::DOM_Element ancestor,
00043             const char* tagName);
00044 
00045   // caller supplies buffer for char string.
00046   static bool convertValue(const XERCES_CPP_NAMESPACE::DOMString& strVal,
00047                            char* buf, int bufLen) {
00048     return squash(strVal, buf, bufLen);
00049   }
00050 
00051 private:
00052   static const int m_MAX_STR_LEN;
00053 };
00054 #endif

Generated on Thu Oct 7 18:44:46 2004 for LCDG4 by doxygen 1.3.4