summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-03-20 19:58:49 +0000
committerjai <jai@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2005-03-20 19:58:49 +0000
commit085da51551feb2bd9e9c3039dfb6e105490d9a75 (patch)
treecef1edf5464c7e9c6e1a2ce4ebe36d1531fcbd41
parentcd8c7a43c872d23faa3c09567da16df192805494 (diff)
downloadATCD-085da51551feb2bd9e9c3039dfb6e105490d9a75.tar.gz
Sun Mar 20 13:57:55 2005 Jaiganesh B <jai@dre.vanderbilt.edu>
-rw-r--r--TAO/CIAO/ChangeLog9
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp140
-rw-r--r--TAO/CIAO/DAnCE/Config_Handlers/XercesString.h73
3 files changed, 222 insertions, 0 deletions
diff --git a/TAO/CIAO/ChangeLog b/TAO/CIAO/ChangeLog
index 144aa6e2a61..4bfa8ea872a 100644
--- a/TAO/CIAO/ChangeLog
+++ b/TAO/CIAO/ChangeLog
@@ -1,3 +1,12 @@
+Sun Mar 20 13:57:55 2005 Jaiganesh B <jai@dre.vanderbilt.edu>
+
+ * DAnCE/Config_Handlers/XercesString.cpp:
+ * DAnCE/Config_Handlers/XercesString.h:
+
+ Added these new files from the old config handlers
+ directory to the new config handlers directory
+ to fix missing includes.
+
Sun Mar 20 13:54:17 2005 Jaiganesh B <jai@dre.vanderbilt.edu>
* DAnCE/Old_Config_Handlers/Process_Element_T.cpp:
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp
new file mode 100644
index 00000000000..877f9639d51
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.cpp
@@ -0,0 +1,140 @@
+// $Id$
+
+#include <ostream>
+
+#include "XercesString.h"
+using xercesc::XMLString;
+
+namespace Config_Handler
+{
+
+ XStr::XStr (const char* str)
+ : _wstr(0)
+ {
+ _wstr = XMLString::transcode(str);
+ }
+
+ XStr::XStr (XMLCh *wstr)
+ : _wstr(wstr)
+ {
+
+ }
+
+ XStr::XStr (const XMLCh* wstr)
+ : _wstr(0)
+ {
+ _wstr = XMLString::replicate(wstr);
+ }
+
+ XStr::XStr (const XStr &right)
+ : _wstr(0)
+ {
+ _wstr = XMLString::replicate(right._wstr);
+ }
+
+ XStr& XStr::operator= (const XStr& rhs)
+ {
+ if (&rhs == this)
+ return *this;
+ XStr temp (rhs);
+ ACE_Swap<XMLCh*>::swap (this->_wstr, temp._wstr);
+ return *this;
+ }
+
+ XStr::~XStr ()
+ {
+ if (_wstr)
+ XMLString::release(&_wstr);
+ }
+
+ const XMLCh* XStr::begin () const
+ {
+ return _wstr;
+ }
+
+ const XMLCh* XStr::end () const
+ {
+ return _wstr + size();
+ }
+
+ bool XStr::append(const XMLCh *tail)
+ {
+ int iTailLen = XMLString::stringLen(tail);
+ int iWorkLen = XMLString::stringLen(_wstr);
+ XMLCh *result = new XMLCh[ iWorkLen + iTailLen + 1 ];
+ bool bOK = result != 0;
+ if (bOK)
+ {
+ XMLCh *target = result;
+ XMLString::moveChars(target, _wstr, iWorkLen);
+ target += iWorkLen;
+ XMLString::moveChars(target, tail, iTailLen);
+ target += iTailLen;
+ *target++ = 0;
+ XMLString::release(&_wstr);
+ _wstr = result;
+ }
+ return bOK;
+ }
+
+ bool XStr::erase(const XMLCh *head, const XMLCh *tail)
+ {
+ bool bOK = head <= tail && head >= begin() && tail <= end();
+ if (bOK)
+ {
+ XMLCh *result = new XMLCh[ size() - (tail - head) + 1 ];
+ XMLCh *target = result;
+ bOK = target != NULL;
+ if (bOK)
+ {
+ const XMLCh *cursor = begin();
+
+ while (cursor != head) *target++ = *cursor++;
+ cursor = tail;
+ while ( cursor != end() ) *target++ = *cursor++;
+ *target ++ = 0;
+ XMLString::release(&_wstr);
+ _wstr = result;
+ }
+ }
+ return bOK;
+ }
+
+ int XStr::size () const
+ {
+ return XMLString::stringLen(_wstr);
+ }
+
+ XMLCh XStr::operator [] (const int i)
+ {
+ return _wstr[i];
+ }
+
+ const XMLCh XStr::operator [] (const int i) const
+ {
+ return _wstr[i];
+ }
+
+ bool operator== (const XStr& lhs, const XStr& rhs)
+ {
+ return XMLString::compareIString (lhs,rhs) == 0;
+ }
+
+ bool operator!= (const XStr& lhs, const XStr& rhs)
+ {
+ return !operator==(lhs, rhs);
+ }
+
+
+ std::ostream&
+ operator<< (std::ostream& o, XStr const& str)
+ {
+ char* s = XMLString::transcode (str);
+
+ o << s;
+
+ XMLString::release (&s); // idiots?
+ return o;
+ }
+
+}
diff --git a/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h
new file mode 100644
index 00000000000..7ac692d34de
--- /dev/null
+++ b/TAO/CIAO/DAnCE/Config_Handlers/XercesString.h
@@ -0,0 +1,73 @@
+// $Id$
+
+#ifndef _XERCESSTRING_H
+#define _XERCESSTRING_H
+
+#include /**/ "ace/pre.h"
+
+#include "ace/Swap.h"
+
+#if !defined (ACE_LACKS_PRAGMA_ONCE)
+#pragma once
+#endif /* ACE_LACKS_PRAGMA_ONCE */
+
+#include <iosfwd>
+
+#include <xercesc/util/XMLString.hpp>
+
+// Utility class that provides a std::string like facade to XMLString.
+// Doesn't implement all of the methods of std::string.
+
+namespace Config_Handler
+{
+
+ class XStr
+ {
+ public:
+ XStr() : _wstr(0L) { };
+
+ XStr (const char* str);
+
+ XStr (XMLCh* wstr);
+
+ XStr (const XMLCh* wstr);
+
+ XStr (const XStr& copy);
+
+ XStr& operator= (const XStr& rhs);
+
+ ~XStr();
+
+ const XMLCh* begin() const;
+
+ const XMLCh* end() const;
+
+ bool append(const XMLCh* tail);
+
+ bool erase (const XMLCh* head, const XMLCh* tail);
+
+ int size() const;
+
+ XMLCh operator [] (const int i);
+
+ const XMLCh operator [] (const int i) const;
+
+ operator const XMLCh* () const { return _wstr; };
+
+ private:
+
+ XMLCh* _wstr; // Internal representation
+
+ };
+
+ bool operator== (const XStr& lhs, const XStr& rhs);
+ bool operator!= (const XStr& lhs, const XStr& rhs);
+
+ std::ostream&
+ operator<< (std::ostream& o, XStr const& str);
+
+}
+
+#include /**/ "ace/post.h"
+
+#endif /* _XERCESSTRING_H */