summaryrefslogtreecommitdiff
path: root/ACE/ace/XML_Utils/XercesString.h
blob: 1915832d503c2a6d4f3f1384739b5e5f7f2813cd (plain)
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
#ifndef _XERCESSTRING_H
#define _XERCESSTRING_H

#include /**/ "ace/pre.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
#pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include <iosfwd>

#ifdef __BORLANDC__
using std::memcpy;
#endif

#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.
#include "XML_Utils_Export.h"

namespace XML
{
  class XML_Utils_Export XStr
  {
  public:
    XStr() : _wstr(0L) { };

// On unicode windows, ACE_TCHAR == XMLCh
#if !defined (_MSC_VER) || !defined (ACE_USES_WCHAR)
    XStr (const ACE_TCHAR* str);
#endif

    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);

    XMLCh operator [] (const int i) const;

    operator const XMLCh* () const { return _wstr; };

    XMLCh * release (void);

    /// Release the held string and free its memory.
    void reset (void);
  private:

    XMLCh* _wstr; // Internal representation
  };

  XML_Utils_Export bool operator== (const XStr& lhs, const XStr& rhs);
  XML_Utils_Export bool operator!= (const XStr& lhs, const XStr& rhs);

  XML_Utils_Export std::ostream&
  operator<< (std::ostream& o, XStr const& str);
}

#include /**/ "ace/post.h"

#endif /* _XERCESSTRING_H */